import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_wallet/tools/YSAlertView.dart'; import 'package:flutter_wallet/tools/YSBip.dart'; import 'package:flutter_wallet/tools/YSSqflite.dart'; import 'package:flutter_wallet/wallet/YSWalletExport.dart'; import 'package:flutter_wallet/wallet/view/YSWalletManagerListItemView.dart'; import '../base/YSBase.dart'; import '../generated/l10n.dart'; import '../login/view/YSHelpView.dart'; import '../tools/YSColors.dart'; import '../tools/YSTools.dart'; import 'YSWalletExportPrivate.dart'; import 'package:web3dart/web3dart.dart'; import 'package:wallet/wallet.dart' as ysWallet; class YSWalletDetail extends StatefulWidget { final Map wallet; const YSWalletDetail({Key? key, required this.wallet}) : super(key: key); @override YSWalletDetailState createState() => YSWalletDetailState(); } class YSWalletDetailState extends State { final List _menuArray = [ {'image':'导入','title':S.current.DAOCHUSIYAO,'key':1}, {'image':'导出 (2)','title':S.current.DAOCHUKEYSTORE,'key':2}, // {'image':'同步','title':S.current.QIANBAOTONGBU,'key':3}, // {'image':'白名单','title':S.current.BAIMINGDAN,'key':4}, ]; @override Widget build(BuildContext context) { return YSBase2( titleType: 2, ysRightWidget: const YSCapsule(), ysChild: Padding( padding: EdgeInsets.only(left: hsp(20),right: hsp(20)), child: Column( children: [ Container( height: hsp(50), alignment: Alignment.centerLeft, child: Text('${S.current.QIANBAOXIANGQING2} ',style: YSColors.title2Style(context),), ), Padding( padding: EdgeInsets.only(top: hsp(5)), child: YSWalletManagerListItemView(item: widget.wallet,isDetail: true,) ), '${widget.wallet['private']}'.isEmpty?Container( height: hsp(100), ):Container( margin: EdgeInsets.only(top: hsp(15)), decoration: BoxDecoration( color: Colors.white, borderRadius: const BorderRadius.all(Radius.circular(10)), boxShadow: [ BoxShadow(color: YSColors.shadowColor(context),blurRadius: 5) ] ), child: ListView.separated( itemBuilder: (context,index){ Map item = _menuArray[index]; return GestureDetector( onTap: (){ if(item['key']==1||item['key']==2){ ysShowCenterAlertView(context, YSInputPasswordView(wallet: widget.wallet, callback: () { Navigator.of(context).push( CupertinoPageRoute(builder: (context){ return item['key']==1?YSWalletExportPrivate(wallet: widget.wallet,):YSWalletExport(wallet: widget.wallet,); }) ); },)); } }, behavior: HitTestBehavior.opaque, child: SizedBox( height: hsp(45), child: Row( children: [ Image.asset(YSColors.imageStyle(context, item['image']),height: hsp(10),width: hsp(10),), Expanded( child: Padding( padding: EdgeInsets.only(left: hsp(10),right: hsp(10)), child: Text(item['title'],style: YSColors.contentStyle(context),) ) ), ], ), ), ); }, separatorBuilder: (context,index){ return Divider(height: hsp(1),color: YSColors.lineColor(context),); }, itemCount: _menuArray.length, padding: EdgeInsets.only(left: hsp(15),right: hsp(15)), shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), ), ), GestureDetector( onTap: (){ ysShowBottomAlertView(context, YSTipsAlertView2(valueSetter: (value){ if(value){ ysShowCenterAlertView(context, YSInputPasswordView(wallet: widget.wallet, callback: () async{ YSSqflite().rawDelete('${widget.wallet['id']}'); List array = await YSSqflite().rawQuery(); if(!mounted)return; YSSqflite.notifier(context, array); Navigator.of(context).pop(''); })); } }, tipsStr: S.current.QUEDINGYAOSHANCHUQIANBAO, tipsStr2: S.current.SHANCHUQIANQINGBEIFEN, btnStr1: S.current.QUXIAO, btnStr2: S.current.YIZHIXIAOJIXU, ),isBarr: true); }, child: Container( margin: EdgeInsets.only(top: hsp(25)), height: hsp(50), decoration: BoxDecoration( color: YSColors.buttonColor(context), borderRadius: const BorderRadius.all(Radius.circular(10)) ), alignment: Alignment.center, child: Text(S.current.SHANCHUQIANBAO,style: YSColors.buttonStyle(context),), ), ) ], ), ), ); } }