From 7683f2f7c104a368184a85c1b7d4a96188648937 Mon Sep 17 00:00:00 2001 From: datang Date: Wed, 7 Sep 2022 13:46:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=93=E9=AA=8C=E5=8D=A1=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/widget/appdialog.dart | 192 ++++++++++++++--------------------- 1 file changed, 79 insertions(+), 113 deletions(-) diff --git a/lib/ui/widget/appdialog.dart b/lib/ui/widget/appdialog.dart index 888ad2b..0f1aca8 100644 --- a/lib/ui/widget/appdialog.dart +++ b/lib/ui/widget/appdialog.dart @@ -8,119 +8,86 @@ import '../../utils/toast/cloud_toast.dart'; class AppDialog extends Dialog { final String title; final String confirm; //按钮文字 - // final String content; //内容 - // final bool? showCancel; - // final OnDialogClickListener? clickListener; - const AppDialog( // this.showCancel, - // this.clickListener, - { + const AppDialog({ Key? key, this.title = "恭喜您获得会员体验卡", this.confirm = "立即领取", - // this.content = "内容", }) : super(key: key); @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 95.w,vertical: 452.w), - decoration: BoxDecoration( - image: - DecorationImage(image: AssetImage(Assets.images.bouncedbg.path))), - child: Column( - children: [ - 32.hb, - Text( - title, - style: TextStyle( - fontSize: 36.sp, + return Center( + child: Container( + margin: EdgeInsets.only( + left: 100.w, + right: 100.w, + ), + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage( + Assets.images.bouncedbg.path, ), ), - 80.hb, - _getVip(), - 218.hb, - Row( - children: [ - 72.wb, - _getText("接听发送"), - 64.wb, - _getText("拒接发送"), - 64.wb, - _getText("提升形象"), - ], - ), - 50.hb, - _getBotton(confirm, context), - ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + title, + style: TextStyle( + fontSize: 36.sp, + ), + ), + 60.hb, + _getVip(), + 200.hb, + Row( + children: [ + 72.wb, + _getText("接听发送"), + 64.wb, + _getText("拒接发送"), + 64.wb, + _getText("提升形象"), + ], + ), + 50.hb, + _getBotton(confirm, context), + ], + ), ), ); -/**/ - // - // Stack( - // children: [ - // Align( - // child: Image.asset( - // Assets.images.bouncedbg.path, - // width: 560.w, - // height: 720.w, - // fit: BoxFit.fill, - // ), - // ), - // Positioned( - // top: 64.w, - // left: 100.w, - // child: Text( - // title, - // style: TextStyle( - // fontSize: 36.sp, - // ), - // )), - // Positioned(top: 108.w, left: 96.w, child: _getVip()), - // Positioned( - // child: Row( - // children: [ - // _getText("接听发送"), - // 64.wb, - // _getText("拒接发送"), - // 64.wb, - // _getText("提升形象"), - // ], - // )), - // Positioned(child: _getBotton(confirm, context)), - // ], - // ); } } _getBotton(String bContent, context) { return GestureDetector( - onTap: () async{ - var res=await apiClient.request(API.app.trialVip); - if(res.code==0){ - // showDialog(context: context, builder: (context){ - // return const AppDialog(); - // }); + onTap: () async { + var res = await apiClient.request(API.app.trialVip); + if (res.code == 0) { CloudToast.show(res.msg); - // BoxShadow.show(res.msg); - } else{ + } else { CloudToast.show(res.msg); Navigator.pop(context); } }, child: Container( margin: EdgeInsets.symmetric(horizontal: 64.w), - padding: EdgeInsets.symmetric(horizontal: 155.w,vertical: 28.w), + width: 500.w, height: 88.w, + alignment: Alignment.center, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.w), - gradient: const LinearGradient( - colors: [Color(0xFFFFEAB0), Color(0xFFFFF6D8)], - end: Alignment.centerLeft, - begin: Alignment.centerRight)), + borderRadius: BorderRadius.circular(12.w), + gradient: const LinearGradient( + colors: [Color(0xFFFFEAB0), Color(0xFFFFF6D8)], + end: Alignment.centerLeft, + begin: Alignment.centerRight, + ), + ), child: Text( bContent, - style: TextStyle(fontSize: 28.sp,fontWeight:FontWeight.bold), + style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.bold), ), ), ); @@ -136,42 +103,47 @@ _getText(String content) { _getVip() { return SizedBox( width: 370.w, - height: 100.w, + height: 110.w, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Text.rich(TextSpan(children: [ + Text.rich( TextSpan( - text: "03", - style: TextStyle( + children: [ + TextSpan( + text: "03", + style: TextStyle( + color: const Color(0xFFFFEAB0), + fontSize: 56.sp, + fontFamily: "BlackItalic", + fontWeight: FontWeight.bold)), + TextSpan( + text: "天", + style: TextStyle( color: const Color(0xFFFFEAB0), - fontSize: 56.sp, - fontFamily: "BlackItalic", - fontWeight: FontWeight.bold)), - TextSpan( - text: "天", - style: TextStyle( - color: const Color(0xFFFFEAB0), - fontSize: 24.sp, - // height: 1.0, - )) - ])), + fontSize: 24.sp, + ), + ), + ], + ), + ), const Spacer(), Column( children: [ Text( "VIP", style: TextStyle( - color: const Color(0xFFE7F3FF), - fontSize: 32.sp, - fontFamily: "BlackItalic", - fontWeight: FontWeight.bold), - ) + color: const Color(0xFFE7F3FF), + fontSize: 32.sp, + fontFamily: "BlackItalic", + fontWeight: FontWeight.bold, + ), + ), ], - ) + ), ], ), Text( @@ -180,14 +152,8 @@ _getVip() { color: const Color(0xFFFFEAB0), fontSize: 24.sp, ), - ) + ), ], ), ); } - -// abstract class OnDialogClickListener { -// void onConfirm(); -// -// void onCancel(); -// }