import 'package:flutter/material.dart'; import 'package:project_telephony/utils/headers.dart'; import '../../constants/api.dart'; import '../../model/network/api_client.dart'; import '../../utils/toast/cloud_toast.dart'; class AppDialog extends Dialog { final String title; final String confirm; //按钮文字 const AppDialog({ Key? key, this.title = "恭喜您获得会员体验卡", this.confirm = "立即领取", }) : super(key: key); @override Widget build(BuildContext context) { return Center( child: Container( margin: EdgeInsets.only( left: 100.w, right: 100.w, ), decoration: BoxDecoration( image: DecorationImage( image: AssetImage( Assets.images.bouncedbg.path, ), ), ), 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), ], ), ), ); } } _getBotton(String bContent, context) { return GestureDetector( onTap: () async { var res = await apiClient.request(API.app.trialVip); if (res.code == 0) { CloudToast.show(res.msg); } else { CloudToast.show(res.msg); Navigator.pop(context); } }, child: Container( margin: EdgeInsets.symmetric(horizontal: 64.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, ), ), child: Text( bContent, style: TextStyle(fontSize: 28.sp, fontWeight: FontWeight.bold), ), ), ); } _getText(String content) { return Text( content, style: TextStyle(color: const Color(0xFF1890FF), fontSize: 24.w), ); } _getVip() { return SizedBox( width: 370.w, height: 110.w, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Text.rich( TextSpan( 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: 24.sp, ), ), ], ), ), const Spacer(), Column( children: [ Text( "VIP", style: TextStyle( color: const Color(0xFFE7F3FF), fontSize: 32.sp, fontFamily: "BlackItalic", fontWeight: FontWeight.bold, ), ), ], ), ], ), Text( "短信帮手会员体验卡", style: TextStyle( color: const Color(0xFFFFEAB0), fontSize: 24.sp, ), ), ], ), ); }