马良AI写作初始化仓库
This commit is contained in:
37
AINoval/lib/ui/common/loading_indicator.dart
Normal file
37
AINoval/lib/ui/common/loading_indicator.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:ainoval/utils/web_theme.dart';
|
||||
|
||||
/// 加载指示器组件
|
||||
class LoadingIndicator extends StatelessWidget {
|
||||
|
||||
const LoadingIndicator({
|
||||
Key? key,
|
||||
this.message,
|
||||
this.color,
|
||||
}) : super(key: key);
|
||||
final String? message;
|
||||
final Color? color;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
color ?? WebTheme.getPrimaryColor(context),
|
||||
),
|
||||
),
|
||||
if (message != null) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
message!,
|
||||
style: Theme.of(context).textTheme.bodyMedium,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
44
AINoval/lib/ui/common/no_data_placeholder.dart
Normal file
44
AINoval/lib/ui/common/no_data_placeholder.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// 无数据占位符组件
|
||||
class NoDataPlaceholder extends StatelessWidget {
|
||||
|
||||
const NoDataPlaceholder({
|
||||
Key? key,
|
||||
required this.message,
|
||||
required this.icon,
|
||||
this.color,
|
||||
this.size = 64,
|
||||
}) : super(key: key);
|
||||
final String message;
|
||||
final IconData icon;
|
||||
final Color? color;
|
||||
final double size;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: size,
|
||||
color: color ?? theme.disabledColor.withOpacity(0.5),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
message,
|
||||
style: theme.textTheme.bodyLarge?.copyWith(
|
||||
color: theme.textTheme.bodyLarge?.color?.withOpacity(0.6),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user