YSAlertView.dart 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_wallet/generated/l10n.dart';
  4. import 'package:flutter_wallet/login/YSChooseIntoType.dart';
  5. import 'package:flutter_wallet/tools/YSNetWork.dart';
  6. import 'package:flutter_wallet/tools/YSRefrehLoad.dart';
  7. import 'package:flutter_wallet/tools/YSSqflite.dart';
  8. import 'package:package_info_plus/package_info_plus.dart';
  9. import 'package:sqflite/sqflite.dart';
  10. import '../login/YSWalletCreate.dart';
  11. import '../login/YSWalletInto.dart';
  12. import '../wallet/view/YSWalletListItemView.dart';
  13. import 'YSColors.dart';
  14. import 'YSTools.dart';
  15. import 'YSVersionView.dart';
  16. class YSTipsAlertView2 extends StatefulWidget {
  17. final ValueSetter<bool> valueSetter;
  18. final String tipsStr;
  19. final String tipsStr2;
  20. final String? btnStr1;
  21. final String? btnStr2;
  22. const YSTipsAlertView2({Key? key, required this.valueSetter, this.tipsStr = '', this.tipsStr2 = '', this.btnStr1, this.btnStr2}) : super(key: key);
  23. @override
  24. YSTipsAlertView2State createState() => YSTipsAlertView2State();
  25. }
  26. class YSTipsAlertView2State extends State<YSTipsAlertView2> {
  27. @override
  28. Widget build(BuildContext context) {
  29. return Center(
  30. child: Container(
  31. width: ysWidth(context)-hsp(60),
  32. height: hsp(205),
  33. decoration: BoxDecoration(
  34. color: YSColors.backgroundColor(context),
  35. borderRadius: const BorderRadius.all(Radius.circular(10))
  36. ),
  37. child: LayoutBuilder(
  38. builder: (context,conSize){
  39. return Column(
  40. children: [
  41. Padding(
  42. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  43. child: Column(
  44. children: [
  45. Container(
  46. margin: EdgeInsets.only(top: hsp(30),bottom: hsp(15)),
  47. height: hsp(30),
  48. alignment: Alignment.center,
  49. child: Image.asset(YSColors.imageStyle(context, '警告'),height: hsp(30),width: hsp(30),)
  50. ),
  51. SizedBox(
  52. height: hsp(20),
  53. child: Text(widget.tipsStr,style: YSColors.contentStyle(context),maxLines: 3,overflow: TextOverflow.ellipsis,),
  54. ),
  55. Container(
  56. height: hsp(60),
  57. alignment: Alignment.center,
  58. child: Text(widget.tipsStr2,style: YSColors.subStyle(context),maxLines: 3,overflow: TextOverflow.ellipsis,),
  59. ),
  60. ],
  61. ),
  62. ),
  63. Container(
  64. height: hsp(50),
  65. decoration: BoxDecoration(
  66. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: 0.5))
  67. ),
  68. child: ListView.separated(
  69. itemBuilder: (context,index){
  70. return GestureDetector(
  71. onTap: (){
  72. Navigator.pop(context);
  73. widget.valueSetter(index==1);
  74. },
  75. behavior: HitTestBehavior.opaque,
  76. child: Container(
  77. width: conSize.maxWidth/2-0.25,
  78. alignment: Alignment.center,
  79. child: Text(
  80. index==0?widget.btnStr1??S.current.FOU:widget.btnStr2??S.current.SHI,
  81. style: index==0?YSColors.contentStyle(context):TextStyle(fontSize: zsp(14),color: Colors.blue,
  82. fontWeight: FontWeight.normal,decoration: TextDecoration.none),
  83. ),
  84. ),
  85. );
  86. },
  87. separatorBuilder: (context,index){
  88. return Container(width: 0.5,color:YSColors.lineColor(context),);
  89. },
  90. itemCount: 2,
  91. scrollDirection: Axis.horizontal,
  92. ),
  93. )
  94. ],
  95. );
  96. },
  97. ),
  98. ),
  99. );
  100. }
  101. }
  102. class YSTipsAlertView extends StatefulWidget {
  103. final ValueSetter<bool> valueSetter;
  104. final String tipsStr;
  105. final String? btnStr1;
  106. final String? btnStr2;
  107. const YSTipsAlertView({Key? key, required this.valueSetter, this.tipsStr = '', this.btnStr1, this.btnStr2}) : super(key: key);
  108. @override
  109. YSTipsAlertViewState createState() => YSTipsAlertViewState();
  110. }
  111. class YSTipsAlertViewState extends State<YSTipsAlertView> {
  112. @override
  113. Widget build(BuildContext context) {
  114. return Center(
  115. child: Container(
  116. width: ysWidth(context)-hsp(60),
  117. height: hsp(150),
  118. decoration: BoxDecoration(
  119. color: YSColors.backgroundColor(context),
  120. borderRadius: const BorderRadius.all(Radius.circular(10))
  121. ),
  122. child: LayoutBuilder(
  123. builder: (context,conSize){
  124. return Column(
  125. children: [
  126. Container(
  127. height: hsp(100),
  128. alignment: Alignment.center,
  129. padding: EdgeInsets.all(hsp(10)),
  130. child: Text(widget.tipsStr,style: YSColors.contentStyle(context),maxLines: 3,overflow: TextOverflow.ellipsis,),
  131. ),
  132. Container(
  133. height: hsp(50),
  134. decoration: BoxDecoration(
  135. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: 0.5))
  136. ),
  137. child: ListView.separated(
  138. itemBuilder: (context,index){
  139. return GestureDetector(
  140. onTap: (){
  141. Navigator.pop(context);
  142. widget.valueSetter(index==1);
  143. },
  144. behavior: HitTestBehavior.opaque,
  145. child: Container(
  146. width: conSize.maxWidth/2-0.25,
  147. alignment: Alignment.center,
  148. child: Text(
  149. index==0?widget.btnStr1??S.current.FOU:widget.btnStr2??S.current.SHI,
  150. style: YSColors.contentStyle(context),
  151. ),
  152. ),
  153. );
  154. },
  155. separatorBuilder: (context,index){
  156. return Container(width: 0.5,color:YSColors.lineColor(context),);
  157. },
  158. itemCount: 2,
  159. scrollDirection: Axis.horizontal,
  160. ),
  161. )
  162. ],
  163. );
  164. },
  165. ),
  166. ),
  167. );
  168. }
  169. }
  170. class YSAlertMessage extends StatefulWidget {
  171. final Icon? icon;
  172. final String? message;
  173. final VoidCallback? callback;
  174. const YSAlertMessage({Key? key, this.icon, this.message, required this.callback}) : super(key: key);
  175. @override
  176. YSAlertMessageState createState() => YSAlertMessageState();
  177. }
  178. class YSAlertMessageState extends State<YSAlertMessage> {
  179. @override
  180. void initState() {
  181. Future.delayed(const Duration(seconds: 1)).then((value) {
  182. _clearAlert();
  183. });
  184. super.initState();
  185. }
  186. _clearAlert() {
  187. Navigator.pop(context);
  188. if(widget.callback!=null){
  189. widget.callback!();
  190. }
  191. }
  192. @override
  193. Widget build(BuildContext context) {
  194. return WillPopScope(
  195. onWillPop: () async{
  196. return false;
  197. },
  198. child: Center(
  199. child: GestureDetector(
  200. onTap: (){
  201. // _clearAlert();
  202. },
  203. child: Container(
  204. height: hsp(150),
  205. width: hsp(150),
  206. decoration: BoxDecoration(
  207. borderRadius: const BorderRadius.all(Radius.circular(10)),
  208. color: YSColors.alertColor(context)
  209. ),
  210. alignment: Alignment.center,
  211. child: Column(
  212. mainAxisSize: MainAxisSize.min,
  213. children: [
  214. widget.icon??Icon(Icons.check,size: hsp(50),color: YSColors.contain2Color(context),),
  215. Padding(
  216. padding: EdgeInsets.only(top: hsp(5)),
  217. child: Text(widget.message??'验证成功',style: YSColors.content2Style(context),),
  218. )
  219. ],
  220. ),
  221. ),
  222. ),
  223. ),
  224. );
  225. }
  226. }
  227. class YSChooseWalletType extends StatelessWidget {
  228. final bool isHome;
  229. const YSChooseWalletType({Key? key, this.isHome = false}) : super(key: key);
  230. @override
  231. Widget build(BuildContext context) {
  232. return Container(
  233. width: ysWidth(context),
  234. height: hsp(300),
  235. decoration: BoxDecoration(
  236. color: YSColors.containColor(context),
  237. borderRadius: const BorderRadius.only(topRight: Radius.circular(35),topLeft: Radius.circular(35))
  238. ),
  239. child: Column(
  240. children: [
  241. Container(
  242. margin: EdgeInsets.only(top: hsp(15)),
  243. height: hsp(4),
  244. width: hsp(71),
  245. decoration: BoxDecoration(
  246. color: YSColors.lineColor(context),
  247. borderRadius: const BorderRadius.all(Radius.circular(50))
  248. ),
  249. ),
  250. Container(
  251. height: hsp(50),
  252. alignment: Alignment.center,
  253. child: Text(S.current.QIANBAOGUANLI2,style: YSColors.titleStyle(context),),
  254. ),
  255. Padding(
  256. padding: EdgeInsets.only(top: hsp(10)),
  257. child: SizedBox(
  258. width: ysWidth(context)-hsp(40),
  259. child: ListView.separated(
  260. itemBuilder: (context,index){
  261. return Container(
  262. padding: EdgeInsets.all(hsp(15)),
  263. decoration: BoxDecoration(
  264. color: index==0?Colors.white:Colors.black,
  265. borderRadius: const BorderRadius.all(Radius.circular(10)),
  266. boxShadow: [
  267. BoxShadow(color: YSColors.shadowColor(context),blurRadius: 3)
  268. ]
  269. ),
  270. child: Row(
  271. children: [
  272. Image.asset(YSColors.imageStyle(context, index==0?'信用卡 2':'资管信托 2'),height: hsp(40),width: hsp(60),),
  273. Expanded(
  274. child: Padding(
  275. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  276. child: Column(
  277. crossAxisAlignment: CrossAxisAlignment.start,
  278. children: [
  279. Text(
  280. index==0?S.current.MEIYOUQIANBAO:S.current.YIYOUQIANBAO,
  281. style: index==0?YSColors.contentStyle(context):YSColors.content2Style(context),
  282. ),
  283. Text(
  284. index==0?S.current.CHUANGJIANQUKUAILIANQIANBAO:S.current.DAORUQIANBAO,
  285. style: YSColors.subStyle(context),
  286. )
  287. ],
  288. ),
  289. )
  290. ),
  291. GestureDetector(
  292. onTap: (){
  293. if(isHome==false)Navigator.of(context).pop();
  294. if(index==0){
  295. Navigator.of(context).push(
  296. CupertinoPageRoute(builder: (context){
  297. return const YSWalletCreate();
  298. })
  299. );
  300. }else{
  301. Navigator.of(context).push(
  302. CupertinoPageRoute(builder: (context){
  303. return const YSChooseIntoType();
  304. })
  305. );
  306. }
  307. },
  308. behavior: HitTestBehavior.opaque,
  309. child: Container(
  310. height: hsp(30),
  311. width: hsp(120),
  312. decoration: BoxDecoration(
  313. borderRadius: const BorderRadius.all(Radius.circular(10)),
  314. color: index==0?Colors.black:Colors.white
  315. ),
  316. alignment: Alignment.center,
  317. child: Text(
  318. index==0?S().CHUANGJIANQIANBAO:S().DAORUQIANBAO,
  319. style: index==0?YSColors.sub2Style(context):YSColors.sub4Style(context),
  320. ),
  321. ),
  322. )
  323. ],
  324. ),
  325. );
  326. },
  327. separatorBuilder: (context,index){
  328. return Container(height: hsp(25),);
  329. },
  330. itemCount: 2,
  331. shrinkWrap: true,
  332. padding: const EdgeInsets.all(0),
  333. physics: const NeverScrollableScrollPhysics(),
  334. ),
  335. ),
  336. )
  337. ],
  338. ),
  339. );
  340. }
  341. }
  342. ///TODO::网络选择
  343. class YSWalletNetView extends StatefulWidget {
  344. final ValueSetter? valueSetter;
  345. const YSWalletNetView({Key? key, this.valueSetter}) : super(key: key);
  346. @override
  347. YSWalletNetViewState createState() => YSWalletNetViewState();
  348. }
  349. class YSWalletNetViewState extends State<YSWalletNetView> {
  350. @override
  351. Widget build(BuildContext context) {
  352. return Container(
  353. height: hsp(400),
  354. decoration: BoxDecoration(
  355. color: YSColors.containColor(context),
  356. borderRadius: const BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  357. ),
  358. child: Column(
  359. children: [
  360. Container(
  361. height: hsp(49),
  362. alignment: Alignment.center,
  363. child: Text(S.current.XUANZEWANGLUO,style: YSColors.titleStyle(context),),
  364. ),
  365. Divider(height: hsp(1),color: YSColors.lineColor(context),),
  366. SizedBox(
  367. height: hsp(350),
  368. child: YSRefreshLoad(
  369. url: 'chains',
  370. request: const {},
  371. postData: (value) {
  372. YSData().typeArray = value;
  373. setState(() {});
  374. },
  375. child: ListView.separated(
  376. itemBuilder: (context,index){
  377. Map item = YSData().typeArray[index];
  378. bool isChoose = item['id'] == YSData().typeId;
  379. return GestureDetector(
  380. onTap: () async{
  381. if(widget.valueSetter!=null){
  382. widget.valueSetter!(item);
  383. }else{
  384. YSData().chooseIndex++;
  385. YSData().typeId = item['id'];
  386. setState(() {});
  387. YSData().exName = item['name'];
  388. List nodes = item['nodes']??[];
  389. if(nodes.isNotEmpty){
  390. YSData().rpc = nodes.first['rpc_url'];
  391. }
  392. YSSharedPreferences.setStringValue('typeId', item['id']);
  393. YSSharedPreferences.setStringValue('typeName', item['name']);
  394. YSSqflite sq = YSSqflite().init();
  395. List array = await sq.rawQuery();
  396. if(!mounted)return;
  397. if(array.isNotEmpty){
  398. LogUtil.d(array);
  399. Map wallet= array.firstWhere((element) => element['chooseType']==1,orElse: ()=>{});
  400. if(wallet.isEmpty)wallet = array.first;
  401. YSData().wallet = wallet;
  402. YSSqflite.notifier(context, array);
  403. addToken(context,kind: 1);
  404. checkAddress();
  405. }else{
  406. YSSqflite.notifier(context, array);
  407. }
  408. // getMindToken(context);
  409. }
  410. if(!mounted)return;
  411. Navigator.pop(context);
  412. },
  413. behavior: HitTestBehavior.opaque,
  414. child: Container(
  415. height: hsp(49),
  416. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  417. child: Row(
  418. children: [
  419. SizedBox(
  420. height: hsp(40),
  421. width: hsp(40),
  422. child: YSImage.network(item['icon'],),
  423. ),
  424. Expanded(
  425. child: Text(' ${item['name']}',style: YSColors.contentStyle(context),)
  426. ),
  427. if(isChoose)Image.asset(YSColors.imageStyle(context, '矩形2'),height: hsp(15),width: hsp(15),),
  428. ],
  429. ),
  430. ),
  431. );
  432. },
  433. separatorBuilder: (context,index){
  434. return Divider(height: hsp(1),color: YSColors.lineColor(context),);
  435. },
  436. itemCount: YSData().typeArray.length
  437. ),
  438. ),
  439. )
  440. ],
  441. ),
  442. );
  443. }
  444. }
  445. class YSLoadView extends StatefulWidget {
  446. final Function() funAction;
  447. final Map wallet;
  448. final String? successStr;
  449. final String? failStr;
  450. final ValueSetter? valueSetter;
  451. const YSLoadView({Key? key, required this.funAction, required this.wallet, this.successStr, this.failStr, this.valueSetter}) : super(key: key);
  452. @override
  453. YSLoadViewState createState() => YSLoadViewState();
  454. }
  455. class YSLoadViewState extends State<YSLoadView> {
  456. int _type = 3;
  457. final TextEditingController _editingController = TextEditingController();
  458. @override
  459. void dispose() {
  460. _editingController.dispose();
  461. super.dispose();
  462. }
  463. _postFunction() async{
  464. bool result = await widget.funAction();
  465. if(result){
  466. _type = 1;
  467. }else{
  468. _type = 2;
  469. }
  470. setState(() {});
  471. Future.delayed(const Duration(seconds: 1)).then((value) {
  472. Navigator.pop(context);
  473. if(widget.valueSetter!=null){
  474. widget.valueSetter!(_type);
  475. }
  476. });
  477. }
  478. @override
  479. Widget build(BuildContext context) {
  480. return WillPopScope(
  481. onWillPop: () async{
  482. return true;
  483. },
  484. child: Padding(
  485. padding:EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom,),
  486. child: Center(
  487. child: _type==3?Container(
  488. height: hsp(200),
  489. width: ysWidth(context)-hsp(100),
  490. decoration: BoxDecoration(
  491. color: YSColors.containColor(context),
  492. borderRadius: const BorderRadius.all(Radius.circular(10))
  493. ),
  494. child: Column(
  495. children: [
  496. Container(
  497. height: hsp(49),
  498. decoration: BoxDecoration(
  499. border: Border(bottom: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  500. ),
  501. alignment: Alignment.center,
  502. child: Text(S.current.MIMAYANZHENG,style: YSColors.contentStyle(context),),
  503. ),
  504. Container(
  505. height: hsp(100),
  506. padding: EdgeInsets.only(left: hsp(15),right: hsp(15),top: hsp(25),bottom: hsp(25)),
  507. child: CupertinoTextField(
  508. placeholder: S.current.QINGSHURMIMA,
  509. style: YSColors.contentStyle(context),
  510. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  511. controller: _editingController,
  512. obscureText: true
  513. ),
  514. ),
  515. Container(
  516. height: hsp(49),
  517. decoration: BoxDecoration(
  518. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  519. ),
  520. child: Row(
  521. children: [
  522. Expanded(child: GestureDetector(
  523. onTap: (){
  524. Navigator.pop(context);
  525. },
  526. behavior: HitTestBehavior.opaque,
  527. child: Align(
  528. alignment: Alignment.center,
  529. child: Text(S.current.QUXIAO,style: YSColors.contentStyle(context),),
  530. ),
  531. )),
  532. Container(width: hsp(1),color: YSColors.lineColor(context),),
  533. Expanded(child: GestureDetector(
  534. onTap: (){
  535. FocusScope.of(context).unfocus();
  536. if(_editingController.text.isEmpty){
  537. ysFlutterToast(S.current.MIMABUNENGWEIKONG);
  538. return;
  539. }
  540. if(_editingController.text!=widget.wallet['password']){
  541. ysFlutterToast(S.current.MIMACUOWU);
  542. return;
  543. }
  544. _type = 0;
  545. setState(() {});
  546. _postFunction();
  547. },
  548. behavior: HitTestBehavior.opaque,
  549. child: Align(
  550. alignment: Alignment.center,
  551. child: Text(S.current.QUEDING,style: YSColors.contentStyle(context),),
  552. ),
  553. ))
  554. ],
  555. ),
  556. ),
  557. ],
  558. ),
  559. ):Container(
  560. height: hsp(150),
  561. width: hsp(150),
  562. decoration: BoxDecoration(
  563. borderRadius: const BorderRadius.all(Radius.circular(10)),
  564. color: YSColors.alertColor(context)
  565. ),
  566. alignment: Alignment.center,
  567. child: _type==0?CircularProgressIndicator(
  568. color: YSColors.containColor(context),
  569. ):Column(
  570. mainAxisSize: MainAxisSize.min,
  571. children: [
  572. Icon(_type==1?Icons.check:Icons.error,size: hsp(50),color: YSColors.contain2Color(context),),
  573. Padding(
  574. padding: EdgeInsets.only(top: hsp(5)),
  575. child: Text(_type==1?(widget.successStr??S.current.ZHUANZHANGTIJIAOCHENGGONG):(widget.failStr??S.current.ZHUANZHANGTIJIAOSHIBAI),style: YSColors.content2Style(context),),
  576. )
  577. ],
  578. ),
  579. ),
  580. ),
  581. ),
  582. );
  583. }
  584. }
  585. class YSLoadView2 extends StatefulWidget {
  586. final Function() funAction;
  587. final ValueSetter? valueSetter;
  588. final String? successStr;
  589. final String? failStr;
  590. const YSLoadView2({Key? key, required this.funAction, this.valueSetter, this.successStr, this.failStr}) : super(key: key);
  591. @override
  592. YSLoadView2State createState() => YSLoadView2State();
  593. }
  594. class YSLoadView2State extends State<YSLoadView2> {
  595. int _type = 0;
  596. _postFunction() async{
  597. bool result = await widget.funAction();
  598. if(result){
  599. _type = 1;
  600. }else{
  601. _type = 2;
  602. }
  603. setState(() {});
  604. Future.delayed(const Duration(seconds: 0)).then((value) {
  605. widget.valueSetter!(result);
  606. Navigator.pop(context);
  607. });
  608. }
  609. @override
  610. void initState() {
  611. _postFunction();
  612. super.initState();
  613. }
  614. @override
  615. Widget build(BuildContext context) {
  616. return Center(
  617. child: Container(
  618. height: hsp(150),
  619. width: hsp(150),
  620. decoration: BoxDecoration(
  621. borderRadius: const BorderRadius.all(Radius.circular(10)),
  622. color: YSColors.alertColor(context)
  623. ),
  624. alignment: Alignment.center,
  625. child: _type==0?CircularProgressIndicator(
  626. color: YSColors.containColor(context),
  627. ):Column(
  628. mainAxisSize: MainAxisSize.min,
  629. children: [
  630. Icon(_type==1?Icons.check:Icons.error,size: hsp(50),color: YSColors.contain2Color(context),),
  631. Padding(
  632. padding: EdgeInsets.only(top: hsp(5)),
  633. child: Text(_type==1?(widget.successStr??S.current.ZHUANZHANGTIJIAOCHENGGONG):(widget.failStr??S.current.ZHUANZHANGTIJIAOSHIBAI),style: YSColors.content2Style(context),),
  634. )
  635. ],
  636. ),
  637. ),
  638. );
  639. }
  640. }
  641. class YSChooseCheckView extends StatelessWidget {
  642. final ValueSetter<bool> valueSetter;
  643. const YSChooseCheckView({Key? key, required this.valueSetter}) : super(key: key);
  644. @override
  645. Widget build(BuildContext context) {
  646. return Container(
  647. height: hsp(150),
  648. width: ysWidth(context),
  649. decoration: BoxDecoration(
  650. color: YSColors.containColor(context),
  651. borderRadius: const BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  652. ),
  653. child: Column(
  654. children: [
  655. Container(
  656. height: hsp(50),
  657. alignment: Alignment.center,
  658. decoration: BoxDecoration(
  659. border: Border(bottom: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  660. ),
  661. child: Text('类 型 选 择',style: TextStyle(fontSize: zsp(18),color: Colors.black),),
  662. ),
  663. SizedBox(
  664. height: hsp(100),
  665. child: ListView.builder(
  666. itemBuilder: (context,index){
  667. return GestureDetector(
  668. onTap: (){
  669. if(index==0){
  670. }else{
  671. }
  672. },
  673. behavior: HitTestBehavior.opaque,
  674. child: Container(
  675. height: hsp(50),
  676. alignment: Alignment.center,
  677. decoration: BoxDecoration(
  678. border: Border(bottom: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  679. ),
  680. child: Text('指纹验证',style: YSColors.contentStyle(context),),
  681. ),
  682. );
  683. },
  684. itemCount: 2,
  685. padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
  686. ),
  687. )
  688. ],
  689. ),
  690. );
  691. }
  692. }
  693. class YSInputPasswordView extends StatefulWidget {
  694. final Map wallet;
  695. final VoidCallback callback;
  696. const YSInputPasswordView({Key? key, required this.wallet, required this.callback}) : super(key: key);
  697. @override
  698. YSInputPasswordViewState createState() => YSInputPasswordViewState();
  699. }
  700. class YSInputPasswordViewState extends State<YSInputPasswordView> {
  701. final TextEditingController _editingController = TextEditingController();
  702. @override
  703. void dispose() {
  704. _editingController.dispose();
  705. super.dispose();
  706. }
  707. @override
  708. Widget build(BuildContext context) {
  709. return Center(
  710. child: Padding(
  711. padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom,),
  712. child: Container(
  713. height: hsp(200),
  714. width: ysWidth(context)-hsp(100),
  715. decoration: BoxDecoration(
  716. color: YSColors.containColor(context),
  717. borderRadius: const BorderRadius.all(Radius.circular(10))
  718. ),
  719. child: Column(
  720. children: [
  721. Container(
  722. height: hsp(49),
  723. decoration: BoxDecoration(
  724. border: Border(bottom: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  725. ),
  726. alignment: Alignment.center,
  727. child: Text(S.current.MIMAYANZHENG,style: YSColors.contentStyle(context),),
  728. ),
  729. Container(
  730. height: hsp(100),
  731. padding: EdgeInsets.only(left: hsp(15),right: hsp(15),top: hsp(25),bottom: hsp(25)),
  732. child: CupertinoTextField(
  733. placeholder: S.current.QINGSHURMIMA,
  734. style: YSColors.contentStyle(context),
  735. padding: EdgeInsets.only(left: hsp(10),right: hsp(10)),
  736. controller: _editingController,
  737. obscureText: true
  738. ),
  739. ),
  740. Container(
  741. height: hsp(49),
  742. decoration: BoxDecoration(
  743. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  744. ),
  745. child: Row(
  746. children: [
  747. Expanded(child: GestureDetector(
  748. onTap: (){
  749. Navigator.pop(context);
  750. },
  751. behavior: HitTestBehavior.opaque,
  752. child: Align(
  753. alignment: Alignment.center,
  754. child: Text(S.current.QUXIAO,style: YSColors.contentStyle(context),),
  755. ),
  756. )),
  757. Container(width: hsp(1),color: YSColors.lineColor(context),),
  758. Expanded(child: GestureDetector(
  759. onTap: (){
  760. if(_editingController.text.isEmpty){
  761. ysFlutterToast(S.current.MIMABUNENGWEIKONG);
  762. return;
  763. }
  764. if(_editingController.text!=widget.wallet['password']){
  765. ysFlutterToast(S.current.MIMACUOWU);
  766. return;
  767. }
  768. Navigator.pop(context);
  769. widget.callback();
  770. },
  771. behavior: HitTestBehavior.opaque,
  772. child: Align(
  773. alignment: Alignment.center,
  774. child: Text(S.current.QUEDING,style: YSColors.contentStyle(context),),
  775. ),
  776. ))
  777. ],
  778. ),
  779. ),
  780. ],
  781. ),
  782. ),
  783. ),
  784. );
  785. }
  786. }
  787. class YSInputNetView extends StatefulWidget {
  788. final ValueSetter valueSetter;
  789. const YSInputNetView({Key? key, required this.valueSetter}) : super(key: key);
  790. @override
  791. YSInputNetViewState createState() => YSInputNetViewState();
  792. }
  793. class YSInputNetViewState extends State<YSInputNetView> {
  794. final TextEditingController _editingController = TextEditingController();
  795. @override
  796. void dispose() {
  797. _editingController.dispose();
  798. super.dispose();
  799. }
  800. @override
  801. Widget build(BuildContext context) {
  802. return Center(
  803. child: Padding(
  804. padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom,),
  805. child: Container(
  806. height: hsp(200),
  807. width: ysWidth(context)-hsp(100),
  808. decoration: BoxDecoration(
  809. color: YSColors.containColor(context),
  810. borderRadius: const BorderRadius.all(Radius.circular(10))
  811. ),
  812. child: Column(
  813. children: [
  814. Container(
  815. height: hsp(49),
  816. alignment: Alignment.center,
  817. child: Text('添加自定义节点',style: YSColors.contentStyle(context),),
  818. ),
  819. Container(
  820. height: hsp(100),
  821. padding: EdgeInsets.only(left: hsp(15),right: hsp(15),top: hsp(10),bottom: hsp(10)),
  822. child: CupertinoTextField(
  823. placeholder: '请输入节点地址',
  824. style: YSColors.subStyle(context),
  825. padding: EdgeInsets.all(hsp(10)),
  826. controller: _editingController,
  827. decoration: BoxDecoration(
  828. color: YSColors.backgroundColor(context),
  829. borderRadius: const BorderRadius.all(Radius.circular(5))
  830. ),
  831. maxLines: 10,
  832. ),
  833. ),
  834. Container(
  835. height: hsp(49),
  836. decoration: BoxDecoration(
  837. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: hsp(1)))
  838. ),
  839. child: Row(
  840. children: [
  841. Expanded(child: GestureDetector(
  842. onTap: (){
  843. Navigator.pop(context);
  844. },
  845. behavior: HitTestBehavior.opaque,
  846. child: Align(
  847. alignment: Alignment.center,
  848. child: Text(S.current.QUXIAO,style: YSColors.contentStyle(context),),
  849. ),
  850. )),
  851. Container(width: hsp(1),color: YSColors.lineColor(context),),
  852. Expanded(child: GestureDetector(
  853. onTap: (){
  854. if(_editingController.text.isEmpty){
  855. ysFlutterToast('节点不能为空');
  856. return;
  857. }
  858. widget.valueSetter(_editingController.text);
  859. Navigator.pop(context);
  860. },
  861. behavior: HitTestBehavior.opaque,
  862. child: Align(
  863. alignment: Alignment.center,
  864. child: Text(S.current.QUEDING,style: YSColors.contentStyle(context),),
  865. ),
  866. ))
  867. ],
  868. ),
  869. ),
  870. ],
  871. ),
  872. ),
  873. ),
  874. );
  875. }
  876. }
  877. ///TODO::兑换选择
  878. class YSExchangeTypeChooseView1 extends StatefulWidget {
  879. final Map? item;
  880. final ValueSetter valueSetter;
  881. const YSExchangeTypeChooseView1({Key? key, required this.valueSetter, this.item}) : super(key: key);
  882. @override
  883. YSExchangeTypeChooseView1State createState() => YSExchangeTypeChooseView1State();
  884. }
  885. class YSExchangeTypeChooseView1State extends State<YSExchangeTypeChooseView1> with SingleTickerProviderStateMixin{
  886. List _titles = [];
  887. TabController? _tabController;
  888. @override
  889. void initState() {
  890. _getTitleArray();
  891. super.initState();
  892. }
  893. _getTitleArray() {
  894. _titles = YSData().typeArray;
  895. LogUtil.d(_titles);
  896. _tabController = TabController(length: _titles.length, vsync: this);
  897. }
  898. @override
  899. Widget build(BuildContext context) {
  900. return Container(
  901. height: hsp(500),
  902. width: ysWidth(context),
  903. decoration: BoxDecoration(
  904. color: YSColors.containColor(context),
  905. borderRadius: const BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  906. ),
  907. child: _tabController!=null?DefaultTabController(
  908. length: _titles.length,
  909. child: Column(
  910. children: [
  911. Container(
  912. height: hsp(50),
  913. alignment: Alignment.center,
  914. child: Text('钱 包 选 择',style: TextStyle(fontSize: zsp(18),color: Colors.black),),
  915. ),
  916. widget.item==null?Column(
  917. children: [
  918. Container(
  919. height: hsp(50),
  920. width: ysWidth(context),
  921. decoration: BoxDecoration(
  922. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: hsp(0)),bottom: BorderSide(color: YSColors.lineColor(context),width: hsp(0)))
  923. ),
  924. child: TabBar(
  925. controller: _tabController,
  926. indicatorColor: Colors.transparent,
  927. indicatorWeight: hsp(1),
  928. isScrollable: true,
  929. labelPadding: EdgeInsets.only(left: hsp(15)),
  930. labelColor: YSColors.selectedColor(context),
  931. unselectedLabelColor: YSColors.unSelectedColor(context),
  932. tabs: _titles.map((f) {
  933. return Tab(
  934. child: Container(
  935. padding: EdgeInsets.only(left: hsp(10),right: hsp(10),top: hsp(5),bottom: hsp(5)),
  936. child: Text(f['token_sort_name']),
  937. ),
  938. );
  939. }).toList(),
  940. ),
  941. ),
  942. SizedBox(
  943. height: hsp(400),
  944. child: TabBarView(
  945. controller: _tabController,
  946. children: _titles.map((f) {
  947. return YSAlertChooseWalletListView(item: f, valueSetter: (value) {
  948. value['parentName'] = f['name'];
  949. value['parentIcon'] = f['icon'];
  950. List nodes = f['nodes']??[];
  951. if(nodes.isNotEmpty){
  952. value['parentRpc'] = nodes.first['rpc_url'];
  953. }
  954. widget.valueSetter(value);
  955. Navigator.pop(context);
  956. },);
  957. }).toList(),
  958. ),
  959. )
  960. ],
  961. ):YSAlertChooseWalletListView(item: {'icon':widget.item?['parentIcon'],'name':widget.item?['parentName']}, valueSetter: (value) {
  962. widget.valueSetter(value);
  963. Navigator.pop(context);
  964. },)
  965. ],
  966. ),
  967. ):Container(),
  968. );
  969. }
  970. }
  971. class YSAlertChooseWalletListView extends StatefulWidget {
  972. final ValueSetter valueSetter;
  973. final Map item;
  974. const YSAlertChooseWalletListView({Key? key, required this.item, required this.valueSetter}) : super(key: key);
  975. @override
  976. YSAlertChooseWalletListViewState createState() => YSAlertChooseWalletListViewState();
  977. }
  978. class YSAlertChooseWalletListViewState extends State<YSAlertChooseWalletListView> {
  979. List _dataArray = [];
  980. @override
  981. void initState() {
  982. _getWalletData();
  983. super.initState();
  984. }
  985. _getWalletData() async{
  986. _dataArray = await YSSqflite().init().rawQuery(name: widget.item['name']);
  987. setState(() {});
  988. }
  989. @override
  990. Widget build(BuildContext context) {
  991. return ListView.builder(
  992. itemBuilder: (context, index) {
  993. Map item = _dataArray[index];
  994. return Container(
  995. padding: EdgeInsets.only(left: hsp(15),right: hsp(15),top: hsp(10),bottom: hsp(10)),
  996. alignment: Alignment.centerLeft,
  997. child: Row(
  998. children: [
  999. ClipRRect(
  1000. borderRadius: const BorderRadius.all(Radius.circular(50)),
  1001. child: YSImage.network(widget.item['icon'],height: hsp(40),width: hsp(40),),
  1002. ),
  1003. Expanded(
  1004. child: Container(
  1005. padding: EdgeInsets.only(top: hsp(5),bottom: hsp(5),left: hsp(5),right: hsp(5)),
  1006. child: Column(
  1007. crossAxisAlignment: CrossAxisAlignment.start,
  1008. children: [
  1009. Text(item['name']??'',style: YSColors.contentStyle(context),maxLines: 1,),
  1010. Padding(
  1011. padding: EdgeInsets.only(top: hsp(5)),
  1012. child: Text(ysTextCut(item['public']),style: YSColors.subStyle(context),)
  1013. )
  1014. ],
  1015. ),
  1016. )
  1017. ),
  1018. GestureDetector(
  1019. onTap: () async{
  1020. widget.valueSetter({'icon_url':widget.item['icon'],'bl_symbol':widget.item['name'],'address':item['public'],'private':item['private']});
  1021. },
  1022. child: Icon(Icons.add_circle_outline,size: hsp(20),color: Colors.blue,),
  1023. )
  1024. ],
  1025. )
  1026. );
  1027. },
  1028. itemCount: _dataArray.length,
  1029. padding: const EdgeInsets.all(0),
  1030. shrinkWrap: true,
  1031. physics: const NeverScrollableScrollPhysics(),
  1032. );
  1033. }
  1034. }
  1035. class YSExchangeTypeChooseView2 extends StatefulWidget {
  1036. final ValueSetter valueSetter;
  1037. const YSExchangeTypeChooseView2({Key? key, required this.valueSetter}) : super(key: key);
  1038. @override
  1039. YSExchangeTypeChooseView2State createState() => YSExchangeTypeChooseView2State();
  1040. }
  1041. class YSExchangeTypeChooseView2State extends State<YSExchangeTypeChooseView2> with SingleTickerProviderStateMixin{
  1042. List _titles = [];
  1043. TabController? _tabController;
  1044. List _dataArray = [];
  1045. Map _type = {};
  1046. @override
  1047. void initState() {
  1048. _getTitleArray();
  1049. super.initState();
  1050. }
  1051. _getTitleArray() {
  1052. _titles = YSData().typeArray;
  1053. _tabController = TabController(length: _titles.length, vsync: this);
  1054. _type = _titles.firstWhere((element) => element['id']==YSData().typeId);
  1055. }
  1056. @override
  1057. Widget build(BuildContext context) {
  1058. return Container(
  1059. height: hsp(500),
  1060. width: ysWidth(context),
  1061. decoration: BoxDecoration(
  1062. color: YSColors.containColor(context),
  1063. borderRadius: const BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  1064. ),
  1065. child: _tabController!=null?DefaultTabController(
  1066. length: _titles.length,
  1067. child: false?Column(
  1068. children: [
  1069. Container(
  1070. height: hsp(50),
  1071. alignment: Alignment.center,
  1072. child: Text('类 型 选 择',style: TextStyle(fontSize: zsp(18),color: Colors.black),),
  1073. ),
  1074. Container(
  1075. height: hsp(50),
  1076. width: ysWidth(context),
  1077. decoration: BoxDecoration(
  1078. border: Border(top: BorderSide(color: YSColors.lineColor(context),width: hsp(0)),bottom: BorderSide(color: YSColors.lineColor(context),width: hsp(0)))
  1079. ),
  1080. child: TabBar(
  1081. controller: _tabController,
  1082. indicatorColor: Colors.transparent,
  1083. indicatorWeight: hsp(1),
  1084. isScrollable: true,
  1085. labelPadding: EdgeInsets.only(left: hsp(15)),
  1086. labelColor: YSColors.selectedColor(context),
  1087. unselectedLabelColor: YSColors.unSelectedColor(context),
  1088. tabs: _titles.map((f) {
  1089. return Tab(
  1090. child: Container(
  1091. padding: EdgeInsets.only(left: hsp(10),right: hsp(10),top: hsp(5),bottom: hsp(5)),
  1092. child: Text(f['token_sort_name']),
  1093. ),
  1094. );
  1095. }).toList(),
  1096. ),
  1097. ),
  1098. SizedBox(
  1099. height: hsp(400),
  1100. child: TabBarView(
  1101. controller: _tabController,
  1102. children: _titles.map((f) {
  1103. return YSRefreshLoad(
  1104. url: 'tokens',
  1105. request: {'chain_id':f['id']},
  1106. postData: (value) {
  1107. _dataArray = value;
  1108. setState(() {});
  1109. },
  1110. isLoading: false,
  1111. child: ListView.builder(
  1112. itemBuilder: (context, index) {
  1113. Map item = _dataArray[index];
  1114. return YSWalletListChooseItemView(item: item,valueSetter: (value){
  1115. value['parentName'] = f['name'];
  1116. value['parentIcon'] = f['icon'];
  1117. List nodes = f['nodes']??[];
  1118. if(nodes.isNotEmpty){
  1119. value['parentRpc'] = nodes.first['rpc_url'];
  1120. }
  1121. widget.valueSetter(value);
  1122. Navigator.pop(context);
  1123. },);
  1124. },
  1125. itemCount: _dataArray.length,
  1126. padding: const EdgeInsets.all(0),
  1127. shrinkWrap: true,
  1128. physics: const NeverScrollableScrollPhysics(),
  1129. ),
  1130. );
  1131. }).toList(),
  1132. ),
  1133. )
  1134. ],
  1135. ):Column(
  1136. children: [
  1137. Container(
  1138. height: hsp(50),
  1139. alignment: Alignment.center,
  1140. child: Text('类 型 选 择',style: TextStyle(fontSize: zsp(18),color: Colors.black),),
  1141. ),
  1142. SizedBox(
  1143. height: hsp(450),
  1144. child: YSRefreshLoad(
  1145. url: 'tokens',
  1146. request: {'chain_id':YSData().typeId},
  1147. postData: (value) {
  1148. _dataArray = value;
  1149. setState(() {});
  1150. },
  1151. isLoading: false,
  1152. child: ListView.builder(
  1153. itemBuilder: (context, index) {
  1154. Map item = _dataArray[index];
  1155. return YSWalletListChooseItemView(item: item,valueSetter: (value){
  1156. value['parentName'] = _type['name'];
  1157. value['parentIcon'] = _type['icon'];
  1158. List nodes = _type['nodes']??[];
  1159. if(nodes.isNotEmpty){
  1160. value['parentRpc'] = nodes.first['rpc_url'];
  1161. }
  1162. widget.valueSetter(value);
  1163. Navigator.pop(context);
  1164. },);
  1165. },
  1166. itemCount: _dataArray.length,
  1167. padding: const EdgeInsets.all(0),
  1168. shrinkWrap: true,
  1169. physics: const NeverScrollableScrollPhysics(),
  1170. ),
  1171. ),
  1172. )
  1173. ],
  1174. ),
  1175. ):Container(),
  1176. );
  1177. }
  1178. }
  1179. ///TODO::跨链选择
  1180. class YSCrossCoinChooseView extends StatefulWidget {
  1181. final ValueSetter valueSetter;
  1182. const YSCrossCoinChooseView({Key? key, required this.valueSetter}) : super(key: key);
  1183. @override
  1184. YSCrossCoinChooseViewState createState() => YSCrossCoinChooseViewState();
  1185. }
  1186. class YSCrossCoinChooseViewState extends State<YSCrossCoinChooseView> {
  1187. List _dataArray = [];
  1188. @override
  1189. Widget build(BuildContext context) {
  1190. return Container(
  1191. height: hsp(400),
  1192. width: ysWidth(context),
  1193. decoration: BoxDecoration(
  1194. color: YSColors.containColor(context),
  1195. borderRadius: const BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  1196. ),
  1197. child: Column(
  1198. children: [
  1199. Container(
  1200. height: hsp(50),
  1201. alignment: Alignment.center,
  1202. child: Text('资 产 选 择',style: TextStyle(fontSize: zsp(18),color: Colors.black),),
  1203. ),
  1204. SizedBox(
  1205. height: hsp(350),
  1206. child: YSRefreshLoad(
  1207. url: 'tokens',
  1208. request: {'chain_id':YSData().typeId},
  1209. postData: (value) {
  1210. _dataArray = value;
  1211. setState(() {});
  1212. },
  1213. isLoading: false,
  1214. child: ListView.builder(
  1215. itemBuilder: (context, index) {
  1216. Map item = _dataArray[index];
  1217. return GestureDetector(
  1218. onTap: (){
  1219. widget.valueSetter(item);
  1220. Navigator.pop(context);
  1221. },
  1222. behavior: HitTestBehavior.opaque,
  1223. child: YSCrossListItemView(item: item,),
  1224. );
  1225. },
  1226. itemCount: _dataArray.length,
  1227. padding: const EdgeInsets.all(0),
  1228. shrinkWrap: true,
  1229. physics: const NeverScrollableScrollPhysics(),
  1230. ),
  1231. ),
  1232. )
  1233. ],
  1234. ),
  1235. );
  1236. }
  1237. }
  1238. class YSCrossAddressView extends StatefulWidget {
  1239. final ValueSetter valueSetter;
  1240. final Map item;
  1241. const YSCrossAddressView({Key? key, required this.valueSetter, required this.item}) : super(key: key);
  1242. @override
  1243. YSCrossAddressViewState createState() => YSCrossAddressViewState();
  1244. }
  1245. class YSCrossAddressViewState extends State<YSCrossAddressView> {
  1246. @override
  1247. Widget build(BuildContext context) {
  1248. return Container(
  1249. height: hsp(400),
  1250. width: ysWidth(context),
  1251. decoration: BoxDecoration(
  1252. color: YSColors.containColor(context),
  1253. borderRadius: const BorderRadius.only(topRight: Radius.circular(10),topLeft: Radius.circular(10))
  1254. ),
  1255. child: Column(
  1256. children: [
  1257. Container(
  1258. height: hsp(50),
  1259. alignment: Alignment.center,
  1260. child: Text('类 型 选 择',style: TextStyle(fontSize: zsp(18),color: Colors.black),),
  1261. ),
  1262. SizedBox(
  1263. height: hsp(350),
  1264. child: YSAlertChooseWalletListView(item: widget.item, valueSetter: (value) {
  1265. widget.valueSetter(value);
  1266. Navigator.pop(context);
  1267. },),
  1268. )
  1269. ],
  1270. ),
  1271. );
  1272. ;
  1273. }
  1274. }
  1275. class YSCrossListItemView extends StatefulWidget {
  1276. final Map item;
  1277. const YSCrossListItemView({Key? key, required this.item}) : super(key: key);
  1278. @override
  1279. YSCrossListItemViewState createState() => YSCrossListItemViewState();
  1280. }
  1281. class YSCrossListItemViewState extends State<YSCrossListItemView> {
  1282. @override
  1283. Widget build(BuildContext context) {
  1284. return Container(
  1285. padding: EdgeInsets.only(left: hsp(15),right: hsp(15),top: hsp(10),bottom: hsp(10)),
  1286. alignment: Alignment.centerLeft,
  1287. child: Row(
  1288. children: [
  1289. ClipRRect(
  1290. borderRadius: const BorderRadius.all(Radius.circular(50)),
  1291. child: YSImage.network(widget.item['icon_url'],height: hsp(40),width: hsp(40),),
  1292. ),
  1293. Expanded(
  1294. child: Container(
  1295. padding: EdgeInsets.only(top: hsp(5),bottom: hsp(5),left: hsp(5),right: hsp(5)),
  1296. child: Column(
  1297. crossAxisAlignment: CrossAxisAlignment.start,
  1298. children: [
  1299. Text(widget.item['name']??'',style: YSColors.contentStyle(context),maxLines: 1,),
  1300. Padding(
  1301. padding: EdgeInsets.only(top: hsp(5)),
  1302. child: Text(ysTextCut(widget.item['address']),style: YSColors.subStyle(context),)
  1303. )
  1304. ],
  1305. ),
  1306. )
  1307. ),
  1308. ],
  1309. )
  1310. );
  1311. }
  1312. }
  1313. ///版本更新
  1314. getVersionData(BuildContext context,Map data) async{
  1315. if(data.isNotEmpty){
  1316. PackageInfo packageInfo = await PackageInfo.fromPlatform();
  1317. if(int.parse(packageInfo.buildNumber)<data['build']){
  1318. // ignore: use_build_context_synchronously
  1319. ysShowCenterAlertView(context, YSVersionView(
  1320. title: 'v${data['version']}更新',
  1321. content: data['txt'],
  1322. url: data['url'],
  1323. isBack: data['isForce']==0,
  1324. ),isTrans: false,isBarr: data['isForce']==1);
  1325. }
  1326. }
  1327. }