This commit is contained in:
zhutao
2025-08-22 14:15:02 +08:00
parent 5853bdf004
commit 99a1ce601e
120 changed files with 5297 additions and 101 deletions

View File

@@ -0,0 +1,84 @@
import 'package:flutter/material.dart';
///自定义按钮
///包括loading功能
class CustomButton extends StatelessWidget {
final Widget child;
final VoidCallback? onPressed;
final bool loading;
final bool round;
final bool disabled;
const CustomButton({
super.key,
required this.child,
this.onPressed,
this.loading = false,
this.round = true,
this.disabled = false,
});
@override
Widget build(BuildContext context) {
///自定义颜色
// switch (size) {
// case ButtonSize.small:
// height = 28;
// loadingSize = 16;
// fontSize = 12;
// padding = const EdgeInsets.symmetric(horizontal: 12);
// break;
// case ButtonSize.large:
// height = 48;
// loadingSize = 24;
// fontSize = 18;
// padding = const EdgeInsets.symmetric(horizontal: 20);
// break;
// case ButtonSize.medium:
// height = 45;
// loadingSize = 15;
// fontSize = 16;
// padding = const EdgeInsets.symmetric(horizontal: 16);
// break;
// }
void handClick() {
if (!loading && !disabled) {
onPressed?.call();
}
}
return Opacity(
opacity: disabled ? 0.5 : 1,
child: ElevatedButton(
onPressed: handClick,
style: ElevatedButton.styleFrom(
shape: round
? const StadiumBorder()
: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Visibility(
visible: loading,
child: Container(
margin: EdgeInsets.only(right: 8),
child: SizedBox.square(
dimension: 15,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
),
),
),
child,
],
),
),
);
}
}

View File

@@ -0,0 +1,35 @@
import 'package:flutter/material.dart';
import '../../../config/app_context.dart';
class Empty extends StatelessWidget {
final String? title;
final Widget? child;
const Empty({super.key, this.title, this.child});
@override
Widget build(BuildContext context) {
return SizedBox.expand(
child: Align(
alignment: const FractionalOffset(0.5, 0.2),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
FractionallySizedBox(
widthFactor: 0.5,
child: Image.asset("assets/image/empty_data.png"),
),
if (title != null)
Text(
title!,
style: AppContext.textTheme.labelMedium,
),
if( child != null)
child!
],
),
),
);
}
}