import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/item_input_widget.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/round_button.dart'; class RechargePage extends StatefulWidget { @override State createState() { return _RechargePage(); } } class _RechargePage extends State { TextEditingController controller; Color color = Colors.black; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text( S.of(context).chongzhi, style: TextStyle( color: Colors.black, fontWeight: FontWeight.bold, fontSize: 18, ), ), centerTitle: false, backgroundColor: Color(0xFFFFFFFF), elevation: 0, leading: GestureDetector( onTap: () { Navigator.of(context).pop(); }, child: Container( alignment: Alignment.centerRight, margin: EdgeInsets.only(left: 10), padding: EdgeInsets.all(6), child: Icon( Icons.arrow_back_ios, color: Colors.black, size: 24, ), ), ), titleSpacing: 2, leadingWidth: 56, ), body: SingleChildScrollView( physics: BouncingScrollPhysics(), child: Container( child: Column( children: [ ItemInputWidget( S.of(context).qingshuruchongzhijine, hintText: "", controller: controller, inputType: 1, padding: EdgeInsets.all(20), heightPercentage: 0.16.sh, errorText: S.of(context).chongzhizuixiaojine(10), titleColor: Color(0xFF727272), errorTextColor: Color(0xFF32A060), radius: 8, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 30.sp, color: color), inputLimit: 16, textInputType: TextInputType.number, onChanged: (value) { if (value != null && value != "" && double.tryParse(value) < 10) { color = Colors.red; } else { color = Colors.black; } setState(() {}); }, ), Container( width: double.infinity, height: 0.171.sh, margin: EdgeInsets.only(left: 20, right: 20, top: 12, bottom: 4), padding: EdgeInsets.only(left: 20, right: 16, top: 20, bottom: 20), decoration: BoxDecoration( boxShadow: [ BoxShadow( color: Color(0x000000).withAlpha(25), offset: Offset(0, 1), blurRadius: 12.0, ), ], color: Colors.white, borderRadius: BorderRadius.all( Radius.circular(4), ), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only(bottom: 16), child: Text( S.of(context).zhifufangshi, style: TextStyle( fontSize: 16, color: color, fontWeight: FontWeight.bold, ), ), ), Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset("assets/image/icon_alipay.png"), Expanded( flex: 1, child: Padding( padding: EdgeInsets.only(left: 8, bottom: 20), child: Text(S.of(context).zhifubao, style: TextStyle( fontSize: 14, color: Color(0xff353535), )), ), ), checkView(0), ], ), Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Image.asset("assets/image/icon_we_chat.png"), Expanded( flex: 1, child: Padding( padding: EdgeInsets.only(left: 8), child: Text(S.of(context).weixinzhifu, style: TextStyle( fontSize: 14, color: Color(0xff353535), )), ), ), checkView(1), ], ) ], ), ), Container( margin: EdgeInsets.only(left: 20, right: 20, top: 26), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, children: [ RoundButton( width: double.infinity, height: 46, text:S.of(context).querenchongzhi, textColor: Colors.white, fontSize: 14, backgroup: Color(0xff32A060), fontWeight: FontWeight.bold, ), ], ), ), ], ), ), ), ); } var checkIndex = 0; Widget checkView(var index) { return GestureDetector( onTap: () { setState(() { checkIndex = index; }); }, child: Container( padding: EdgeInsets.only(right: 16), alignment: Alignment.center, child: Image.asset( checkIndex != index ? "assets/image/icon_radio_unselected.png" : "assets/image/icon_radio_selected.png", width: 15, height: 15, )), ); } }