new_discount_ticket_dialog.dart 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. import 'dart:ui';
  2. import 'package:flutter/Material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
  5. import 'package:get/get.dart';
  6. import '../../../data/consts/event_report.dart';
  7. import '../../../handler/event_handler.dart';
  8. import '../../../resource/assets.gen.dart';
  9. import '../../../resource/colors.gen.dart';
  10. import '../suprise/goods_surprise_controller.dart';
  11. class NewDiscountTicketDialog {
  12. static const String tag = 'NewDiscountTicketDialog';
  13. static void show({VoidCallback? clickConfirm, VoidCallback? clickCancel}) {
  14. EventHandler.report(EventId.event_02006);
  15. if (SmartDialog.checkExist(tag: tag)) return;
  16. SmartDialog.show(
  17. tag: tag,
  18. keepSingle: true,
  19. backType: SmartBackType.block,
  20. clickMaskDismiss: false,
  21. maskColor: ColorName.black70,
  22. onDismiss: () => Get.delete<GoodsSurpriseController>(),
  23. animationType: SmartAnimationType.centerScale_otherSlide,
  24. builder: (_) {
  25. final controller = Get.find<GoodsSurpriseController>();
  26. return Column(
  27. crossAxisAlignment: CrossAxisAlignment.center,
  28. mainAxisAlignment: MainAxisAlignment.start,
  29. children: [
  30. SizedBox(height: 50.h),
  31. Stack(
  32. clipBehavior: Clip.none,
  33. children: [
  34. Container(
  35. width: 360.w,
  36. height: 567.h,
  37. decoration: BoxDecoration(
  38. image: DecorationImage(
  39. image: Assets.images.bgNewDiscountTicket.provider(),
  40. fit: BoxFit.contain,
  41. ),
  42. ),
  43. child: Column(
  44. children: [
  45. SizedBox(height: 305.h),
  46. Container(
  47. width: 240.w,
  48. height: 119.h,
  49. decoration: BoxDecoration(
  50. image: DecorationImage(
  51. image:
  52. Assets.images.bgNewDiscountTicketContent
  53. .provider(),
  54. fit: BoxFit.contain,
  55. ),
  56. ),
  57. child: Column(
  58. mainAxisAlignment: MainAxisAlignment.start,
  59. crossAxisAlignment: CrossAxisAlignment.center,
  60. children: [
  61. SizedBox(height: 3.h),
  62. Obx(() {
  63. return Container(
  64. padding: EdgeInsets.symmetric(
  65. horizontal: 10.w,
  66. vertical: 2.h,
  67. ),
  68. decoration: BoxDecoration(
  69. color: Color(0xFFFFE1D9),
  70. borderRadius: BorderRadius.only(
  71. bottomLeft: Radius.circular(10.r),
  72. bottomRight: Radius.circular(10.r),
  73. ),
  74. ),
  75. child: Text(
  76. controller.secondAmount?.name ?? '',
  77. style: TextStyle(
  78. color: const Color(0xFFFF2F79),
  79. fontSize: 13.sp,
  80. fontWeight: FontWeight.w500,
  81. ),
  82. ),
  83. );
  84. }),
  85. SizedBox(height: 10.h,),
  86. Row(
  87. mainAxisAlignment: MainAxisAlignment.center,
  88. crossAxisAlignment: CrossAxisAlignment.end,
  89. children: [
  90. Stack(
  91. clipBehavior: Clip.none,
  92. children: [
  93. Obx(() {
  94. return Text(
  95. controller.secondAmount?.amountText ??
  96. "",
  97. style: TextStyle(
  98. color: const Color(0xFFFF005A),
  99. fontSize: 42.sp,
  100. fontWeight: FontWeight.w900,
  101. height: 0,
  102. ),
  103. );
  104. }),
  105. Positioned(
  106. bottom: 5.h,
  107. right: -12.w,
  108. child: _unit(),
  109. ),
  110. ],
  111. ),
  112. ],
  113. ),
  114. Obx(() {
  115. return Text(
  116. controller.secondAmount?.description ?? "",
  117. style: TextStyle(
  118. color: const Color(0xFFEA8AAC),
  119. fontSize: 12.sp,
  120. fontWeight: FontWeight.w400,
  121. ),
  122. );
  123. }),
  124. ],
  125. ),
  126. ),
  127. SizedBox(height: 18.h),
  128. GestureDetector(
  129. onTap: () {
  130. EventHandler.report(EventId.event_02010);
  131. clickConfirm?.call();
  132. SmartDialog.dismiss(tag: tag);
  133. },
  134. child: SizedBox(
  135. width: 240.w,
  136. height: 60.h,
  137. child: SizedBox(
  138. child: Assets.images.iconNewDiscountTicketButton
  139. .image(
  140. width: 260.w,
  141. height: 50.h,
  142. fit: BoxFit.contain,
  143. ),
  144. ),
  145. ),
  146. ),
  147. ],
  148. ),
  149. ),
  150. Positioned(
  151. right: 25.w,
  152. bottom: 20.h,
  153. child: IgnorePointer(
  154. child: Assets.images.iconNewSurpriseDialogHand.image(
  155. width: 78.w,
  156. height: 79.h,
  157. ),
  158. ),
  159. ),
  160. ],
  161. ),
  162. Transform.translate(
  163. offset: Offset(0, -20.h),
  164. child: GestureDetector(
  165. onTap: () {
  166. EventHandler.report(EventId.event_02011);
  167. SmartDialog.dismiss(tag: tag);
  168. clickCancel?.call();
  169. },
  170. child: Assets.images.iconNewSurpriseDialogClose.image(
  171. width: 40.r,
  172. height: 40.r,
  173. ),
  174. ),
  175. ),
  176. ],
  177. );
  178. },
  179. );
  180. }
  181. static Widget _unit() {
  182. return Container(
  183. width: 20.w,
  184. height: 20.w,
  185. decoration: ShapeDecoration(
  186. color: const Color(0xFFFF005A),
  187. shape: OvalBorder(
  188. side: BorderSide(
  189. width: 2.w,
  190. strokeAlign: BorderSide.strokeAlignCenter,
  191. color: Colors.white,
  192. ),
  193. ),
  194. ),
  195. child: Center(
  196. child: Text(
  197. '元',
  198. style: TextStyle(
  199. color: Colors.white,
  200. fontSize: 12.sp,
  201. fontWeight: FontWeight.w700,
  202. height: 1.67,
  203. ),
  204. ),
  205. ),
  206. );
  207. }
  208. }