46 lines
1.5 KiB
Dart
46 lines
1.5 KiB
Dart
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:forui/forui.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import 'package:pj_supermarket_cloud/common/widgets/app/app_dialog.dart';
|
|
|
|
/// 展示标准警告确认弹框,关闭、遮罩点击或系统返回均按取消处理。
|
|
Future<bool> appMessageDialog(BuildContext context, String msg) async {
|
|
final theme = FTheme.of(context);
|
|
final res = await showAppDialog<bool>(
|
|
context: context,
|
|
builder: (dialogContext) => AppDialog(
|
|
title: const Text('警告'),
|
|
leading: FIcon(
|
|
FAssets.icons.circleAlert,
|
|
color: theme.colorScheme.primary,
|
|
size: theme.typography.xl2.fontSize,
|
|
).center().width(44.w).height(44.h),
|
|
width: context.width * 0.6,
|
|
maxWidth: context.width * 0.6,
|
|
onClose: () => Navigator.of(dialogContext).pop(false),
|
|
content: Text(msg, style: theme.typography.xl)
|
|
.width(double.infinity)
|
|
.padding(vertical: 40.h),
|
|
actions: [
|
|
FButton(
|
|
label: Text(
|
|
'确定',
|
|
style: theme.typography.base.copyWith(
|
|
color: theme.colorScheme.secondary,
|
|
),
|
|
),
|
|
onPress: () => Navigator.of(dialogContext).pop(true),
|
|
).width(180.w),
|
|
FButton(
|
|
style: FButtonStyle.outline,
|
|
label: Text('取消', style: theme.typography.base),
|
|
onPress: () => Navigator.of(dialogContext).pop(false),
|
|
).width(180.w),
|
|
],
|
|
),
|
|
);
|
|
return res ?? false;
|
|
}
|