123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- import 'package:flutter/material.dart';
- import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
- import 'package:get/get.dart';
- import 'package:cs_resources/generated/assets.dart';
- import 'package:widgets/ext/ex_widget.dart';
- import 'package:cs_resources/constants/color_constants.dart';
- import '../my_load_image.dart';
- import '../my_text_view.dart';
- import '../no_shadow_scroll_behavior.dart';
- import '../utils/dark_theme_util.dart';
- class AppDefaultDialog extends StatelessWidget {
- VoidCallback? cancelAction;
- VoidCallback? confirmAction;
- String? cancelText;
- String? confirmText;
- String? title;
- String message;
- AppDefaultDialog(this.message, {this.cancelText, this.cancelAction, this.confirmText, this.confirmAction, this.title});
- @override
- Widget build(BuildContext context) {
- return Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- //Title
- Container(
- decoration: BoxDecoration(
- color: DarkThemeUtil.multiColors(ColorConstants.appBlue, darkColor: ColorConstants.darkBlackItemLight),
- borderRadius: const BorderRadius.only(
- topLeft: Radius.circular(5),
- topRight: Radius.circular(5),
- ),
- ),
- padding: const EdgeInsets.only(left: 30, right: 10, top: 5, bottom: 5),
- child: Row(
- children: [
- Expanded(
- child: MyTextView(
- title ?? "提示".tr,
- fontSize: 18,
- marginTop: 14,
- marginBottom: 14,
- isFontMedium: true,
- textColor: ColorConstants.whitefe,
- textAlign: TextAlign.center,
- ),
- ),
- //Cancel
- InkWell(
- onTap: onCancel,
- child: MyLoadImage(
- Assets.baseLibDialogDeleteIcon,
- width: 26,
- height: 26,
- ),
- ),
- ],
- ),
- ),
- DecoratedBox(
- decoration: BoxDecoration(
- color: DarkThemeUtil.multiColors(Colors.white, darkColor: ColorConstants.darkBlackItemLightMost),
- borderRadius: const BorderRadius.only(
- bottomLeft: Radius.circular(5),
- bottomRight: Radius.circular(5),
- ),
- ),
- child: Column(
- children: [
- //文本的高度限制,加入滚动并去除边界波纹效果
- ScrollConfiguration(
- behavior: NoShadowScrollBehavior(),
- child: SingleChildScrollView(
- child: MyTextView(
- message,
- fontSize: 16,
- textColor: DarkThemeUtil.multiColors(const Color(0xff333333), darkColor: Colors.white),
- isFontRegular: true,
- textAlign: TextAlign.center,
- paddingLeft: 30,
- paddingRight: 30,
- paddingBottom: 25,
- marginTop: 25,
- ),
- )).marginSymmetric(vertical: 10).constrained(maxHeight: 400),
- //Buttons
- Row(
- children: [
- Expanded(
- flex: 1,
- child: InkWell(
- onTap: () {
- onCancel();
- cancelAction?.call();
- },
- child: MyTextView(
- cancelText ?? "Cancel".tr,
- marginLeft: 20,
- marginBottom: 35,
- paddingTop: 10,
- paddingBottom: 10,
- fontSize: 14,
- isFontRegular: true,
- textAlign: TextAlign.center,
- textColor: DarkThemeUtil.multiColors(ColorConstants.blue1578fe, darkColor: Colors.white),
- borderColor: DarkThemeUtil.multiColors(ColorConstants.blue1578fe, darkColor: Colors.white),
- cornerRadius: 3,
- borderWidth: 1,
- ),
- )),
- Expanded(
- flex: 1,
- child: InkWell(
- onTap: () {
- onCancel();
- confirmAction?.call();
- },
- child: MyTextView(
- confirmText ?? "Confirm".tr,
- marginLeft: 10,
- paddingTop: 10,
- paddingBottom: 10,
- fontSize: 14,
- isFontRegular: true,
- marginRight: 20,
- marginBottom: 35,
- textAlign: TextAlign.center,
- textColor: Colors.white,
- backgroundColor: ColorConstants.blue1578fe,
- cornerRadius: 3,
- ),
- )),
- ],
- ),
- ],
- ),
- ),
- ],
- ).constrained(width: 295);
- }
- //取消弹框
- void onCancel() async {
- SmartDialog.dismiss();
- }
- }
|