import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_alipay/flutter_alipay.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:fluwx/fluwx.dart' as fluwx; import 'package:liftmanager/internal/bbs/bbs_router.dart'; import 'package:liftmanager/internal/search/presenter/base_list_provider.dart'; import 'package:liftmanager/internal/wode/model/wallet_model.dart'; import 'package:liftmanager/internal/wode/page/wallet/wallet_detail_page.dart'; import 'package:liftmanager/internal/wode/presenter/wallet_list_presenter.dart'; import 'package:liftmanager/internal/wode/wode_router.dart'; import 'package:liftmanager/mvp/base_page_state.dart'; import 'package:liftmanager/net/api_service.dart'; import 'package:liftmanager/res/resources.dart'; import 'package:liftmanager/routers/fluro_navigator.dart'; import 'package:liftmanager/utils/fast_notification.dart'; import 'package:liftmanager/utils/theme_utils.dart'; import 'package:liftmanager/utils/time_format.dart'; import 'package:liftmanager/utils/toast.dart'; import 'package:liftmanager/widgets/app_bar.dart'; import 'package:liftmanager/widgets/bbs_content.dart'; import 'package:liftmanager/widgets/load_image.dart'; import 'package:liftmanager/widgets/my_card.dart'; import 'package:liftmanager/widgets/my_refresh_list.dart'; import 'package:liftmanager/widgets/state_layout.dart'; import 'package:provider/provider.dart'; class WalletPage extends StatefulWidget { @override WalletPageState createState() => WalletPageState(); } class WalletPageState extends BasePageState with AutomaticKeepAliveClientMixin { BaseListProvider provider = BaseListProvider(); int _page = 1; @override void initState() { provider.setStateTypeNotNotify(StateType.loading); super.initState(); setSchema(); _initFluwx(); getCoupon(); _onRefresh(); } _initFluwx() async { await fluwx.registerWxApi( appId: "wx0f10e6386fb9969e", doOnAndroid: true, doOnIOS: true, universalLink: "https://www.edtyun.com/"); var result = await fluwx.isWeChatInstalled(); setState(() {}); } void setSchema() async { // await FlutterAlipay.setIosUrlSchema("tytylift"); await FlutterAlipay.setIosUrlSchema("com.tyty.lift.managers"); } getBusinessType(int type) { String str; if (type == 1) { str = "充值会员"; } else if (type == 2) { str = "打赏"; } else if (type == 3) { str = "充值"; } else if (type == 4) { str = "诊单业务"; } else if (type == 5) { str = "提现"; } else if (type == 6) { str = "提现失败退款"; } else if (type == 7) { str = "余额消费"; } else if (type == 8) { str = "拒绝接单退款"; } else if (type == 9) { str = "专家惩罚"; } else if (type == 10) { str = "申诉退款"; } else if (type == 11) { str = "粉丝充值返利"; } else if (type == 12) { str = "现金支付"; } else if (type == 13) { str = "差旅费"; } return str; } Map detailOj = { "couponNum": 0, "balance": 0.0, "freezeBalance": 0.0, "hongBaoNum": 0 }; Future getCoupon() async { await NewApiService().getUserCoupons(onSuccess: (res) { if (res != null) { detailOj["couponNum"] = res["couponNum"]; detailOj["balance"] = res["balance"]; detailOj["freezeBalance"] = res["freezeBalance"]; detailOj["hongBaoNum"] = res["hongBaoNum"]; setState(() {}); print(6666544); } }, onError: (code, msg) { toasts(msg); }); } @override void dispose() { provider.dispose(); super.dispose(); } // 确认充值 void recharge(provider, money) async { int payType; if (provider == 'alipay') { payType = 1; await NewApiService().createRecharge( payType: payType, productPrice: money, productName: "用户充值", memo: "用户充值", onSuccess: (res) { getAlipayOrderInfo(res); }, onError: (code, msg) { toasts(msg); }); } else if (provider == 'weixin') { payType = 2; await NewApiService().createRecharge( payType: payType, productPrice: money, productName: "用户充值", memo: "用户充值", onSuccess: (res) { getAlipayOrderInfowx(res); }, onError: (code, msg) { toasts(msg); }); } } // 确认提现 void ticharge(provider, money) async { int payType; if (provider == 'alipay') { payType = 1; await NewApiService().getInsetWithdrwa( type: payType, amount: money, onSuccess: (res) { toasts(res); getCoupon(); _onRefresh(); String initThisUserMoney = randomInt(1111, 9999).toString() + DateTime.now().millisecondsSinceEpoch.toString(); FastNotification.push("initUserMoney", initThisUserMoney); Navigator.pop(context); }, onError: (code, msg) { toasts(msg); if (code == 400) { NavigatorUtils.push(context, WodeRouter.bandAccount); } }); } else if (provider == 'weixin') { payType = 2; toasts("暂未开通"); } else { toasts("暂未开通"); return; } } // 根据orderNo获取支付宝订单信息 Future getAlipayOrderInfo(ordersNo) async { await NewApiService().alipayRecharge( payway: 'alipay', orders: ordersNo, onSuccess: (res) { callAlipay(res); }, onError: (code, msg) { toasts(msg); }); } // 根据orderNo获取wx订单信息 Future getAlipayOrderInfowx(ordersNo) async { await NewApiService().alipayRechargewx( payway: 'wx', orders: ordersNo, onSuccess: (res) { wxMethod(res); }, onError: (code, msg) { toasts(msg); }); } dynamic _wxPay; wxMethod(_payInfo) { print(_payInfo["appid"]); fluwx .payWithWeChat( appId: _payInfo["appid"], partnerId: _payInfo["partnerid"], prepayId: _payInfo["prepayid"], packageValue: _payInfo["package"], nonceStr: _payInfo["noncestr"], timeStamp: int.parse(_payInfo["timestamp"]), sign: _payInfo["sign"]) .then((data) { print(data); }); _wxPay?.cancel(); _wxPay = fluwx.responseFromPayment .listen((fluwx.WeChatPaymentResponse response) async { print("WeChatPaymentResponse" + response.errCode.toString()); if (response.errCode == -2) { //支付取消 toasts("支付取消"); } else if (response.errCode == -1) { //支付失败 toasts("支付失败"); } else if (response.errCode == 0) { //支付成功 toasts("充值成功"); getCoupon(); _onRefresh(); String initThisUserMoney = randomInt(1111, 9999).toString() + DateTime.now().millisecondsSinceEpoch.toString(); FastNotification.push("initUserMoney", initThisUserMoney); setState(() {}); Navigator.pop(context); } }); } // 调用支付宝 void callAlipay(String _payInfo) async { AlipayResult payResult; try { print("The pay info is : " + _payInfo); payResult = await FlutterAlipay.pay(_payInfo); } on Exception catch (e) { payResult = null; } print(payResult); if (payResult != null) { if (payResult.resultStatus == "9000") { toasts("充值成功"); getCoupon(); _onRefresh(); String initThisUserMoney = randomInt(1111, 9999).toString() + DateTime.now().millisecondsSinceEpoch.toString(); FastNotification.push("initUserMoney", initThisUserMoney); setState(() {}); Navigator.pop(context); } else { toasts(payResult.memo); } } else { toasts("支付异常"); } } randomInt(int min, int max) { return new Random().nextInt(max) % (max - min + 1) + min; } FocusNode blankNode = FocusNode(); @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return ChangeNotifierProvider>( create: (_) => provider, child: Scaffold( resizeToAvoidBottomPadding: true, appBar: MyAppBar( centerTitle: "我的钱包", isColorTopToBottom: true, bgColors: [Color(0xff02ABFF), Color(0xFF15A3FF)], titleColor: Colors.white, actions: [ FlatButton( child: Text("绑定账号"), textColor: Colours.dark_text, highlightColor: Colors.transparent, onPressed: () { NavigatorUtils.push(context, WodeRouter.bandAccount); }, ) ], ), body: GestureDetector( onTap: () { // 点击空白页面关闭键盘 FocusScope.of(context).requestFocus(blankNode); }, child: Container( // color: Color(0xFFF1F4FC), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( child: Column( children: [ Container( height: ScreenUtil().setWidth(180), child: Stack( children: [ GestureDetector( onTap: () { // NavigatorUtils.push(context, WodeRouter.personalPage); }, child: Container( height: ScreenUtil().setWidth(140), decoration: BoxDecoration( gradient: const LinearGradient( begin: Alignment.topCenter, end: Alignment.bottomCenter, colors: [ Color(0xFF15A3FF), Color(0xFF638EFF) ], ), ), padding: EdgeInsets.only( bottom: ScreenUtil().setWidth(25), top: ScreenUtil().setWidth(15)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( '可用余额', textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(13), color: Color(0xffffffff), ), ), SizedBox(height: 5), Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( padding: EdgeInsets.only(bottom: 2), child: Text( '¥', textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(11), color: Color(0xffffffff), ), ), ), Text( detailOj["balance"] != null ? detailOj["balance"] .toStringAsFixed(2) .toString() : "", textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(22), color: Color(0xffffffff), ), ), ], ) ], ), SizedBox( width: 0.5, ), Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ Text( '冻结余额', textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(13), color: Color(0xffffffff), ), ), SizedBox(height: 5), Row( // mainAxisAlignment: // MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( padding: EdgeInsets.only(bottom: 2), child: Text( '¥', textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(11), color: Color(0xffffffff), ), ), ), Text( detailOj["freezeBalance"] != null ? detailOj["freezeBalance"] .toStringAsFixed(2) .toString() : "", textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(22), color: Color(0xffffffff), ), ), ], ) ], ), ], )), ), Positioned( bottom: 10, right: 10, left: 10, child: MyCard( child: Container( height: 60, // margin: EdgeInsets.only(left: 10,right: 10,bottom: 0), // padding: EdgeInsets.only( // left: ScreenUtil().setWidth(25), // right: ScreenUtil().setWidth(25), // top: ScreenUtil().setWidth(10)), decoration: BoxDecoration( color: Colors.white, border: Border( top: BorderSide( width: 0.5, color: Colours.line), ), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ GestureDetector( child: Container( child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Icon( const IconData(0xe645, fontFamily: "Iconfont"), size: 20.0, color: Colours.blue_app_main), SizedBox(width: 8), Text( '提现', textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(15), color: Colours.blue_app_main, ), ), ], ), ), onTap: () { showModalBottomSheet( isScrollControlled: true, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(5.0)), ), context: context, builder: (BuildContext context) { return StatefulBuilder( builder: (context1, setBottomSheetState) { return MoneyDalog( title: "提现", confirm: (provider, money) { ticharge( provider, money); }, ); }, ); }, ); }, ), Container( width: 0.5, height: ScreenUtil().setWidth(20), color: Color(0xffEEEEEE), // color: Colors.red, ), GestureDetector( child: Container( child: Row( crossAxisAlignment: CrossAxisAlignment.center, children: [ Icon( const IconData(0xe667, fontFamily: "Iconfont"), size: 20.0, color: Colours.blue_app_main), SizedBox(width: 8), Text( '充值', textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil() .setSp(15), color: Colours .blue_app_main), ), ], ), ), onTap: () { showModalBottomSheet( isScrollControlled: true, shape: RoundedRectangleBorder( borderRadius: BorderRadius.all( Radius.circular(5.0)), ), context: context, builder: (BuildContext context) { return StatefulBuilder( builder: (context1, setBottomSheetState) { return MoneyDalog( title: "充值", confirm: (provider, money) { recharge( provider, money); }, ); }, ); }, ); }, ), ], ), ), )) ], ), ), LabelTitle( title: "零钱明细", titleStyle: TextStyle( fontSize: ScreenUtil().setSp(14), // fontWeight: FontWeight.bold, color: Colours.text), hasArrow: true, isMore: false, userTap: () { NavigatorUtils.push(context, WodeRouter.smallMoney); }, ), ], ), ), Expanded( flex: 1, child: Consumer>( builder: (_, provider, __) { return MyListView( key: Key('wallet_list'), itemCount: provider.list.length, stateType: provider.stateType, onRefresh: _onRefresh, loadMore: _loadMore, pageSize: 6, hasMore: provider.hasMore, itemBuilder: (_, index) { return Container( child: Column( children: [ // index == 0 // ? Container( // child: Column( // children: [ // Container( // decoration: BoxDecoration( // gradient: const LinearGradient( // colors: [ // Color(0xFF00D9FF), // Color(0xFF0287FF) // ], // ), // ), // height: ScreenUtil().setWidth(140), // child: Column( // children: [ // GestureDetector( // onTap: () { // // NavigatorUtils.push(context, WodeRouter.personalPage); // }, // child: Container( // padding: EdgeInsets.only( // bottom: ScreenUtil() // .setWidth(25), // top: ScreenUtil() // .setWidth(15)), // child: Column( // mainAxisAlignment: // MainAxisAlignment // .center, // crossAxisAlignment: // CrossAxisAlignment // .center, // children: [ // Text( // '余额', // textAlign: // TextAlign.center, // style: TextStyle( // fontSize: // ScreenUtil() // .setSp(16), // color: Color( // 0xffffffff), // ), // ), // SizedBox(height: 5), // Row( // mainAxisAlignment: // MainAxisAlignment // .center, // crossAxisAlignment: // CrossAxisAlignment // .center, // children: [ // Text( // '¥', // textAlign: // TextAlign // .center, // style: TextStyle( // fontSize: // ScreenUtil() // .setSp( // 14), // color: Color( // 0xffffffff), // ), // ), // Text( // detailOj[ // "balance"] // .toString(), // textAlign: // TextAlign // .center, // style: TextStyle( // fontSize: // ScreenUtil() // .setSp( // 22), // color: Color( // 0xffffffff), // ), // ), // ], // ) // ], // ), // ), // ), // Container( // padding: EdgeInsets.only( // left: ScreenUtil() // .setWidth(25), // right: ScreenUtil() // .setWidth(25), // top: ScreenUtil() // .setWidth(10)), // decoration: BoxDecoration( // border: Border( // top: BorderSide( // width: 0.5, // color: Colours.line), // ), // ), // child: Row( // mainAxisAlignment: // MainAxisAlignment // .spaceAround, // children: [ // GestureDetector( // child: Container( // child: Row( // crossAxisAlignment: // CrossAxisAlignment // .center, // children: [ // Icon( // IconData(0xe627, // fontFamily: // "Iconfont"), // size: 20.0, // color: Color // .fromRGBO( // 255, // 255, // 255, // 1), // ), // SizedBox( // width: 8), // Text( // '提现', // textAlign: // TextAlign // .left, // style: // TextStyle( // fontSize: // ScreenUtil() // .setSp( // 15), // color: Color( // 0xffffffff), // ), // ), // ], // ), // ), // onTap: () { // showModalBottomSheet( // isScrollControlled: // true, // shape: // RoundedRectangleBorder( // borderRadius: BorderRadius // .all(Radius // .circular( // 5.0)), // ), // context: context, // builder: // (BuildContext // context) { // return StatefulBuilder( // builder: (context1, // setBottomSheetState) { // return MoneyDalog( // title: "提现", // confirm: // (provider, // money) { // ticharge( // provider, // money); // }, // ); // }, // ); // }, // ); // }, // ), // Container( // width: 0.5, // height: ScreenUtil() // .setWidth(20), // color: Colors.white, // ), // GestureDetector( // child: Container( // child: Row( // crossAxisAlignment: // CrossAxisAlignment // .center, // children: [ // Icon( // IconData(0xe666, // fontFamily: // "Iconfont"), // size: 20.0, // color: Color // .fromRGBO( // 255, // 255, // 255, // 1), // ), // SizedBox( // width: 8), // Text( // '充值', // textAlign: // TextAlign // .left, // style: // TextStyle( // fontSize: // ScreenUtil() // .setSp( // 15), // color: Color( // 0xffffffff), // ), // ), // ], // ), // ), // onTap: () { // showModalBottomSheet( // isScrollControlled: // true, // shape: // RoundedRectangleBorder( // borderRadius: BorderRadius // .all(Radius // .circular( // 5.0)), // ), // context: context, // builder: // (BuildContext // context) { // return StatefulBuilder( // builder: (context1, // setBottomSheetState) { // return MoneyDalog( // title: "充值", // confirm: // (provider, // money) { // recharge( // provider, // money); // }, // ); // }, // ); // }, // ); // }, // ), // ], // ), // ), // ], // ), // ), // LabelTitle( // title: "零钱明细", // hasArrow: true, // isMore: false, // userTap: () { // NavigatorUtils.push(context, // WodeRouter.smallMoney); // }, // ), // ], // ), // ) // : Container(child: null), InkWell( child: Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(15)), decoration: BoxDecoration( border: Border( bottom: BorderSide( width: 0.5, color: Colours.line), ), color: ThemeUtils.getTabsBg(context), ), child: Column( children: [ Container( padding: EdgeInsets.only(bottom: 5), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( getBusinessType(provider .list[index].businessType), textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(16), ), ), Text( (provider.list[index].type == 1 ? "-" : "+") + (provider.list[index] .amount != null ? provider .list[index].amount .toString() : ""), textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(16), color: Colors.red, ), ), ], ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( provider.list[index].descr ?? "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(13), color: Color(0xff999999), ), ), Text( provider.list[index].createTime != null ? DateUtils.instance .getFormartData( timeSamp: provider .list[index] .createTime, format: "yyyy-MM-dd") : "", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(13), color: Color(0xff999999), ), ), ], ), ], ), ), onTap: () { // print(i); Navigator.of(context).push( MaterialPageRoute( builder: (context) => WalletDetailPage( provider.list[index], getBusinessType(provider .list[index] .businessType), // isLG: widget.isLG, // projectid: model.selectdProJect.id.toString(), ))); // NavigatorUtils.push(context,'${BbsRouter.positionDetail}?id=${provider.list[index].id}'); }, ) ], ), ); }, ); }, ), ) ], ), ), ), ), ); } Future _onRefresh() async { _page = 1; await presenter.getWalletList(_page); } Future _loadMore() async { _page++; await presenter.getWalletList(_page); } @override WalletListPresenter createPresenter() { return WalletListPresenter(); } bool get wantKeepAlive => true; } class MoneyDalog extends StatefulWidget { MoneyDalog({Key key, this.title, this.confirm}) : super(key: key); final String title; final Function(String, String) confirm; @override _MoneyDalogState createState() => _MoneyDalogState(); } class _MoneyDalogState extends State { @override initState() { super.initState(); } TextEditingController moneyController = new TextEditingController(); static const payType = [ {"icon": "tab_first/pay_winxin", "title": "微信", "value": "weixin"}, {"icon": "tab_first/pay_zhifubao", "title": "支付宝", "value": "alipay"}, // {"icon": "tab_first/pay_yue", "title": "账户余额支付", "value": "balance"}, ]; String checkFalse = "tab_first/check_false"; String checkTrue = "tab_first/check_true"; int selectIndex = -1; void changeType(index) { setState(() { selectIndex = index; }); } FocusNode blankNode = FocusNode(); @override Widget build(BuildContext context) { double width = MediaQuery.of(context).size.width; return GestureDetector( onTap: () { // 点击空白页面关闭键盘 FocusScope.of(context).requestFocus(blankNode); }, child: Container( child: Container( height: ScreenUtil().setWidth(330), child: Column( children: [ Container( // color: Colors.red, padding: EdgeInsets.only(bottom: 10), width: width, child: Stack( children: [ Container( width: width, padding: EdgeInsets.only(top: 10), child: Text( widget.title, textAlign: TextAlign.center, style: TextStyle( fontSize: ScreenUtil().setSp(17), ), ), ), Positioned( right: 5, top: 5, child: GestureDetector( onTap: () async { Navigator.pop(context); }, child: Icon( const IconData(0xe643, fontFamily: "Iconfont"), size: 22.0, color: Color.fromRGBO(200, 200, 200, 1), ), ), ) ], ), ), Container( height: ScreenUtil().setWidth(200), child: ListView( children: [ Container( // height:260, child: Column( children: [ Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15)), width: width, child: Text( widget.title + "金额", textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(16), ), ), ), SizedBox(height: 10), Container( // height: 30, padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), ), // color: Colors.yellow, child: TextField( keyboardType: TextInputType.number, controller: moneyController, // textInputAction: TextInputAction.go, // 输入框的确定按钮 // focusNode: focusNode1, decoration: InputDecoration( contentPadding: EdgeInsets.only( left: 10, right: 5, ), border: UnderlineInputBorder( borderSide: BorderSide( color: Colours.text_gray_c, width: 0.8), ), focusedBorder: UnderlineInputBorder( borderSide: BorderSide( color: Colours.text_gray_c, width: 0.8), ), labelText: '¥', labelStyle: TextStyle( fontSize: ScreenUtil().setSp(24), ), // 上标 hintText: '请输入', // hint 暗示 hasFloatingPlaceholder: false, // labelText是否漂浮 // errorText: '错误文本', errorBorder: InputBorder.none, // 当error时的border prefix: Text('¥'), prefixStyle: TextStyle( fontSize: ScreenUtil().setSp(24), color: Colors.black, ), filled: false, // 背景色 ), cursorColor: Color(0xFF999999), obscureText: false, // 输入变成** onChanged: (val) { // xxx }, ), ), Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), top: ScreenUtil().setWidth(10), ), width: width, child: Text( widget.title + '方式', textAlign: TextAlign.left, style: TextStyle( fontSize: ScreenUtil().setSp(16), ), ), ), Container( padding: EdgeInsets.only( left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15), ), child: Column( children: payType.asMap().keys.map((i) { return Container( decoration: BoxDecoration(), height: 40, child: Row( mainAxisAlignment: MainAxisAlignment.start, children: [ InkWell( child: Container( child: LoadAssetImage( selectIndex == i ? checkTrue : checkFalse, width: ScreenUtil().setWidth(20), height: ScreenUtil().setWidth(20), ), ), onTap: () { changeType(i); }, ), SizedBox( width: ScreenUtil().setWidth(20)), Row( children: [ LoadAssetImage( payType[i]["icon"], width: ScreenUtil().setWidth(20), height: ScreenUtil().setWidth(20), ), Container(width: 5, child: null), Text( widget.title == "充值" ? payType[i]["title"] + "支付" : "提现到" + payType[i]["title"], style: TextStyle( fontSize: ScreenUtil().setSp(14), ), textAlign: TextAlign.start, ), ], ), ], ), ); }).toList(), ), ) ], ), ) ], ), ), Container( width: width, padding: EdgeInsets.only( top: ScreenUtil().setWidth(15), bottom: ScreenUtil().setWidth(10), left: ScreenUtil().setWidth(25), right: ScreenUtil().setWidth(25), ), color: ThemeUtils.getTabsBg(context), child: Container( height: ScreenUtil().setWidth(40), decoration: BoxDecoration( color: Colours.blue_app_main, borderRadius: BorderRadius.circular(ScreenUtil().setWidth(22)), // gradient: const LinearGradient( // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)], // ), ), child: FlatButton( // padding: EdgeInsets.all(15.0), child: Text("确认"), textColor: Colors.white, onPressed: () async { RegExp exp = RegExp("[0-9]"); if (selectIndex == -1) { toasts("请选择"); } else { if (!exp.hasMatch(moneyController.text) || double.parse(moneyController.text) < 0) { toasts("请输入正确的金额"); } else { widget.confirm(payType[selectIndex]['value'], moneyController.text); } } }, ), ), ) ], ), ), ), ); } }