69 lines
1.6 KiB
Dart
69 lines
1.6 KiB
Dart
import 'app_card.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class LoadingOverlay extends StatelessWidget {
|
|
const LoadingOverlay({
|
|
super.key,
|
|
required this.isLoading,
|
|
required this.child,
|
|
this.message,
|
|
});
|
|
|
|
final bool isLoading;
|
|
final Widget child;
|
|
final String? message;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
child,
|
|
if (isLoading)
|
|
ColoredBox(
|
|
color: Colors.black26,
|
|
child: Center(
|
|
child: AppCard(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const CircularProgressIndicator(),
|
|
if (message != null) ...[
|
|
const SizedBox(height: 16),
|
|
Text(message!),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|
|
|
|
class AppLoadingIndicator extends StatelessWidget {
|
|
const AppLoadingIndicator({super.key, this.message});
|
|
|
|
final String? message;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Center(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
const CircularProgressIndicator(),
|
|
if (message != null) ...[
|
|
const SizedBox(height: 16),
|
|
Text(message!, style: Theme.of(context).textTheme.bodyMedium),
|
|
],
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|