app_default_dialog.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  3. import 'package:get/get.dart';
  4. import 'package:cs_resources/generated/assets.dart';
  5. import 'package:widgets/ext/ex_widget.dart';
  6. import 'package:cs_resources/constants/color_constants.dart';
  7. import '../my_load_image.dart';
  8. import '../my_text_view.dart';
  9. import '../no_shadow_scroll_behavior.dart';
  10. import '../utils/dark_theme_util.dart';
  11. import 'dart:typed_data';
  12. import 'dart:ui';
  13. import 'package:flutter/cupertino.dart';
  14. import 'package:flutter/material.dart';
  15. import 'package:flutter/widgets.dart';
  16. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  17. import 'package:get/get.dart';
  18. import 'package:widgets/ext/ex_widget.dart';
  19. import 'package:cs_resources/constants/color_constants.dart';
  20. import 'package:widgets/my_text_view.dart';
  21. import 'package:widgets/widget_export.dart';
  22. /**
  23. * 签到签出的签名弹窗
  24. */
  25. class AppDefaultDialog extends StatelessWidget {
  26. String title;
  27. String message;
  28. VoidCallback confirmAction;
  29. VoidCallback? cancelAction;
  30. AppDefaultDialog({
  31. required this.title,
  32. required this.message,
  33. required this.confirmAction,
  34. this.cancelAction,
  35. });
  36. @override
  37. Widget build(BuildContext context) {
  38. //使用一个 Column 为最外层容器,可以方便的视线 wrap_content 的效果
  39. return Column(
  40. crossAxisAlignment: CrossAxisAlignment.center,
  41. mainAxisAlignment: MainAxisAlignment.center,
  42. children: [
  43. //Title (如果使用 Container 为最外层容器则默认为 match_parent 的效果,除非我们限制宽度和最大高度最小高度)
  44. Container(
  45. width: double.infinity,
  46. decoration: BoxDecoration(
  47. color: Colors.white,
  48. borderRadius: const BorderRadius.all(Radius.circular(15)),
  49. ),
  50. child: Column(
  51. children: [
  52. MyTextView(
  53. title,
  54. fontSize: 19,
  55. isFontMedium: true,
  56. textColor: ColorConstants.black,
  57. marginTop: 15,
  58. marginBottom: 15,
  59. ),
  60. Scrollbar(
  61. child: ScrollConfiguration(
  62. behavior: NoShadowScrollBehavior(),
  63. child: SingleChildScrollView(
  64. child: MyTextView(
  65. message,
  66. fontSize: 16,
  67. textColor: Colors.black,
  68. isFontRegular: true,
  69. textAlign: TextAlign.center,
  70. paddingLeft: 30,
  71. paddingRight: 30,
  72. ),
  73. ),
  74. ),
  75. ).constrained(maxHeight: 210),
  76. Container(
  77. margin: EdgeInsets.only(top: 25),
  78. color: Color(0XFFCECECE),
  79. height: 0.5,
  80. ),
  81. Row(
  82. children: [
  83. Expanded(
  84. flex: 1,
  85. child: InkWell(
  86. onTap: () {
  87. onCancel();
  88. cancelAction?.call();
  89. },
  90. child: MyTextView(
  91. "Cancel".tr,
  92. fontSize: 17.5,
  93. isFontMedium: true,
  94. textAlign: TextAlign.center,
  95. textColor: Color(0XFF0085C4),
  96. cornerRadius: 3,
  97. borderWidth: 1,
  98. ),
  99. )),
  100. Container(
  101. color: Color(0xff09141F).withOpacity(0.13),
  102. width: 0.5,
  103. ),
  104. Expanded(
  105. flex: 1,
  106. child: InkWell(
  107. onTap: () async {
  108. onCancel();
  109. confirmAction();
  110. },
  111. child: MyTextView(
  112. "Confirm".tr,
  113. marginLeft: 10,
  114. fontSize: 17.5,
  115. isFontMedium: true,
  116. textAlign: TextAlign.center,
  117. textColor: Color(0XFF0085C4),
  118. cornerRadius: 3,
  119. ),
  120. )),
  121. ],
  122. ).constrained(height: 46),
  123. ],
  124. ),
  125. ),
  126. ],
  127. ).constrained(width: 295);
  128. }
  129. //取消弹框
  130. void onCancel() async {
  131. SmartDialog.dismiss();
  132. }
  133. }