init cc
This commit is contained in:
69
lib/core/widgets/loading_widget.dart
Normal file
69
lib/core/widgets/loading_widget.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// A customizable loading widget
|
||||
class LoadingWidget extends StatelessWidget {
|
||||
final String? message;
|
||||
final double size;
|
||||
final Color? color;
|
||||
|
||||
const LoadingWidget({
|
||||
super.key,
|
||||
this.message,
|
||||
this.size = 24.0,
|
||||
this.color,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: size,
|
||||
height: size,
|
||||
child: CircularProgressIndicator(
|
||||
color: color ?? Theme.of(context).colorScheme.primary,
|
||||
strokeWidth: 3.0,
|
||||
),
|
||||
),
|
||||
if (message != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
message!,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.7),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A small loading indicator for buttons
|
||||
class SmallLoadingIndicator extends StatelessWidget {
|
||||
final Color? color;
|
||||
final double size;
|
||||
|
||||
const SmallLoadingIndicator({
|
||||
super.key,
|
||||
this.color,
|
||||
this.size = 16.0,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
width: size,
|
||||
height: size,
|
||||
child: CircularProgressIndicator(
|
||||
color: color ?? Theme.of(context).colorScheme.onPrimary,
|
||||
strokeWidth: 2.0,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user