Merge branch 'main_2.0'

# Conflicts:
#	.dart_tool/package_config.json
#	.flutter-plugins-dependencies
#	.idea/libraries/Dart_Packages.xml
#	example/pubspec.lock
This commit is contained in:
2026-04-16 10:43:36 +08:00
9 changed files with 399 additions and 234 deletions

View File

@@ -59,100 +59,106 @@ class ToastUtils {
bool isShowConfirm = false,
Color? barrierColor,
EdgeInsetsGeometry? padding,
bool useSafeArea = true,
bool useSafeArea = false,
}) {
cancelToast();
return showDialog(
useSafeArea: useSafeArea,
context: context,
builder: (BuildContext ctx) {
return Container(
width: double.infinity,
height: MediaQuery.of(context).size.height / 2,
margin: EdgeInsets.only(
top: height == null
? MediaQuery.of(context).size.height / 2
: (MediaQuery.of(context).size.height - height),
),
padding: padding ?? const EdgeInsets.only(bottom: 40),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
),
child: Column(
children: [
header ??
Container(
padding: const EdgeInsets.only(bottom: 5),
decoration: const BoxDecoration(
border: Border(
bottom:
BorderSide(color: Color(0xffE1E1E1), width: 0.5),
),
),
child: Row(
children: [
GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
padding:
const EdgeInsets.only(left: 6, right: 10),
color: Colors.transparent,
child: Icon(
Icons.keyboard_arrow_down_rounded,
size: leftIconSize ?? 40,
final dialogHeight = height ?? MediaQuery.of(ctx).size.height / 2;
final bottomInset = MediaQuery.of(ctx).padding.bottom;
return Material(
type: MaterialType.transparency,
child: Align(
alignment: Alignment.bottomCenter,
child: Container(
width: double.infinity,
height: dialogHeight,
padding: (padding ?? const EdgeInsets.only(bottom: 40))
.add(EdgeInsets.only(bottom: bottomInset)),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(12),
topRight: Radius.circular(12),
),
),
child: Column(
children: [
header ??
Container(
padding: const EdgeInsets.only(bottom: 5),
decoration: const BoxDecoration(
border: Border(
bottom: BorderSide(
color: Color(0xffE1E1E1),
width: 0.5,
),
),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Text(
title ?? '头部',
style: TextStyle(
color: const Color(0xff333333),
fontSize: titleFontSize ?? 18,
fontWeight: FontWeight.bold,
child: Row(
children: [
GestureDetector(
onTap: () => Navigator.of(ctx).pop(),
child: Container(
padding:
const EdgeInsets.only(left: 6, right: 10),
color: Colors.transparent,
child: Icon(
Icons.keyboard_arrow_down_rounded,
size: leftIconSize ?? 40,
),
),
),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Text(
title ?? '头部',
style: TextStyle(
color: const Color(0xff333333),
fontSize: titleFontSize ?? 18,
fontWeight: FontWeight.bold,
),
),
),
),
GestureDetector(
onTap: () {
if (isShowConfirm) {
if (onConfirm != null) {
onConfirm();
Navigator.of(ctx).pop();
}
}
},
child: Container(
padding: const EdgeInsets.only(
left: 10,
top: 8,
bottom: 8,
right: 18,
),
alignment: Alignment.center,
color: Colors.transparent,
child: Text(
'确定',
style: TextStyle(
color: isShowConfirm
? const Color(0xff4D6FD5)
: Colors.transparent,
fontSize: 16),
),
),
)
],
),
GestureDetector(
onTap: () {
if (isShowConfirm) {
if (onConfirm != null) {
onConfirm();
Navigator.pop(context);
}
}
},
child: Container(
padding: const EdgeInsets.only(
left: 10,
top: 8,
bottom: 8,
right: 18,
),
alignment: Alignment.center,
color: Colors.transparent,
child: Text(
'确定',
style: TextStyle(
color: isShowConfirm
? const Color(0xff4D6FD5)
: Colors.transparent,
fontSize: 16),
),
),
)
],
),
),
Expanded(child: contentWidget ?? const SizedBox())
],
),
Expanded(child: contentWidget ?? const SizedBox())
],
),
),
),
);
});