42 lines
1.0 KiB
Dart
42 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:loading_animation_widget/loading_animation_widget.dart';
|
|
|
|
class LoadingWidget extends StatelessWidget {
|
|
const LoadingWidget({
|
|
this.size = 50,
|
|
this.color,
|
|
this.message,
|
|
super.key,
|
|
});
|
|
|
|
final double size;
|
|
final Color? color;
|
|
final String? message;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final effectiveColor = color ?? Theme.of(context).colorScheme.primary;
|
|
|
|
return Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
LoadingAnimationWidget.staggeredDotsWave(
|
|
color: effectiveColor,
|
|
size: size,
|
|
),
|
|
if (message != null) ...[
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
message!,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|