|
@@ -1,28 +1,39 @@
|
|
|
+import 'package:cs_resources/generated/assets.dart';
|
|
|
+import 'package:cs_resources/generated/l10n.dart';
|
|
|
+import 'package:cs_resources/theme/app_colors_theme.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
-import 'package:cs_resources/constants/color_constants.dart';
|
|
|
+import 'package:widgets/my_load_image.dart';
|
|
|
import '../my_text_view.dart';
|
|
|
-import '../no_shadow_scroll_behavior.dart';
|
|
|
import 'dart:ui';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
import 'package:widgets/widget_export.dart';
|
|
|
|
|
|
+import '../no_shadow_scroll_behavior.dart';
|
|
|
+
|
|
|
/*
|
|
|
* 默认的弹窗
|
|
|
*/
|
|
|
class AppDefaultDialog extends StatelessWidget {
|
|
|
- String title;
|
|
|
+ String? title;
|
|
|
+
|
|
|
String message;
|
|
|
VoidCallback confirmAction;
|
|
|
VoidCallback? cancelAction;
|
|
|
+ bool isShowCancelBtn;
|
|
|
+ String? confirmTxt;
|
|
|
+ String? cancelTxt;
|
|
|
|
|
|
AppDefaultDialog({
|
|
|
- required this.title,
|
|
|
required this.message,
|
|
|
required this.confirmAction,
|
|
|
+ this.title,
|
|
|
this.cancelAction,
|
|
|
+ this.isShowCancelBtn = true,
|
|
|
+ this.confirmTxt,
|
|
|
+ this.cancelTxt,
|
|
|
});
|
|
|
|
|
|
@override
|
|
@@ -35,29 +46,52 @@ class AppDefaultDialog extends StatelessWidget {
|
|
|
//Title (如果使用 Container 为最外层容器则默认为 match_parent 的效果,除非我们限制宽度和最大高度最小高度)
|
|
|
Container(
|
|
|
width: double.infinity,
|
|
|
- decoration: const BoxDecoration(
|
|
|
- color: Colors.white,
|
|
|
- borderRadius: BorderRadius.all(Radius.circular(15)),
|
|
|
+ height: 55,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: context.appColors.btnBgDefault,
|
|
|
+ borderRadius: const BorderRadius.only(
|
|
|
+ topRight: Radius.circular(15),
|
|
|
+ topLeft: Radius.circular(15),
|
|
|
+ ),
|
|
|
),
|
|
|
- child: Column(
|
|
|
+ child: Row(
|
|
|
children: [
|
|
|
+ const SizedBox(width: 45),
|
|
|
MyTextView(
|
|
|
- title,
|
|
|
- fontSize: 19,
|
|
|
+ title ?? S.current.alert,
|
|
|
+ fontSize: 18,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
isFontMedium: true,
|
|
|
- textColor: ColorConstants.black,
|
|
|
- marginTop: 15,
|
|
|
- marginBottom: 15,
|
|
|
- ),
|
|
|
+ textColor: Colors.white,
|
|
|
+ ).expanded(),
|
|
|
+ const MyAssetImage(Assets.baseServiceDialogDeleteIcon,width: 25,height: 25.5,).onTap((){
|
|
|
+ onCancel();
|
|
|
+ },padding: 10)
|
|
|
+ ],
|
|
|
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ padding: const EdgeInsets.only(top: 30),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: context.appColors.whiteSecondBG,
|
|
|
+ borderRadius: const BorderRadius.only(
|
|
|
+ bottomLeft: Radius.circular(15),
|
|
|
+ bottomRight: Radius.circular(15),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
Scrollbar(
|
|
|
child: ScrollConfiguration(
|
|
|
behavior: NoShadowScrollBehavior(),
|
|
|
child: SingleChildScrollView(
|
|
|
child: MyTextView(
|
|
|
message,
|
|
|
- fontSize: 16,
|
|
|
- textColor: Colors.black,
|
|
|
+ fontSize: 18,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
isFontRegular: true,
|
|
|
textAlign: TextAlign.center,
|
|
|
paddingLeft: 30,
|
|
@@ -66,35 +100,31 @@ class AppDefaultDialog extends StatelessWidget {
|
|
|
),
|
|
|
),
|
|
|
).constrained(maxHeight: 210),
|
|
|
-
|
|
|
-
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(top: 25),
|
|
|
- color: Color(0XFFCECECE),
|
|
|
- height: 0.5,
|
|
|
- ),
|
|
|
Row(
|
|
|
children: [
|
|
|
- Expanded(
|
|
|
- flex: 1,
|
|
|
- child: InkWell(
|
|
|
- onTap: () {
|
|
|
- onCancel();
|
|
|
- cancelAction?.call();
|
|
|
- },
|
|
|
- child: MyTextView(
|
|
|
- "Cancel",
|
|
|
- fontSize: 17.5,
|
|
|
- isFontMedium: true,
|
|
|
- textAlign: TextAlign.center,
|
|
|
- textColor: Color(0XFF0085C4),
|
|
|
- cornerRadius: 3,
|
|
|
- borderWidth: 1,
|
|
|
- ),
|
|
|
- )),
|
|
|
- Container(
|
|
|
- color: Color(0xff09141F).withOpacity(0.13),
|
|
|
- width: 0.5,
|
|
|
+ const SizedBox(width: 18),
|
|
|
+ Visibility(
|
|
|
+ visible: isShowCancelBtn,
|
|
|
+ child: Expanded(
|
|
|
+ flex: 1,
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ onCancel();
|
|
|
+ cancelAction?.call();
|
|
|
+ },
|
|
|
+ child: MyTextView(
|
|
|
+ cancelTxt ?? S.current.no,
|
|
|
+ fontSize: 16,
|
|
|
+ isFontMedium: true,
|
|
|
+ paddingTop: 13,
|
|
|
+ marginRight: 15,
|
|
|
+ paddingBottom: 13,
|
|
|
+ textAlign: TextAlign.center,
|
|
|
+ textColor: Colors.white,
|
|
|
+ backgroundColor: context.appColors.orangeBG,
|
|
|
+ cornerRadius: 7,
|
|
|
+ ),
|
|
|
+ )),
|
|
|
),
|
|
|
Expanded(
|
|
|
flex: 1,
|
|
@@ -104,22 +134,25 @@ class AppDefaultDialog extends StatelessWidget {
|
|
|
confirmAction();
|
|
|
},
|
|
|
child: MyTextView(
|
|
|
- "Confirm",
|
|
|
- marginLeft: 10,
|
|
|
- fontSize: 17.5,
|
|
|
+ confirmTxt ?? S.current.yes,
|
|
|
+ fontSize: 16,
|
|
|
+ paddingTop: 13,
|
|
|
+ paddingBottom: 13,
|
|
|
isFontMedium: true,
|
|
|
textAlign: TextAlign.center,
|
|
|
- textColor: Color(0XFF0085C4),
|
|
|
- cornerRadius: 3,
|
|
|
+ textColor: Colors.white,
|
|
|
+ backgroundColor: context.appColors.btnBgDefault,
|
|
|
+ cornerRadius: 7,
|
|
|
),
|
|
|
)),
|
|
|
+ const SizedBox(width: 18),
|
|
|
],
|
|
|
- ).constrained(height: 46),
|
|
|
+ ).marginOnly(bottom: 30, top: 28),
|
|
|
],
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
- ).constrained(width: 295);
|
|
|
+ ).constrained(width: 300);
|
|
|
}
|
|
|
|
|
|
//取消弹框
|