42 lines
1.0 KiB
Dart
42 lines
1.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class EmptyState extends StatelessWidget {
|
|
final String message;
|
|
final bool usePureBackground; // 添加一个控制背景的参数
|
|
|
|
const EmptyState({
|
|
super.key,
|
|
required this.message,
|
|
this.usePureBackground = false, // 默认使用图片背景
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
decoration: usePureBackground
|
|
? const BoxDecoration(
|
|
color: Color(0xff0C0C16), // 纯色背景
|
|
)
|
|
: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('images/pwd_bg.png'),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
message,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |