1
This commit is contained in:
@@ -34,7 +34,7 @@ class Button extends StatelessWidget {
|
||||
};
|
||||
|
||||
return Opacity(
|
||||
opacity: disabled ? 0.5 : 1,
|
||||
opacity: disabled || loading ? 0.5 : 1,
|
||||
child: Container(
|
||||
width: width,
|
||||
decoration: bgDecoration.copyWith(borderRadius: radius),
|
||||
@@ -47,14 +47,27 @@ class Button extends StatelessWidget {
|
||||
highlightColor: Colors.white.withValues(alpha: 0.2),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
child: Center(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: type != ThemeType.info ? Colors.white : Colors.black,
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (loading)
|
||||
const SizedBox(
|
||||
width: 15,
|
||||
height: 15,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation(Colors.white),
|
||||
),
|
||||
),
|
||||
Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
color: type != ThemeType.info ? Colors.white : Colors.black,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
53
lib/widgets/base/empty/index.dart
Normal file
53
lib/widgets/base/empty/index.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum EmptyType {
|
||||
data,
|
||||
}
|
||||
|
||||
class Empty extends StatelessWidget {
|
||||
final EmptyType type;
|
||||
final String? text;
|
||||
final Widget? child;
|
||||
|
||||
const Empty({
|
||||
super.key,
|
||||
this.type = EmptyType.data,
|
||||
this.text,
|
||||
this.child,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var emptyImg = switch (type) {
|
||||
EmptyType.data => Image.asset('assets/image/empty_data.png'),
|
||||
};
|
||||
var emptyText = switch (type) {
|
||||
EmptyType.data => '暂无数据',
|
||||
};
|
||||
return Container(
|
||||
padding: EdgeInsets.all(0),
|
||||
child: Column(
|
||||
children: [
|
||||
FractionallySizedBox(
|
||||
widthFactor: 0.5,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(bottom: 15),
|
||||
child: emptyImg,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
text ?? emptyText,
|
||||
style: Theme.of(context).textTheme.labelLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
child != null
|
||||
? Container(
|
||||
margin: EdgeInsets.only(top: 15),
|
||||
child: child,
|
||||
)
|
||||
: SizedBox(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user