Flutter高仿微信系列共59篇,从Flutter客户端、Kotlin客户端、Web服务器、数据库表结构、Xmpp即时通讯服务器、视频通话服务器、腾讯云服务器全面讲解。
详情请查看
效果图:
实现代码:
/** * Author : wangning * Email : maoning20080809@163.com * Date : 2022/10/25 23:26 * Description : 我的零钱 */ class SmallChange extends StatefulWidget { @override State<StatefulWidget> createState() => _SmallChangeState(); } class _SmallChangeState extends State<SmallChange> { UserBean? _userBean; @override void initState() { super.initState(); _initUser(); } void _initUser() async { String account = SpUtils.getAccount(); _userBean = await UserRepository.getInstance().findUserByAccount(account); setState(() { }); } @override Widget build(BuildContext context) { return Scaffold( appBar: WnAppBar.getAppBar(context, const Text("我的零钱")), body: Container( alignment: AlignmentDirectional.center, child: Column( children: [ SizedBox(height: 40,), CommonUtils.getBaseIconPng("wc_small_change_icon", width: 80, height: 80), SizedBox(height: 30,), Text("我的零钱", style: TextStyle(fontSize: 20),), SizedBox(height: 12,), Text("¥${_userBean?.balance??'0'}", style: TextStyle(fontSize: 26, fontWeight: FontWeight.bold),), Expanded(child: Text("")), ElevatedButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.green), shape: MaterialStateProperty.all( RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)) ), ), onPressed: (){ Navigator.push(context, MaterialPageRoute(builder: (context) => RechangeWidget())); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(30)), ), alignment: AlignmentDirectional.center, width: 200, height: 60, child: Text("充值", style: TextStyle(fontSize: 22),), ) ), SizedBox(height: 12,), ElevatedButton( style: ButtonStyle( backgroundColor: MaterialStateProperty.all(Colors.white70), shape: MaterialStateProperty.all( RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)) ), ), onPressed: (){ CommonToast.show(context, "暂未开发提现功能!"); }, child: Container( decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(30)), ), alignment: AlignmentDirectional.center, width: 200, height: 60, child: Text("提现", style: TextStyle(fontSize: 22, color: Colors.green),), ) ), SizedBox(height: 30,), ], ), ), ); } }