import 'dart:ui'; import 'package:flutter/Material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get.dart'; import '../../../data/consts/event_report.dart'; import '../../../handler/event_handler.dart'; import '../../../resource/assets.gen.dart'; import '../../../resource/colors.gen.dart'; import '../suprise/goods_surprise_controller.dart'; class NewDiscountTicketDialog { static const String tag = 'NewDiscountTicketDialog'; static void show({VoidCallback? clickConfirm, VoidCallback? clickCancel}) { EventHandler.report(EventId.event_02006); if (SmartDialog.checkExist(tag: tag)) return; SmartDialog.show( tag: tag, keepSingle: true, backType: SmartBackType.block, clickMaskDismiss: false, maskColor: ColorName.black70, onDismiss: () => Get.delete(), animationType: SmartAnimationType.centerScale_otherSlide, builder: (_) { final controller = Get.find(); return Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ SizedBox(height: 50.h), Stack( clipBehavior: Clip.none, children: [ Container( width: 360.w, height: 567.h, decoration: BoxDecoration( image: DecorationImage( image: Assets.images.bgNewDiscountTicket.provider(), fit: BoxFit.contain, ), ), child: Column( children: [ SizedBox(height: 305.h), Container( width: 240.w, height: 119.h, decoration: BoxDecoration( image: DecorationImage( image: Assets.images.bgNewDiscountTicketContent .provider(), fit: BoxFit.contain, ), ), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: 3.h), Obx(() { return Container( padding: EdgeInsets.symmetric( horizontal: 10.w, vertical: 2.h, ), decoration: BoxDecoration( color: Color(0xFFFFE1D9), borderRadius: BorderRadius.only( bottomLeft: Radius.circular(10.r), bottomRight: Radius.circular(10.r), ), ), child: Text( controller.secondAmount?.name ?? '', style: TextStyle( color: const Color(0xFFFF2F79), fontSize: 13.sp, fontWeight: FontWeight.w500, ), ), ); }), SizedBox(height: 10.h,), Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end, children: [ Stack( clipBehavior: Clip.none, children: [ Obx(() { return Text( controller.secondAmount?.amountText ?? "", style: TextStyle( color: const Color(0xFFFF005A), fontSize: 42.sp, fontWeight: FontWeight.w900, height: 0, ), ); }), Positioned( bottom: 5.h, right: -12.w, child: _unit(), ), ], ), ], ), Obx(() { return Text( controller.secondAmount?.description ?? "", style: TextStyle( color: const Color(0xFFEA8AAC), fontSize: 12.sp, fontWeight: FontWeight.w400, ), ); }), ], ), ), SizedBox(height: 18.h), GestureDetector( onTap: () { EventHandler.report(EventId.event_02010); clickConfirm?.call(); SmartDialog.dismiss(tag: tag); }, child: SizedBox( width: 240.w, height: 60.h, child: SizedBox( child: Assets.images.iconNewDiscountTicketButton .image( width: 260.w, height: 50.h, fit: BoxFit.contain, ), ), ), ), ], ), ), Positioned( right: 25.w, bottom: 20.h, child: IgnorePointer( child: Assets.images.iconNewSurpriseDialogHand.image( width: 78.w, height: 79.h, ), ), ), ], ), Transform.translate( offset: Offset(0, -20.h), child: GestureDetector( onTap: () { EventHandler.report(EventId.event_02011); SmartDialog.dismiss(tag: tag); clickCancel?.call(); }, child: Assets.images.iconNewSurpriseDialogClose.image( width: 40.r, height: 40.r, ), ), ), ], ); }, ); } static Widget _unit() { return Container( width: 20.w, height: 20.w, decoration: ShapeDecoration( color: const Color(0xFFFF005A), shape: OvalBorder( side: BorderSide( width: 2.w, strokeAlign: BorderSide.strokeAlignCenter, color: Colors.white, ), ), ), child: Center( child: Text( '元', style: TextStyle( color: Colors.white, fontSize: 12.sp, fontWeight: FontWeight.w700, height: 1.67, ), ), ), ); } }