app_default_dialog.dart 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  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. // return Container(
  129. // width: 283,
  130. // decoration: BoxDecoration(
  131. // color: Colors.white, // 设置背景颜色
  132. // borderRadius: BorderRadius.circular(15), // 设置圆角
  133. // ),
  134. // child: Column(
  135. // children: [
  136. // MyTextView(
  137. // title,
  138. // fontSize: 19,
  139. // isFontMedium: true,
  140. // textColor: ColorConstants.black,
  141. // marginTop: 15,
  142. // marginBottom: 12,
  143. // ),
  144. //
  145. // ScrollConfiguration(
  146. // behavior: NoShadowScrollBehavior(),
  147. // child: SingleChildScrollView(
  148. // child: MyTextView(
  149. // message,
  150. // fontSize: 15,
  151. // textColor: Colors.black,
  152. // isFontMedium: true,
  153. // textAlign: TextAlign.center,
  154. // paddingLeft: 30,
  155. // paddingRight: 30,
  156. // paddingBottom: 20,
  157. // marginTop: 20,
  158. // marginBottom: 25,
  159. // ),
  160. // )).marginSymmetric(vertical: 10).constrained(maxHeight: 400),
  161. //
  162. // Container(
  163. // color: Color(0XFFCECECE),
  164. // height: 0.5,
  165. // ),
  166. //
  167. // //Buttons
  168. // Row(
  169. // children: [
  170. // Expanded(
  171. // flex: 1,
  172. // child: InkWell(
  173. // onTap: () {
  174. // onCancel();
  175. // cancelAction?.call();
  176. // },
  177. // child: MyTextView(
  178. // "Cancel".tr,
  179. // fontSize: 17.5,
  180. // isFontMedium: true,
  181. // textAlign: TextAlign.center,
  182. // textColor: Color(0XFF0085C4),
  183. // cornerRadius: 3,
  184. // borderWidth: 1,
  185. // ),
  186. // )),
  187. // Container(
  188. // color: Color(0XFFCECECE),
  189. // width: 0.5,
  190. // ),
  191. // Expanded(
  192. // flex: 1,
  193. // child: InkWell(
  194. // onTap: () async {
  195. // onCancel();
  196. // confirmAction();
  197. // },
  198. // child: MyTextView(
  199. // "Confirm".tr,
  200. // marginLeft: 10,
  201. // fontSize: 17.5,
  202. // isFontMedium: true,
  203. // textAlign: TextAlign.center,
  204. // textColor: Color(0XFF0085C4),
  205. // cornerRadius: 3,
  206. // ),
  207. // )),
  208. // ],
  209. // ).expanded(),
  210. // ],
  211. // ),
  212. // ).constrained(maxHeight: 295);
  213. }
  214. //取消弹框
  215. void onCancel() async {
  216. SmartDialog.dismiss();
  217. }
  218. }