123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- 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<YSWalletDetail> {
- 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),),
- ),
- )
- ],
- ),
- ),
- );
- }
- }
|