From 5e2fe4eb2ab0be73d069c44bb006e9d0b65ae60e Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Fri, 27 May 2022 11:00:20 +0800 Subject: [PATCH 01/17] update ui --- .../governanceNew/referendumVotePage.dart | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/lib/pages/governanceNew/referendumVotePage.dart b/lib/pages/governanceNew/referendumVotePage.dart index 939a42979..fdf4cd0e0 100644 --- a/lib/pages/governanceNew/referendumVotePage.dart +++ b/lib/pages/governanceNew/referendumVotePage.dart @@ -61,18 +61,19 @@ class _ReferendumVoteState extends State { txs.add( 'api.tx.democracy.vote(${info.index!.toInt()},${jsonEncode(standard)})'); return TxConfirmParams( - txTitle: govDic['vote.proposal'], - module: 'utility', - call: 'batch', - txDisplay: { - govDic["referenda"]: '#${info.index!.toInt()}', - govDic["vote"]: voteYes ? govDic['yes'] : govDic['no'], - dic["amount"]: '$amt ${widget.plugin.networkState.tokenSymbol![0]}', - '': _getConvictionLabel(_voteConviction), - }, - params: [], - rawParams: '[[${txs.join(',')}]]', - ); + txTitle: govDic['vote.proposal'], + module: 'utility', + call: 'batch', + txDisplay: { + govDic["referenda"]: '#${info.index!.toInt()}', + govDic["vote"]: voteYes ? govDic['yes'] : govDic['no'], + dic["amount"]: + '$amt ${widget.plugin.networkState.tokenSymbol![0]}', + '': _getConvictionLabel(_voteConviction), + }, + params: [], + rawParams: '[[${txs.join(',')}]]', + isPlugin: true); } else { return TxConfirmParams( module: 'democracy', @@ -90,7 +91,8 @@ class _ReferendumVoteState extends State { info.index!.toInt(), // "options" {"Standard": vote}, - ]); + ], + isPlugin: true); } } return null; From 463e17305379c33c5b1b2587cba992d6104c5afd Mon Sep 17 00:00:00 2001 From: shawn Date: Fri, 27 May 2022 15:34:46 +0800 Subject: [PATCH 02/17] dependencies upgrade --- example/pubspec.lock | 63 ++++++++++++++++++++++++++++++++++---------- example/pubspec.yaml | 8 ++++-- pubspec.lock | 20 +++++++------- pubspec.yaml | 8 +++--- 4 files changed, 69 insertions(+), 30 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 52353ae6d..b285f836f 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -22,6 +22,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.1" + card_swiper: + dependency: transitive + description: + name: card_swiper + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.3" characters: dependency: transitive description: @@ -158,13 +165,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.7" + flutter_screenutil: + dependency: transitive + description: + name: flutter_screenutil + url: "https://pub.dartlang.org" + source: hosted + version: "5.5.3+2" flutter_svg: dependency: transitive description: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "0.23.0+1" + version: "1.0.3" flutter_swiper: dependency: transitive description: @@ -302,7 +316,7 @@ packages: name: mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.7" path: dependency: transitive description: @@ -316,14 +330,14 @@ packages: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "0.5.1+1" + version: "1.0.0" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "1.0.0" path_provider: dependency: transitive description: @@ -407,21 +421,21 @@ packages: path: ".." relative: true source: path - version: "0.3.6" + version: "0.4.6" polkawallet_sdk: dependency: transitive description: name: polkawallet_sdk url: "https://pub.dartlang.org" source: hosted - version: "0.3.7" + version: "0.4.6" polkawallet_ui: dependency: "direct main" description: - name: polkawallet_ui - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.6" + path: "../../ui" + relative: true + source: path + version: "0.4.6" process: dependency: transitive description: @@ -443,6 +457,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.0" + scrollable_positioned_list: + dependency: transitive + description: + name: scrollable_positioned_list + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.3" shared_preferences: dependency: transitive description: @@ -485,6 +506,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" + shimmer: + dependency: transitive + description: + name: shimmer + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" + skeleton_loader: + dependency: transitive + description: + name: skeleton_loader + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0+4" sky_engine: dependency: transitive description: flutter @@ -594,28 +629,28 @@ packages: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "3.0.4" webview_flutter_android: dependency: transitive description: name: webview_flutter_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.15" + version: "2.8.8" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.8.0" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview url: "https://pub.dartlang.org" source: hosted - version: "2.0.14" + version: "2.7.5" win32: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index d83cf12ff..693809ff2 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -25,13 +25,17 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - flutter_mobx: ^2.0.0 - polkawallet_ui: ^0.3.4 + flutter_mobx: ^2.0.2 + polkawallet_ui: ^0.4.6 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.0 +#dependency_overrides: +# polkawallet_ui: +# path: ../../ui + dev_dependencies: polkawallet_plugin_kusama: path: ../ diff --git a/pubspec.lock b/pubspec.lock index dca7c3992..9e0619f7e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -70,7 +70,7 @@ packages: name: build_daemon url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.1.0" build_resolvers: dependency: transitive description: @@ -84,7 +84,7 @@ packages: name: build_runner url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.11" build_runner_core: dependency: transitive description: @@ -257,7 +257,7 @@ packages: name: flutter_inappwebview url: "https://pub.dartlang.org" source: hosted - version: "5.3.2" + version: "5.4.3+7" flutter_mobx: dependency: "direct main" description: @@ -299,7 +299,7 @@ packages: name: flutter_svg url: "https://pub.dartlang.org" source: hosted - version: "0.23.0+1" + version: "1.0.3" flutter_swiper: dependency: "direct main" description: @@ -491,7 +491,7 @@ packages: name: mobx url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.7" mobx_codegen: dependency: "direct dev" description: @@ -519,14 +519,14 @@ packages: name: path_drawing url: "https://pub.dartlang.org" source: hosted - version: "0.5.1+1" + version: "1.0.0" path_parsing: dependency: transitive description: name: path_parsing url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "1.0.0" path_provider: dependency: transitive description: @@ -617,14 +617,14 @@ packages: path: "../sdk" relative: true source: path - version: "0.4.4" + version: "0.4.6" polkawallet_ui: dependency: "direct main" description: path: "../ui" relative: true source: path - version: "0.4.4" + version: "0.4.6" pool: dependency: transitive description: @@ -902,7 +902,7 @@ packages: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.0.4" webview_flutter_android: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e54cde494..1194ec0d3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,10 +11,10 @@ dependencies: flutter: sdk: flutter cupertino_icons: ^1.0.3 - http: ^0.13.3 - mobx: ^2.0.4 + http: ^0.13.4 + mobx: ^2.0.7 flutter_mobx: ^2.0.2 - flutter_svg: ^0.23.0+1 + flutter_svg: ^1.0.3 get_storage: ^2.0.3 json_annotation: ^4.0.1 polkawallet_sdk: ^0.4.6 @@ -24,7 +24,7 @@ dependencies: flutter_swiper: ^1.1.6 dev_dependencies: - build_runner: ^2.1.2 + build_runner: ^2.1.11 mobx_codegen: ^2.0.2 json_serializable: ^4.1.4 flutter_test: From 73d121f6258267cc1529ef7cabe2e80b8dd784d6 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Mon, 30 May 2022 15:30:51 +0800 Subject: [PATCH 03/17] Restake on STAKING stats panel --- assets/images/staking/icon_rebond.png | Bin 0 -> 1007 bytes lib/pages/stakingNew/stakingView.dart | 439 +++++++++++++++++++------- 2 files changed, 328 insertions(+), 111 deletions(-) create mode 100644 assets/images/staking/icon_rebond.png diff --git a/assets/images/staking/icon_rebond.png b/assets/images/staking/icon_rebond.png new file mode 100644 index 0000000000000000000000000000000000000000..c7aa334920fd7f7028b1aed13e2c7870f50c711f GIT binary patch literal 1007 zcmVPx&sYygZR9Hv7m`!M0RTRg6|Ch8${V0MUq6GLMta(F>iUx5}K|$M% z%VuV5l+m`Cm!ykY#R@72>PA7u=)A#H3Eh-ztkz9a8?^{QT@_EZmpmhsvHbqdpS3{#y%Wcab*8lJg6be58mzIpgX$tDlaPGJN1F_i0l8Hx< zeF8YqwVs)5{h7Xwj-NhQ)?;ZjAy*me!(Kd1q*WcTe* zJXQ%#^~uW(uLVR!8TTlnBYK~p-M>W{g2ncdB9?Lw0Xw55`IWZWo0S=xTT_skq9ZL|K(|VjQzA3-5YIUhcUHNXoqv__jQ7V4F3R zpNIt{>Ar~ASMqK4vj+1wR)ahXgePeD{3Orc6bD2U0!t@t^H*r_@Lwf;ES=bcS${P6 zh&;b1HjsmE8&ib$&f-?SOP+r$0&x#wyb!J1d-8J6#03(m@;7k#!Wi~|ynHEuW$E}q zY13O0#oIqxJzvS~|Wse}*KRSRPOV6C^xQf^a%)%x8{6bP@7rD=uOrL4a{1Zm>- z?dnI`Q>Dsr+Gp=pW~`v59%z}~^~|099<&(H&ASIX>(||_KrT7!0Oz-+eQq1^MMaR;hZOZ0O zuB1#n$#Y-NH8}IxO7d(|w6=C??-zATiu&aQgco6@y^(U_T-SY=(+d{vhDtdB(*$}< zL%GpD6}5+85z)3iKh)xkDQGdTomE<+G^!TOuqe dxwzjF{{hHptVeukgr5Ka002ovPDHLkV1mn4?i&CA literal 0 HcmV?d00001 diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index 7240be10c..bda6de7de 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:math'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -31,6 +32,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/roundedPluginCard.dart'; import 'package:polkawallet_ui/pages/v3/txConfirmPage.dart'; +import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/index.dart'; @@ -44,6 +46,8 @@ class StakingView extends StatefulWidget { } class _StakingViewState extends State { + bool _isInfoOpen = false; + Future _updateData() async { await widget.plugin.service.staking.queryMarketPrices(); widget.plugin.service.staking.updateStakingTxs(0); @@ -145,6 +149,21 @@ class _StakingViewState extends State { sumReward += Fmt.balanceDouble(data.amount!, decimals) * (data.eventId == 'Reward' ? 1.0 : -1.0); }); + + final blockDuration = + int.parse(widget.plugin.networkConst['babe']['expectedBlockTime']); + final unlockDetail = List.of( + widget.plugin.store.staking.ownStashInfo!.unbondings!['mapped']) + .map((e) { + return { + "balance": e[0], + "time": "${Fmt.blockToTime(e[1], blockDuration)}" + }; + }).toList(); + final lineNumber = unlockDetail.length % 2 > 0 + ? unlockDetail.length ~/ 2 + 1 + : unlockDetail.length ~/ 2; + return isDataLoading ? Column( children: [ @@ -162,120 +181,319 @@ class _StakingViewState extends State { children: [ ConnectionChecker(widget.plugin, onConnected: _updateData), - RoundedPluginCard( - padding: EdgeInsets.symmetric( - horizontal: 16, vertical: 20), - child: Column( + Container( + decoration: BoxDecoration( + borderRadius: const BorderRadius.all( + const Radius.circular(6)), + color: Color(0xFF3A3D40), + ), + child: Stack( + alignment: Alignment.bottomCenter, children: [ - Row( - children: [ - Expanded( + ClipRect( + child: Container( + height: _isInfoOpen ? 330 : 150, + padding: EdgeInsets.symmetric( + horizontal: 16, vertical: 20), child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Text("${dic['v3.myStaked']} ($symbol)", - style: labelStyle), - Text( - Fmt.priceFloorBigIntFormatter( - bonded, decimals, lengthMax: 4), - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith( - color: Colors.white, - fontSize: 22, - fontWeight: FontWeight.bold, - height: 2.0)), - Text( - "\$ ${Fmt.priceFloorFormatter(Fmt.bigIntToDouble(bonded, decimals) * marketPrice)}", - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith( - color: Colors.white, - fontSize: 10)), - ], - )), - Expanded( - child: GestureDetector( - onTap: () => Navigator.of(context) - .pushNamed( - RewardDetailNewPage.route), - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + children: [ + Row( children: [ - Text( - "${dic['v3.newGains']} ($symbol)", - style: labelStyle), - Text( - Fmt.priceFloorFormatter( - sumReward, - lengthMax: 4), - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith( - color: Colors.white, - fontSize: 22, - fontWeight: - FontWeight.bold, - height: 2.0)), - Text( - "\$ ${Fmt.priceFloorFormatter(sumReward * marketPrice)}", - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith( - color: Colors.white, - fontSize: 10)), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + "${dic['v3.myStaked']} ($symbol)", + style: labelStyle), + Text( + Fmt.priceFloorBigIntFormatter( + bonded, decimals, + lengthMax: 4), + style: Theme.of(context) + .textTheme + .headline5 + ?.copyWith( + color: Colors + .white, + fontSize: 22, + fontWeight: + FontWeight + .bold, + height: 2.0)), + Text( + "\$ ${Fmt.priceFloorFormatter(Fmt.bigIntToDouble(bonded, decimals) * marketPrice)}", + style: Theme.of(context) + .textTheme + .headline5 + ?.copyWith( + color: Colors + .white, + fontSize: 10)), + ], + )), + Expanded( + child: GestureDetector( + onTap: () => Navigator + .of(context) + .pushNamed( + RewardDetailNewPage + .route), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text( + "${dic['v3.newGains']} ($symbol)", + style: + labelStyle), + Text( + Fmt.priceFloorFormatter( + sumReward, + lengthMax: + 4), + style: Theme.of( + context) + .textTheme + .headline5 + ?.copyWith( + color: Colors + .white, + fontSize: + 22, + fontWeight: + FontWeight + .bold, + height: + 2.0)), + Text( + "\$ ${Fmt.priceFloorFormatter(sumReward * marketPrice)}", + style: Theme.of( + context) + .textTheme + .headline5 + ?.copyWith( + color: Colors + .white, + fontSize: + 10)), + ], + ))), ], - ))), - ], - ), - Padding( - padding: EdgeInsets.only(top: 10), - child: InfoItemRow( - dic['available']!, - "${Fmt.priceFloorBigIntFormatter(available, decimals, lengthMax: 4)} $symbol", - labelStyle: labelStyle, - contentStyle: labelStyle, - )), - InfoItemRow( - dic['v3.unstaking']!, - "${Fmt.priceFloorBigIntFormatter(unlocking, decimals, lengthMax: 4)} $symbol", - labelStyle: labelStyle, - contentStyle: labelStyle, - ), - InfoItemRow( - dic['bond.redeemable']!, - "${Fmt.priceFloorBigIntFormatter(redeemable, decimals, lengthMax: 4)} $symbol", - labelStyle: labelStyle, - contentStyle: labelStyle, - ), - InfoItemRow( - dic['v3.nominations']!, - "${widget.plugin.store.staking.ownStashInfo!.nominating!.length.toString()} ${dic['validators']}", - labelStyle: labelStyle, - contentStyle: labelStyle, - ), - InfoItemRow( - dic['v3.rewardDest']!, - widget.plugin.store.staking.ownStashInfo! - .destination! - .contains('account') - ? Fmt.address(jsonDecode(widget - .plugin - .store - .staking - .ownStashInfo! - .destination!)["account"]) - : widget.plugin.store.staking - .ownStashInfo!.destination!, - labelStyle: labelStyle, - contentStyle: labelStyle, - ) + ), + Padding( + padding: + EdgeInsets.only(top: 10), + child: InfoItemRow( + dic['available']!, + "${Fmt.priceFloorBigIntFormatter(available, decimals, lengthMax: 4)} $symbol", + labelStyle: labelStyle, + contentStyle: labelStyle, + )), + InfoItemRow( + dic['v3.unstaking']!, + "${Fmt.priceFloorBigIntFormatter(unlocking, decimals, lengthMax: 4)} $symbol", + labelStyle: labelStyle, + contentStyle: labelStyle, + ), + ListView.builder( + physics: + new NeverScrollableScrollPhysics(), + shrinkWrap: true, + itemCount: lineNumber, + itemBuilder: (context, index) { + final datas = + unlockDetail.sublist( + index * 2, + (index * 2 + 2) > + unlockDetail + .length + ? unlockDetail + .length + : index * 2 + 2); + return Row( + mainAxisAlignment: + MainAxisAlignment.end, + children: datas + .map((e) => + GestureDetector( + behavior: + HitTestBehavior + .opaque, + onTap: () async { + final params = + TxConfirmParams( + txTitle: + dic[ + 'action.rebond'], + module: + 'staking', + call: + 'rebond', + txDisplay: { + "amount": + '${Fmt.balance(e["balance"], decimals)} $symbol' + }, + params: [ + // "amount" + Fmt.tokenInt(e["balance"], decimals) + .toString(), + ], + isPlugin: + true); + final res = await Navigator.of( + context) + .pushNamed( + TxConfirmPage + .route, + arguments: + params); + if (res != + null) { + _updateData(); + } + }, + child: Container( + margin: EdgeInsets + .only( + left: + 17), + padding: EdgeInsets + .only( + bottom: + 3), + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .end, + children: [ + Row( + children: [ + Padding( + padding: + EdgeInsets.only(right: 5), + child: Image.asset("packages/polkawallet_plugin_kusama/assets/images/staking/icon_rebond.png", width: 16)), + Text( + "${Fmt.balance(e["balance"], decimals)} $symbol", + style: + labelStyle, + ) + ], + ), + Text( + e["time"]!, + style: labelStyle?.copyWith( + fontSize: + 10, + fontWeight: + FontWeight.w300), + ) + ], + ), + ))) + .toList(), + ); + }, + ), + InfoItemRow( + dic['bond.redeemable']!, + "${Fmt.priceFloorBigIntFormatter(redeemable, decimals, lengthMax: 4)} $symbol", + labelStyle: labelStyle, + contentStyle: labelStyle, + ), + InfoItemRow( + dic['v3.nominations']!, + "${widget.plugin.store.staking.ownStashInfo!.nominating!.length.toString()} ${dic['validators']}", + labelStyle: labelStyle, + contentStyle: labelStyle, + ), + InfoItemRow( + dic['v3.rewardDest']!, + widget + .plugin + .store + .staking + .ownStashInfo! + .destination! + .contains('account') + ? Fmt.address(jsonDecode( + widget + .plugin + .store + .staking + .ownStashInfo! + .destination!)[ + "account"]) + : widget + .plugin + .store + .staking + .ownStashInfo! + .destination!, + labelStyle: labelStyle, + contentStyle: labelStyle, + ) + ], + ))), + Align( + alignment: Alignment.bottomCenter, + child: Column( + children: [ + Visibility( + visible: !_isInfoOpen, + child: Container( + height: 26, + width: double.infinity, + decoration: BoxDecoration( + gradient: LinearGradient( + begin: + Alignment.topCenter, + end: Alignment + .bottomCenter, + stops: [ + 0.3, + 1.0 + ], + colors: [ + Color(0x00FF7849), + Color(0x3DFF7849) + ])), + )), + GestureDetector( + onTap: () { + setState(() { + _isInfoOpen = !_isInfoOpen; + }); + }, + child: Container( + height: 32, + decoration: BoxDecoration( + color: Color(0xFF626467), + borderRadius: + const BorderRadius.only( + bottomLeft: + Radius.circular( + 4), + bottomRight: + Radius.circular( + 4))), + child: Center( + child: Transform.rotate( + angle: _isInfoOpen ? pi : 0, + child: SvgPicture.asset( + "packages/polkawallet_ui/assets/images/triangle_bottom.svg", + color: _isInfoOpen + ? PluginColorsDark + .headline1 + : PluginColorsDark + .primary, + )), + ), + )) + ], + )) ], )), GridView.count( @@ -748,7 +966,6 @@ class _NomineeItem extends StatelessWidget { ], ), onTap: () { - print("onTap"); Navigator.of(context) .pushNamed(ValidatorDetailPage.route, arguments: validator); }, From 52100804b4f8225ae65781d05f636ccacf9b727a Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Mon, 30 May 2022 18:24:19 +0800 Subject: [PATCH 04/17] fix unbond bug --- lib/pages/staking/actions/bondExtraPage.dart | 5 +++-- lib/pages/staking/actions/unbondPage.dart | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pages/staking/actions/bondExtraPage.dart b/lib/pages/staking/actions/bondExtraPage.dart index 0b50f7e7d..ca0603dc8 100644 --- a/lib/pages/staking/actions/bondExtraPage.dart +++ b/lib/pages/staking/actions/bondExtraPage.dart @@ -157,10 +157,11 @@ class ErrorMessage extends StatelessWidget { child: error == null ? null : Row(children: [ - Text( + Expanded( + child: Text( error, style: TextStyle(fontSize: 12, color: Colors.red), - ) + )) ]), ); } diff --git a/lib/pages/staking/actions/unbondPage.dart b/lib/pages/staking/actions/unbondPage.dart index 268c167a8..26b1ce8a6 100644 --- a/lib/pages/staking/actions/unbondPage.dart +++ b/lib/pages/staking/actions/unbondPage.dart @@ -158,7 +158,7 @@ class _UnBondPageState extends State { return null; }, onFinish: (Map? res) { - if (res != null) { + if (res != null && _error != null) { Navigator.of(context).pop(res); } }, From a276ec301d7ad44f862ebac7198ef9bed1cf93ac Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Mon, 30 May 2022 18:25:52 +0800 Subject: [PATCH 05/17] fix bondExtra bug --- lib/pages/staking/actions/bondExtraPage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/staking/actions/bondExtraPage.dart b/lib/pages/staking/actions/bondExtraPage.dart index ca0603dc8..eba45836a 100644 --- a/lib/pages/staking/actions/bondExtraPage.dart +++ b/lib/pages/staking/actions/bondExtraPage.dart @@ -105,7 +105,7 @@ class _BondExtraPageState extends State { padding: EdgeInsets.all(16), child: PluginTxButton( getTxParams: () async { - if (_formKey.currentState!.validate()) { + if (_formKey.currentState!.validate() && _error1 != null) { final inputAmount = _amountCtrl.text.trim(); return TxConfirmParams( txTitle: dicStaking['action.bondExtra'], From 1f40b62fb5c6ec906182b86bbde0d70175bf7f8b Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Mon, 30 May 2022 18:47:17 +0800 Subject: [PATCH 06/17] fix bondExtra bug --- lib/pages/staking/actions/unbondPage.dart | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pages/staking/actions/unbondPage.dart b/lib/pages/staking/actions/unbondPage.dart index 26b1ce8a6..b889a0859 100644 --- a/lib/pages/staking/actions/unbondPage.dart +++ b/lib/pages/staking/actions/unbondPage.dart @@ -133,7 +133,8 @@ class _UnBondPageState extends State { child: PluginTxButton( getTxParams: () async { if (_formKey.currentState!.validate() && - _amountCtrl.text.trim().isNotEmpty) { + _amountCtrl.text.trim().isNotEmpty && + _error != null) { final inputAmount = _amountCtrl.text.trim(); return TxConfirmParams( txTitle: dicStaking['action.unbond'], @@ -158,7 +159,7 @@ class _UnBondPageState extends State { return null; }, onFinish: (Map? res) { - if (res != null && _error != null) { + if (res != null) { Navigator.of(context).pop(res); } }, From 4c1ead317644c80f162c3af0092360bddaa70db5 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 31 May 2022 19:32:01 +0800 Subject: [PATCH 07/17] fix bug --- lib/pages/staking/actions/bondExtraPage.dart | 2 +- lib/pages/staking/actions/unbondPage.dart | 2 +- lib/pages/stakingNew/stakingView.dart | 20 +++++++------------- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/lib/pages/staking/actions/bondExtraPage.dart b/lib/pages/staking/actions/bondExtraPage.dart index eba45836a..f151dc321 100644 --- a/lib/pages/staking/actions/bondExtraPage.dart +++ b/lib/pages/staking/actions/bondExtraPage.dart @@ -105,7 +105,7 @@ class _BondExtraPageState extends State { padding: EdgeInsets.all(16), child: PluginTxButton( getTxParams: () async { - if (_formKey.currentState!.validate() && _error1 != null) { + if (_formKey.currentState!.validate() && _error1 == null) { final inputAmount = _amountCtrl.text.trim(); return TxConfirmParams( txTitle: dicStaking['action.bondExtra'], diff --git a/lib/pages/staking/actions/unbondPage.dart b/lib/pages/staking/actions/unbondPage.dart index b889a0859..cd653ed75 100644 --- a/lib/pages/staking/actions/unbondPage.dart +++ b/lib/pages/staking/actions/unbondPage.dart @@ -134,7 +134,7 @@ class _UnBondPageState extends State { getTxParams: () async { if (_formKey.currentState!.validate() && _amountCtrl.text.trim().isNotEmpty && - _error != null) { + _error == null) { final inputAmount = _amountCtrl.text.trim(); return TxConfirmParams( txTitle: dicStaking['action.unbond'], diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index bda6de7de..e662cf651 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -192,9 +192,9 @@ class _StakingViewState extends State { children: [ ClipRect( child: Container( - height: _isInfoOpen ? 330 : 150, - padding: EdgeInsets.symmetric( - horizontal: 16, vertical: 20), + height: _isInfoOpen ? null : 150, + padding: + EdgeInsets.fromLTRB(16, 20, 16, 40), child: Column( children: [ Row( @@ -302,17 +302,11 @@ class _StakingViewState extends State { physics: new NeverScrollableScrollPhysics(), shrinkWrap: true, - itemCount: lineNumber, + itemCount: unlockDetail.length, itemBuilder: (context, index) { - final datas = - unlockDetail.sublist( - index * 2, - (index * 2 + 2) > - unlockDetail - .length - ? unlockDetail - .length - : index * 2 + 2); + final datas = [ + unlockDetail[index] + ]; return Row( mainAxisAlignment: MainAxisAlignment.end, From 3f484fa6029213ec6752f7e0c3e3f34e966d148c Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Wed, 8 Jun 2022 15:05:07 +0800 Subject: [PATCH 08/17] To deal with warning --- example/lib/pages/assetsContent.dart | 2 - example/lib/pages/homePage.dart | 18 +++---- example/lib/pages/selectListPage.dart | 1 - example/lib/pages/tx.dart | 1 - example/pubspec.lock | 29 +++++++----- lib/common/components/chartLabel.dart | 1 - .../governanceNew/candidateDetailPage.dart | 3 +- lib/pages/governanceNew/councilVotePage.dart | 2 - lib/pages/governanceNew/govExternalLinks.dart | 1 - lib/pages/governanceNew/governancePage.dart | 2 +- lib/pages/governanceNew/proposalPanel.dart | 1 - .../governanceNew/referendumVotePage.dart | 1 - lib/pages/governanceNew/treasuryPage.dart | 3 +- lib/pages/parasNew/auctionPanel.dart | 1 - lib/pages/parasNew/contributePage.dart | 4 +- lib/pages/parasNew/crowdLoanList.dart | 1 - lib/pages/parasNew/parasPage.dart | 3 +- lib/pages/staking/actions/bondExtraPage.dart | 5 -- lib/pages/staking/actions/bondPage.dart | 1 - .../staking/actions/controllerSelectPage.dart | 2 - lib/pages/staking/actions/nominateForm.dart | 2 +- lib/pages/staking/actions/payoutPage.dart | 3 +- lib/pages/staking/actions/redeemPage.dart | 4 -- .../staking/actions/setControllerPage.dart | 4 +- lib/pages/staking/actions/setPayeePage.dart | 1 - lib/pages/staking/actions/stakePage.dart | 4 +- lib/pages/staking/actions/unbondPage.dart | 4 +- .../staking/validators/nominatePage.dart | 1 - .../validators/validatorDetailPage.dart | 1 - lib/pages/stakingNew/RewardDetailPage.dart | 2 +- lib/pages/stakingNew/stakingHistoryPage.dart | 4 +- lib/pages/stakingNew/stakingView.dart | 4 -- lib/pages/stakingNew/validator.dart | 1 - pubspec.lock | 47 +++++++++++-------- pubspec.yaml | 10 ++-- 35 files changed, 68 insertions(+), 106 deletions(-) diff --git a/example/lib/pages/assetsContent.dart b/example/lib/pages/assetsContent.dart index 49e2fbb4e..330e5786f 100644 --- a/example/lib/pages/assetsContent.dart +++ b/example/lib/pages/assetsContent.dart @@ -1,6 +1,4 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_ui/components/borderedTitle.dart'; import 'package:polkawallet_ui/components/roundedCard.dart'; diff --git a/example/lib/pages/homePage.dart b/example/lib/pages/homePage.dart index f9af09c2b..b42f8a4a2 100644 --- a/example/lib/pages/homePage.dart +++ b/example/lib/pages/homePage.dart @@ -31,18 +31,12 @@ class _MyHomePageState extends State { return items.map((e) { final active = items[_tabIndex].text == e.text; return BottomNavigationBarItem( - icon: SizedBox( - child: active ? e.iconActive : e.icon, - width: 32, - height: 32, - ), - title: Text( - e.text, - style: TextStyle( - fontSize: 14, - color: active ? Theme.of(context).primaryColor : Colors.grey), - ), - ); + icon: SizedBox( + child: active ? e.iconActive : e.icon, + width: 32, + height: 32, + ), + label: e.text); }).toList(); } diff --git a/example/lib/pages/selectListPage.dart b/example/lib/pages/selectListPage.dart index 339be0dc3..0a5ccb86a 100644 --- a/example/lib/pages/selectListPage.dart +++ b/example/lib/pages/selectListPage.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ListItemData { diff --git a/example/lib/pages/tx.dart b/example/lib/pages/tx.dart index fdb62b6ad..3cc9cdccb 100644 --- a/example/lib/pages/tx.dart +++ b/example/lib/pages/tx.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; diff --git a/example/pubspec.lock b/example/pubspec.lock index b285f836f..d60230fb2 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -35,7 +35,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -56,7 +56,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" convert: dependency: transitive description: @@ -281,7 +281,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: transitive description: @@ -296,6 +296,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: @@ -323,7 +330,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_drawing: dependency: transitive description: @@ -428,14 +435,14 @@ packages: name: polkawallet_sdk url: "https://pub.dartlang.org" source: hosted - version: "0.4.6" + version: "0.4.7" polkawallet_ui: dependency: "direct main" description: - path: "../../ui" - relative: true - source: path - version: "0.4.6" + name: polkawallet_ui + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.7" process: dependency: transitive description: @@ -622,7 +629,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" webview_flutter: dependency: transitive description: @@ -673,5 +680,5 @@ packages: source: hosted version: "5.3.1" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.5.0" diff --git a/lib/common/components/chartLabel.dart b/lib/common/components/chartLabel.dart index b54dd7316..2ded632b7 100644 --- a/lib/common/components/chartLabel.dart +++ b/lib/common/components/chartLabel.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class ChartLabel extends StatelessWidget { diff --git a/lib/pages/governanceNew/candidateDetailPage.dart b/lib/pages/governanceNew/candidateDetailPage.dart index db9d55e4c..a442ca56c 100644 --- a/lib/pages/governanceNew/candidateDetailPage.dart +++ b/lib/pages/governanceNew/candidateDetailPage.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_kusama/pages/governanceNew/councilPage.dart'; @@ -29,7 +28,7 @@ class _CandidateDetailPageState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { if (widget.plugin.store.gov.councilVotes != null) { final List info = ModalRoute.of(context)!.settings.arguments as List; diff --git a/lib/pages/governanceNew/councilVotePage.dart b/lib/pages/governanceNew/councilVotePage.dart index 247125401..c16ca1b94 100644 --- a/lib/pages/governanceNew/councilVotePage.dart +++ b/lib/pages/governanceNew/councilVotePage.dart @@ -1,6 +1,5 @@ import 'dart:math'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/bondExtraPage.dart'; @@ -10,7 +9,6 @@ import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/infoItemRow.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; diff --git a/lib/pages/governanceNew/govExternalLinks.dart b/lib/pages/governanceNew/govExternalLinks.dart index 7224787d6..884ce3c2d 100644 --- a/lib/pages/governanceNew/govExternalLinks.dart +++ b/lib/pages/governanceNew/govExternalLinks.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_ui/utils/index.dart'; diff --git a/lib/pages/governanceNew/governancePage.dart b/lib/pages/governanceNew/governancePage.dart index 1ab27cb0d..2b4bbfb36 100644 --- a/lib/pages/governanceNew/governancePage.dart +++ b/lib/pages/governanceNew/governancePage.dart @@ -139,7 +139,7 @@ class _GovernancePageState extends State { widget.plugin.service.gov.subscribeBestNumber(); } - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _refreshKey.currentState!.show(); }); } diff --git a/lib/pages/governanceNew/proposalPanel.dart b/lib/pages/governanceNew/proposalPanel.dart index 455fb3233..7b7e26c34 100644 --- a/lib/pages/governanceNew/proposalPanel.dart +++ b/lib/pages/governanceNew/proposalPanel.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; diff --git a/lib/pages/governanceNew/referendumVotePage.dart b/lib/pages/governanceNew/referendumVotePage.dart index fdf4cd0e0..36187da3f 100644 --- a/lib/pages/governanceNew/referendumVotePage.dart +++ b/lib/pages/governanceNew/referendumVotePage.dart @@ -9,7 +9,6 @@ import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/api/types/gov/referendumInfoData.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTagCard.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; diff --git a/lib/pages/governanceNew/treasuryPage.dart b/lib/pages/governanceNew/treasuryPage.dart index 9d5607c0f..78998e3b2 100644 --- a/lib/pages/governanceNew/treasuryPage.dart +++ b/lib/pages/governanceNew/treasuryPage.dart @@ -1,6 +1,5 @@ import 'dart:math'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_kusama/common/constants.dart'; @@ -95,7 +94,7 @@ class _TreasuryPageState extends State { @override void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _refreshKey.currentState?.show(); }); } diff --git a/lib/pages/parasNew/auctionPanel.dart b/lib/pages/parasNew/auctionPanel.dart index 6b94904b1..50222a6e7 100644 --- a/lib/pages/parasNew/auctionPanel.dart +++ b/lib/pages/parasNew/auctionPanel.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:polkawallet_sdk/api/types/parachain/auctionData.dart'; diff --git a/lib/pages/parasNew/contributePage.dart b/lib/pages/parasNew/contributePage.dart index 2e9f46c5a..f40fd7411 100644 --- a/lib/pages/parasNew/contributePage.dart +++ b/lib/pages/parasNew/contributePage.dart @@ -1,6 +1,5 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_svg/svg.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; @@ -14,7 +13,6 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginInputItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTagCard.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; -import 'package:polkawallet_ui/components/v3/txButton.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/index.dart'; @@ -85,7 +83,7 @@ class _ContributePageState extends State { void initState() { super.initState(); - WidgetsBinding.instance?.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _getTxFee(); }); } diff --git a/lib/pages/parasNew/crowdLoanList.dart b/lib/pages/parasNew/crowdLoanList.dart index 8b228716e..9a7259fe8 100644 --- a/lib/pages/parasNew/crowdLoanList.dart +++ b/lib/pages/parasNew/crowdLoanList.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:polkawallet_sdk/api/types/parachain/fundData.dart'; diff --git a/lib/pages/parasNew/parasPage.dart b/lib/pages/parasNew/parasPage.dart index 11be582e2..8205ad953 100644 --- a/lib/pages/parasNew/parasPage.dart +++ b/lib/pages/parasNew/parasPage.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_kusama/common/constants.dart'; @@ -101,7 +100,7 @@ class _ParasPageState extends State { void initState() { super.initState(); - WidgetsBinding.instance?.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _getCrowdLoans(); }); } diff --git a/lib/pages/staking/actions/bondExtraPage.dart b/lib/pages/staking/actions/bondExtraPage.dart index f151dc321..738c1b2d9 100644 --- a/lib/pages/staking/actions/bondExtraPage.dart +++ b/lib/pages/staking/actions/bondExtraPage.dart @@ -1,20 +1,15 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/addressFormItem.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; -import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; -import 'package:polkawallet_ui/utils/index.dart'; class BondExtraPage extends StatefulWidget { BondExtraPage(this.plugin, this.keyring); diff --git a/lib/pages/staking/actions/bondPage.dart b/lib/pages/staking/actions/bondPage.dart index 155b1dd2f..c240a5bc2 100644 --- a/lib/pages/staking/actions/bondPage.dart +++ b/lib/pages/staking/actions/bondPage.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/setPayeePage.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; diff --git a/lib/pages/staking/actions/controllerSelectPage.dart b/lib/pages/staking/actions/controllerSelectPage.dart index 65a5c051f..2039c3b04 100644 --- a/lib/pages/staking/actions/controllerSelectPage.dart +++ b/lib/pages/staking/actions/controllerSelectPage.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; @@ -6,7 +5,6 @@ import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/addressIcon.dart'; -import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/format.dart'; diff --git a/lib/pages/staking/actions/nominateForm.dart b/lib/pages/staking/actions/nominateForm.dart index 02c7c3501..aefab223c 100644 --- a/lib/pages/staking/actions/nominateForm.dart +++ b/lib/pages/staking/actions/nominateForm.dart @@ -215,7 +215,7 @@ class _NominateFormState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { setState(() { widget.plugin.store.staking.validatorsInfo.forEach((i) { _notSelected.add(i); diff --git a/lib/pages/staking/actions/payoutPage.dart b/lib/pages/staking/actions/payoutPage.dart index b106fb078..e3be9e3d5 100644 --- a/lib/pages/staking/actions/payoutPage.dart +++ b/lib/pages/staking/actions/payoutPage.dart @@ -5,7 +5,6 @@ import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; import 'package:polkawallet_ui/components/v3/addressIcon.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; @@ -115,7 +114,7 @@ class _PayoutPageState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _queryLatestRewards(); }); } diff --git a/lib/pages/staking/actions/redeemPage.dart b/lib/pages/staking/actions/redeemPage.dart index f2a46c54a..cc507972c 100644 --- a/lib/pages/staking/actions/redeemPage.dart +++ b/lib/pages/staking/actions/redeemPage.dart @@ -1,13 +1,9 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/addressFormItem.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; -import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; diff --git a/lib/pages/staking/actions/setControllerPage.dart b/lib/pages/staking/actions/setControllerPage.dart index ef39197bd..79d0eeece 100644 --- a/lib/pages/staking/actions/setControllerPage.dart +++ b/lib/pages/staking/actions/setControllerPage.dart @@ -1,12 +1,10 @@ import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/controllerSelectPage.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/storage/types/keyPairData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; @@ -36,7 +34,7 @@ class _SetControllerPageState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { final KeyPairData? acc = ModalRoute.of(context)!.settings.arguments as KeyPairData?; setState(() { diff --git a/lib/pages/staking/actions/setPayeePage.dart b/lib/pages/staking/actions/setPayeePage.dart index 398e532f8..fc4330cd8 100644 --- a/lib/pages/staking/actions/setPayeePage.dart +++ b/lib/pages/staking/actions/setPayeePage.dart @@ -9,7 +9,6 @@ import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/storage/types/keyPairData.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/textTag.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressTextFormField.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputItem.dart'; diff --git a/lib/pages/staking/actions/stakePage.dart b/lib/pages/staking/actions/stakePage.dart index 768ef91e5..922dc8742 100644 --- a/lib/pages/staking/actions/stakePage.dart +++ b/lib/pages/staking/actions/stakePage.dart @@ -1,6 +1,5 @@ import 'dart:convert'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/bondPage.dart'; @@ -10,7 +9,6 @@ import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/txButton.dart'; -import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginIconButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/pages/v3/txConfirmPage.dart'; @@ -59,7 +57,7 @@ class _StakePageState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { widget.plugin.service.staking.queryElectedInfo(); }); } diff --git a/lib/pages/staking/actions/unbondPage.dart b/lib/pages/staking/actions/unbondPage.dart index cd653ed75..966b044e0 100644 --- a/lib/pages/staking/actions/unbondPage.dart +++ b/lib/pages/staking/actions/unbondPage.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/bondExtraPage.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; @@ -6,7 +5,6 @@ import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/plugin/store/balances.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/txButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginAddressFormItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; @@ -44,7 +42,7 @@ class _UnBondPageState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { _queryMinNominate(); }); } diff --git a/lib/pages/staking/validators/nominatePage.dart b/lib/pages/staking/validators/nominatePage.dart index 92f92a8a4..53ce7daba 100644 --- a/lib/pages/staking/validators/nominatePage.dart +++ b/lib/pages/staking/validators/nominatePage.dart @@ -8,7 +8,6 @@ import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; import 'package:polkawallet_sdk/storage/keyring.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/txButton.dart'; -import 'package:polkawallet_ui/components/v3/back.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/pages/v3/txConfirmPage.dart'; diff --git a/lib/pages/staking/validators/validatorDetailPage.dart b/lib/pages/staking/validators/validatorDetailPage.dart index 44feec347..ef322b5b6 100644 --- a/lib/pages/staking/validators/validatorDetailPage.dart +++ b/lib/pages/staking/validators/validatorDetailPage.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:intl/intl.dart'; diff --git a/lib/pages/stakingNew/RewardDetailPage.dart b/lib/pages/stakingNew/RewardDetailPage.dart index 39217d849..b3bf46925 100644 --- a/lib/pages/stakingNew/RewardDetailPage.dart +++ b/lib/pages/stakingNew/RewardDetailPage.dart @@ -35,7 +35,7 @@ class _RewardDetailNewPageState extends State { void initState() { super.initState(); - WidgetsBinding.instance!.addPostFrameCallback((_) async { + WidgetsBinding.instance.addPostFrameCallback((_) async { if (widget.plugin.store.staking.txsRewards.length == 0) { setState(() { _isLoading = true; diff --git a/lib/pages/stakingNew/stakingHistoryPage.dart b/lib/pages/stakingNew/stakingHistoryPage.dart index 05ad90e27..91270542e 100644 --- a/lib/pages/stakingNew/stakingHistoryPage.dart +++ b/lib/pages/stakingNew/stakingHistoryPage.dart @@ -4,9 +4,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/stakingDetailPage.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; -import 'package:polkawallet_sdk/api/subscan.dart'; import 'package:polkawallet_sdk/utils/i18n.dart'; -import 'package:polkawallet_ui/components/TransferIcon.dart'; import 'package:polkawallet_ui/components/listTail.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/format.dart'; @@ -70,7 +68,7 @@ class _StakingHistoryPageState extends State { } }); - WidgetsBinding.instance!.addPostFrameCallback((_) { + WidgetsBinding.instance.addPostFrameCallback((_) { if (widget.plugin.store.staking.txs.length < tx_list_page_size) { _updateStakingTxs(page: 0); } diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index e662cf651..cab82df87 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -30,7 +30,6 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginOutlinedButtonSmall.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; -import 'package:polkawallet_ui/components/v3/plugin/roundedPluginCard.dart'; import 'package:polkawallet_ui/pages/v3/txConfirmPage.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; @@ -160,9 +159,6 @@ class _StakingViewState extends State { "time": "${Fmt.blockToTime(e[1], blockDuration)}" }; }).toList(); - final lineNumber = unlockDetail.length % 2 > 0 - ? unlockDetail.length ~/ 2 + 1 - : unlockDetail.length ~/ 2; return isDataLoading ? Column( diff --git a/lib/pages/stakingNew/validator.dart b/lib/pages/stakingNew/validator.dart index d09208283..12683b11b 100644 --- a/lib/pages/stakingNew/validator.dart +++ b/lib/pages/stakingNew/validator.dart @@ -1,4 +1,3 @@ -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/validators/validatorDetailPage.dart'; diff --git a/pubspec.lock b/pubspec.lock index 9e0619f7e..2b717b5da 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,13 +8,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "22.0.0" - aes_ecb_pkcs5_flutter: - dependency: transitive - description: - name: aes_ecb_pkcs5_flutter - url: "https://pub.dartlang.org" - source: hosted - version: "0.1.2" analyzer: dependency: transitive description: @@ -35,7 +28,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" auth_header: dependency: transitive description: @@ -119,7 +112,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -161,7 +154,7 @@ packages: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0" + version: "1.16.0" convert: dependency: transitive description: @@ -217,7 +210,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.0" ffi: dependency: transitive description: @@ -251,6 +244,13 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_aes_ecb_pkcs5: + dependency: transitive + description: + name: flutter_aes_ecb_pkcs5 + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2" flutter_inappwebview: dependency: transitive description: @@ -442,7 +442,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.3" + version: "0.6.4" json_annotation: dependency: "direct main" description: @@ -470,7 +470,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" meta: dependency: transitive description: @@ -512,7 +519,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" path_drawing: dependency: transitive description: @@ -617,14 +624,14 @@ packages: path: "../sdk" relative: true source: path - version: "0.4.6" + version: "0.4.7" polkawallet_ui: dependency: "direct main" description: path: "../ui" relative: true source: path - version: "0.4.6" + version: "0.4.7" pool: dependency: transitive description: @@ -762,7 +769,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.2" stack_trace: dependency: transitive description: @@ -811,7 +818,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.9" timing: dependency: transitive description: @@ -881,7 +888,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.2" watcher: dependency: transitive description: @@ -953,5 +960,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.14.0 <3.0.0" + dart: ">=2.17.0-0 <3.0.0" flutter: ">=2.5.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1194ec0d3..e7e3c651f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -30,11 +30,11 @@ dev_dependencies: flutter_test: sdk: flutter -#dependency_overrides: -# polkawallet_ui: -# path: ../ui -# polkawallet_sdk: -# path: ../sdk +dependency_overrides: + polkawallet_ui: + path: ../ui + polkawallet_sdk: + path: ../sdk # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From ce6565063f4fbf1f28dbcfc26c75d3f9037b34dc Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Thu, 9 Jun 2022 15:28:32 +0800 Subject: [PATCH 09/17] Restake on STAKING stats panel #135 #151 --- lib/pages/stakingNew/rebondPage.dart | 190 ++++++++++++++++++++++++++ lib/pages/stakingNew/stakingView.dart | 172 +++++++++++------------ lib/polkawallet_plugin_kusama.dart | 2 + lib/utils/i18n/en/staking.dart | 6 +- lib/utils/i18n/zh/staking.dart | 6 +- 5 files changed, 278 insertions(+), 98 deletions(-) create mode 100644 lib/pages/stakingNew/rebondPage.dart diff --git a/lib/pages/stakingNew/rebondPage.dart b/lib/pages/stakingNew/rebondPage.dart new file mode 100644 index 000000000..1df9224d4 --- /dev/null +++ b/lib/pages/stakingNew/rebondPage.dart @@ -0,0 +1,190 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:flutter_mobx/flutter_mobx.dart'; +import 'package:polkawallet_plugin_kusama/pages/staking/actions/bondExtraPage.dart'; +import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; +import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; +import 'package:polkawallet_sdk/plugin/store/balances.dart'; +import 'package:polkawallet_sdk/utils/i18n.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginButton.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginInputBalance.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; +import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; +import 'package:polkawallet_ui/pages/v3/txConfirmPage.dart'; +import 'package:polkawallet_ui/utils/format.dart'; + +class RebondPage extends StatefulWidget { + RebondPage(this.plugin, {Key? key}) : super(key: key); + final PluginKusama plugin; + + static final String route = '/staking/rebond'; + + @override + State createState() => _RebondPageState(); +} + +class _RebondPageState extends State { + final TextEditingController _amountCtrl = new TextEditingController(); + String? _error; + + @override + Widget build(BuildContext context) { + final dic = I18n.of(context)!.getDic(i18n_full_dic_kusama, 'staking')!; + final symbol = (widget.plugin.networkState.tokenSymbol ?? ['DOT'])[0]; + final decimals = (widget.plugin.networkState.tokenDecimals ?? [12])[0]; + final labelStyle = Theme.of(context) + .textTheme + .headline5 + ?.copyWith(color: Colors.white, fontWeight: FontWeight.bold); + + List> unlockDetail = ModalRoute.of(context)! + .settings + .arguments as List>; + return PluginScaffold( + appBar: PluginAppBar(title: Text(dic['action.rebond']!)), + body: Observer(builder: (_) { + BigInt redeemable = BigInt.zero; + if (widget.plugin.store.staking.ownStashInfo!.stakingLedger != null) { + redeemable = BigInt.parse(widget + .plugin.store.staking.ownStashInfo!.account!.redeemable + .toString()); + } + BigInt unlocking = widget.plugin.store.staking.accountUnlockingTotal; + unlocking -= redeemable; + return Column( + children: [ + PluginInputBalance( + margin: EdgeInsets.only(top: 10, left: 16, right: 16), + titleTag: dic['v3.rebondAmount'], + balance: TokenBalanceData( + symbol: symbol, + decimals: decimals, + amount: unlocking.toString()), + inputCtrl: _amountCtrl, + tokenIconsMap: widget.plugin.tokenIcons, + onClear: () { + setState(() { + _amountCtrl.text = ""; + }); + }, + onSetMax: (amount) { + setState(() { + _amountCtrl.text = + Fmt.balance(unlocking.toString(), decimals); + }); + }, + onInputChange: (value) { + var error = Fmt.validatePrice(value, context); + if (error == null) { + final amount = double.parse(value.trim()); + if (amount >= + unlocking / BigInt.from(pow(10, decimals)) - 0.001) { + error = dic['amount.low']; + } + } + setState(() { + _error = error; + }); + }, + ), + ErrorMessage( + _error, + margin: EdgeInsets.symmetric(horizontal: 16), + ), + Padding( + padding: + EdgeInsets.only(top: 18, left: 16, right: 16, bottom: 16), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(dic['v3.totalUnbonding']!, style: labelStyle), + Text( + "${Fmt.priceFloorBigIntFormatter(unlocking, decimals, lengthMax: 4)} $symbol ${unlockDetail.length > 0 ? "(${unlockDetail.length})" : ""}", + style: labelStyle) + ], + ), + ), + Expanded( + child: ListView.separated( + itemBuilder: (context, index) => Container( + padding: EdgeInsets.symmetric( + horizontal: 31, vertical: 8), + color: Color(0x1AFFFFFF), + child: Row( + children: [ + Container( + width: 30, + height: 30, + margin: EdgeInsets.only(right: 10), + child: widget.plugin + .tokenIcons[symbol.toUpperCase()]!), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "${Fmt.balance(unlockDetail[index]["balance"], decimals)} $symbol", + style: labelStyle, + ), + Row( + children: [ + Padding( + padding: EdgeInsets.only(right: 3), + child: Image.asset( + "packages/polkawallet_plugin_kusama/assets/images/staking/icon_rebond.png", + width: 8)), + Text( + unlockDetail[index]["time"]!, + style: labelStyle?.copyWith( + fontSize: 10, + fontWeight: FontWeight.w300), + ) + ], + ) + ], + ) + ], + ), + ), + separatorBuilder: (context, index) => Container( + padding: EdgeInsets.symmetric(horizontal: 16), + color: Color(0x1AFFFFFF), + child: Divider( + height: 1, + color: Colors.white.withAlpha(36), + ), + ), + itemCount: unlockDetail.length)), + Padding( + padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), + child: PluginButton( + title: dic['action.rebond']!, + onPressed: () async { + if (_error == null && + _amountCtrl.text.trim().isNotEmpty) { + final params = TxConfirmParams( + txTitle: dic['action.rebond'], + module: 'staking', + call: 'rebond', + txDisplay: { + "amount": '${_amountCtrl.text} $symbol' + }, + params: [ + // "amount" + Fmt.tokenInt(_amountCtrl.text, decimals) + .toString() + ], + isPlugin: true); + final res = await Navigator.of(context) + .pushNamed(TxConfirmPage.route, arguments: params); + if (res != null) { + Navigator.of(context).pop(true); + } + } + }, + )) + ], + ); + })); + } +} diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index cab82df87..7b9375170 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -16,6 +16,7 @@ import 'package:polkawallet_plugin_kusama/pages/staking/validators/nominatePage. import 'package:polkawallet_plugin_kusama/pages/staking/validators/validatorDetailPage.dart'; import 'package:polkawallet_plugin_kusama/pages/stakingNew/RewardDetailPage.dart'; import 'package:polkawallet_plugin_kusama/pages/stakingNew/overViewPage.dart'; +import 'package:polkawallet_plugin_kusama/pages/stakingNew/rebondPage.dart'; import 'package:polkawallet_plugin_kusama/polkawallet_plugin_kusama.dart'; import 'package:polkawallet_plugin_kusama/store/staking/types/validatorData.dart'; import 'package:polkawallet_plugin_kusama/utils/i18n/index.dart'; @@ -288,105 +289,88 @@ class _StakingViewState extends State { labelStyle: labelStyle, contentStyle: labelStyle, )), - InfoItemRow( - dic['v3.unstaking']!, - "${Fmt.priceFloorBigIntFormatter(unlocking, decimals, lengthMax: 4)} $symbol", - labelStyle: labelStyle, - contentStyle: labelStyle, - ), - ListView.builder( - physics: - new NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: unlockDetail.length, - itemBuilder: (context, index) { - final datas = [ - unlockDetail[index] - ]; - return Row( - mainAxisAlignment: - MainAxisAlignment.end, - children: datas - .map((e) => - GestureDetector( - behavior: - HitTestBehavior - .opaque, - onTap: () async { - final params = - TxConfirmParams( - txTitle: - dic[ - 'action.rebond'], - module: - 'staking', - call: - 'rebond', - txDisplay: { - "amount": - '${Fmt.balance(e["balance"], decimals)} $symbol' - }, - params: [ - // "amount" - Fmt.tokenInt(e["balance"], decimals) - .toString(), - ], - isPlugin: - true); - final res = await Navigator.of( - context) - .pushNamed( - TxConfirmPage - .route, - arguments: - params); - if (res != - null) { - _updateData(); - } - }, - child: Container( + GestureDetector( + onTap: () async { + final res = + await Navigator.of( + context) + .pushNamed( + RebondPage.route, + arguments: + unlockDetail); + if (res != null) { + _updateData(); + } + }, + child: Padding( + padding: EdgeInsets.symmetric( + vertical: 2), + child: Row( + crossAxisAlignment: + CrossAxisAlignment + .start, + children: [ + Text(dic['v3.unstaking']!, + style: labelStyle), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment + .end, + children: [ + Container( + decoration: + BoxDecoration( + color: + PluginColorsDark + .green, + borderRadius: + BorderRadius.all( + Radius.circular( + 4.0)), + ), margin: EdgeInsets - .only( - left: - 17), - padding: EdgeInsets .only( bottom: 3), - child: Column( - crossAxisAlignment: - CrossAxisAlignment - .end, - children: [ - Row( - children: [ - Padding( - padding: - EdgeInsets.only(right: 5), - child: Image.asset("packages/polkawallet_plugin_kusama/assets/images/staking/icon_rebond.png", width: 16)), - Text( - "${Fmt.balance(e["balance"], decimals)} $symbol", - style: - labelStyle, - ) - ], - ), - Text( - e["time"]!, - style: labelStyle?.copyWith( + padding: + EdgeInsets + .fromLTRB( + 14, + 2, + 9, + 2), + child: Text( + "${Fmt.priceFloorBigIntFormatter(unlocking, decimals, lengthMax: 4)} $symbol ${unlockDetail.length > 0 ? "(${unlockDetail.length})" : ""}", + style: labelStyle?.copyWith( + fontWeight: + FontWeight + .bold, + color: Colors + .black))), + Visibility( + visible: + unlockDetail + .length > + 0, + child: Text( + I18n.of(context)! + .locale + .languageCode == + 'zh' + ? "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol 将于${unlockDetail[0]['time']}后可提取" + : "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol can be redeemed in ${unlockDetail[0]['time']}", + style: labelStyle + ?.copyWith( fontSize: - 10, - fontWeight: - FontWeight.w300), - ) - ], - ), - ))) - .toList(), - ); - }, - ), + 10), + )) + ], + ), + ), + ], + ), + )), InfoItemRow( dic['bond.redeemable']!, "${Fmt.priceFloorBigIntFormatter(redeemable, decimals, lengthMax: 4)} $symbol", diff --git a/lib/polkawallet_plugin_kusama.dart b/lib/polkawallet_plugin_kusama.dart index ba3a26988..20bd00f11 100644 --- a/lib/polkawallet_plugin_kusama.dart +++ b/lib/polkawallet_plugin_kusama.dart @@ -28,6 +28,7 @@ import 'package:polkawallet_plugin_kusama/pages/staking/validators/validatorChar import 'package:polkawallet_plugin_kusama/pages/staking/validators/validatorDetailPage.dart'; import 'package:polkawallet_plugin_kusama/pages/stakingNew/RewardDetailPage.dart'; import 'package:polkawallet_plugin_kusama/pages/stakingNew/overViewPage.dart'; +import 'package:polkawallet_plugin_kusama/pages/stakingNew/rebondPage.dart'; import 'package:polkawallet_plugin_kusama/pages/stakingNew/stakingHistoryPage.dart'; import 'package:polkawallet_plugin_kusama/pages/stakingNew/stakingPage.dart'; import 'package:polkawallet_plugin_kusama/service/index.dart'; @@ -137,6 +138,7 @@ class PluginKusama extends PolkawalletPlugin { StakingHistoryPage.route: (_) => StakingHistoryPage(this), OverViewPage.route: (_) => OverViewPage(this), RewardDetailNewPage.route: (_) => RewardDetailNewPage(this), + RebondPage.route: (_) => RebondPage(this), // governance pages GovernancePage.route: (_) => GovernancePage(this, keyring), diff --git a/lib/utils/i18n/en/staking.dart b/lib/utils/i18n/en/staking.dart index ec7ac9165..71d2a1c2e 100644 --- a/lib/utils/i18n/en/staking.dart +++ b/lib/utils/i18n/en/staking.dart @@ -106,7 +106,7 @@ const Map enStaking = { 'v3.goStake': 'Go Stake', 'v3.myStaked': 'My Staked', 'v3.newGains': 'New Gains', - 'v3.unstaking': 'Unstaking', + 'v3.unstaking': 'Unbonding', 'v3.nominations': 'Nominations', 'v3.rewardDest': 'Reward Method', 'v3.rewardDetail': 'Reward Detail', @@ -120,5 +120,7 @@ const Map enStaking = { 'Limited permissions as the current account is not controller account.', 'v3.noNomination': 'No nomination here, nominate validators right now to enjoy the staking and earn your rewards!', - 'v3.noStaked': 'You have not staked yet' + 'v3.noStaked': 'You have not staked yet', + 'v3.totalUnbonding': 'Total Unbonding', + 'v3.rebondAmount': 'Rebond amount' }; diff --git a/lib/utils/i18n/zh/staking.dart b/lib/utils/i18n/zh/staking.dart index 553fd0cb5..1b8037d0d 100644 --- a/lib/utils/i18n/zh/staking.dart +++ b/lib/utils/i18n/zh/staking.dart @@ -99,7 +99,7 @@ const Map zhStaking = { 'v3.goStake': '去质押', 'v3.myStaked': '我的质押', 'v3.newGains': '最近收益', - 'v3.unstaking': '解锁中', + 'v3.unstaking': '解绑中', 'v3.nominations': '提名', 'v3.rewardDest': '分红方式', 'v3.rewardDetail': '收益详情', @@ -110,5 +110,7 @@ const Map zhStaking = { 'v3.controllerError': '当前账号不是储值帐号,权限受限。', 'v3.stashError': '当前账号不是控制帐号,权限受限。', 'v3.noNomination': '当前暂无提名,赶紧提名验证人来享受质押获得收益吧!', - 'v3.noStaked': '你还没质押呢' + 'v3.noStaked': '你还没质押呢', + 'v3.totalUnbonding': '总解绑中', + 'v3.rebondAmount': '重新绑定数量' }; From 02893b1ef8cbb419954ebd3bf1aa69ccfb5f83e5 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 14 Jun 2022 14:19:16 +0800 Subject: [PATCH 10/17] update PluginTextTag --- lib/pages/governanceNew/councilPage.dart | 3 --- lib/pages/stakingNew/RewardDetailPage.dart | 1 - lib/pages/stakingNew/stakingView.dart | 1 - 3 files changed, 5 deletions(-) diff --git a/lib/pages/governanceNew/councilPage.dart b/lib/pages/governanceNew/councilPage.dart index 0a8e41be7..c9b1eabd6 100644 --- a/lib/pages/governanceNew/councilPage.dart +++ b/lib/pages/governanceNew/councilPage.dart @@ -274,7 +274,6 @@ class _CouncilPageState extends State { crossAxisAlignment: CrossAxisAlignment.end, children: [ PluginTextTag( - padding: EdgeInsets.zero, margin: EdgeInsets.only(left: 16), title: dic['member']!, ), @@ -362,7 +361,6 @@ class _CouncilPageState extends State { ), ), PluginTextTag( - padding: EdgeInsets.zero, margin: EdgeInsets.only(left: 16, top: 15), title: dic['up']!, ), @@ -424,7 +422,6 @@ class _CouncilPageState extends State { ), ), PluginTextTag( - padding: EdgeInsets.zero, margin: EdgeInsets.only(left: 16, top: 15), title: dic['candidate']!, ), diff --git a/lib/pages/stakingNew/RewardDetailPage.dart b/lib/pages/stakingNew/RewardDetailPage.dart index b3bf46925..5cf6f367c 100644 --- a/lib/pages/stakingNew/RewardDetailPage.dart +++ b/lib/pages/stakingNew/RewardDetailPage.dart @@ -146,7 +146,6 @@ class _RewardDetailNewPageState extends State { children: [ PluginTextTag( margin: EdgeInsets.only(top: 22, left: 16), - padding: EdgeInsets.zero, title: dic['txs.reward']!), Container( color: Color(0x1AFFFFFF), diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index 7b9375170..16ae3d969 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -646,7 +646,6 @@ class _StakingViewState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ PluginTextTag( - padding: EdgeInsets.zero, title: dic['v3.nominations']!, child: Row( children: [ From 488c0e04b22170535efddfe004f1a48d7ad1f5ce Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 14 Jun 2022 15:08:53 +0800 Subject: [PATCH 11/17] ui update --- lib/pages/governanceNew/governancePage.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/governanceNew/governancePage.dart b/lib/pages/governanceNew/governancePage.dart index 2b4bbfb36..3e38562dd 100644 --- a/lib/pages/governanceNew/governancePage.dart +++ b/lib/pages/governanceNew/governancePage.dart @@ -475,7 +475,7 @@ class _GovernancePageState extends State { padding: EdgeInsets.symmetric(horizontal: 16), child: StickyHeader( header: Container( - color: Color.fromARGB(255, 37, 39, 44), + color: Colors.transparent, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ From 5a6bfc820c5a1bbf8652cb294ae913a0d5421e96 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 14 Jun 2022 17:14:42 +0800 Subject: [PATCH 12/17] update fontSize --- .../governanceNew/candidateDetailPage.dart | 3 +- lib/pages/governanceNew/councilPage.dart | 14 ++--- lib/pages/governanceNew/councilVotePage.dart | 4 +- lib/pages/governanceNew/govExternalLinks.dart | 2 +- lib/pages/governanceNew/governancePage.dart | 32 ++++++----- lib/pages/governanceNew/proposalPanel.dart | 8 +-- lib/pages/governanceNew/referendumPanel.dart | 43 ++++++--------- .../governanceNew/referendumVotePage.dart | 5 +- lib/pages/governanceNew/treasuryPage.dart | 38 ++++++++----- lib/pages/parasNew/auctionPanel.dart | 13 +++-- lib/pages/parasNew/contributePage.dart | 15 ++--- lib/pages/parasNew/crowdLoanList.dart | 10 ++-- lib/pages/parasNew/parasPage.dart | 15 +++-- lib/pages/staking/actions/bondExtraPage.dart | 4 +- lib/pages/staking/actions/bondPage.dart | 2 +- .../staking/actions/controllerSelectPage.dart | 4 +- lib/pages/staking/actions/nominateForm.dart | 10 ++-- lib/pages/staking/actions/payoutPage.dart | 2 +- lib/pages/staking/actions/setPayeePage.dart | 10 +++- .../validators/validatorDetailPage.dart | 16 ++++-- .../validators/validatorListFilter.dart | 7 ++- .../validators/validatorRewardsChart.dart | 9 +-- lib/pages/stakingNew/RewardDetailPage.dart | 7 ++- lib/pages/stakingNew/RewardsChart.dart | 9 +-- lib/pages/stakingNew/overView.dart | 16 +++--- lib/pages/stakingNew/rebondPage.dart | 4 +- lib/pages/stakingNew/stakingHistoryPage.dart | 8 +-- lib/pages/stakingNew/stakingView.dart | 55 ++++++++++--------- lib/pages/stakingNew/validator.dart | 23 ++++---- pubspec.lock | 2 +- 30 files changed, 214 insertions(+), 176 deletions(-) diff --git a/lib/pages/governanceNew/candidateDetailPage.dart b/lib/pages/governanceNew/candidateDetailPage.dart index a442ca56c..5380ab4b3 100644 --- a/lib/pages/governanceNew/candidateDetailPage.dart +++ b/lib/pages/governanceNew/candidateDetailPage.dart @@ -10,6 +10,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/roundedPluginCard.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class CandidateDetailPage extends StatefulWidget { CandidateDetailPage(this.plugin, this.keyring); @@ -103,7 +104,7 @@ class _CandidateDetailPageState extends State { child: Text( dic['vote.voter'], style: Theme.of(context).textTheme.headline3?.copyWith( - fontSize: 18, + fontSize: UI.getTextSize(18, context), fontWeight: FontWeight.w600, color: Colors.white), ), diff --git a/lib/pages/governanceNew/councilPage.dart b/lib/pages/governanceNew/councilPage.dart index c9b1eabd6..71e97666d 100644 --- a/lib/pages/governanceNew/councilPage.dart +++ b/lib/pages/governanceNew/councilPage.dart @@ -129,7 +129,7 @@ class _CouncilPageState extends State { ?.copyWith(color: Colors.white), style: Theme.of(context).textTheme.headline3?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 1.7), title: dic['seats'], @@ -145,7 +145,7 @@ class _CouncilPageState extends State { ?.copyWith(color: Colors.white), style: Theme.of(context).textTheme.headline3?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 1.7), title: dic['up'], @@ -161,7 +161,7 @@ class _CouncilPageState extends State { ?.copyWith(color: Colors.white), style: Theme.of(context).textTheme.headline3?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 1.7), title: dic['candidate'], @@ -183,7 +183,7 @@ class _CouncilPageState extends State { ?.copyWith(color: Colors.white), style: Theme.of(context).textTheme.headline3?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 1.7), title: dic['voted'], @@ -202,7 +202,7 @@ class _CouncilPageState extends State { ?.copyWith(color: Colors.white), style: Theme.of(context).textTheme.headline3?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 1.7), title: dic['vote.my'], @@ -288,7 +288,7 @@ class _CouncilPageState extends State { activeTextcolor: _select ? Colors.white : Colors.black, active: true, - fontSize: 12, + fontSize: UI.getTextSize(12, context), minSize: 19, onPressed: () { setState(() { @@ -587,7 +587,7 @@ class CandidateItem extends StatelessWidget { )} $tokenSymbol', style: Theme.of(context).textTheme.headline5?.copyWith( color: Colors.white, - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w300)), onTap: noTap ? null diff --git a/lib/pages/governanceNew/councilVotePage.dart b/lib/pages/governanceNew/councilVotePage.dart index c16ca1b94..36f6823d8 100644 --- a/lib/pages/governanceNew/councilVotePage.dart +++ b/lib/pages/governanceNew/councilVotePage.dart @@ -15,6 +15,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class CouncilVotePage extends StatefulWidget { CouncilVotePage(this.plugin, this.keyring); @@ -162,7 +163,8 @@ class _CouncilVote extends State { .headline4 ?.copyWith( color: Colors.white, - fontSize: 12), + fontSize: + UI.getTextSize(12, context)), ) ], ), diff --git a/lib/pages/governanceNew/govExternalLinks.dart b/lib/pages/governanceNew/govExternalLinks.dart index 884ce3c2d..cf414bafe 100644 --- a/lib/pages/governanceNew/govExternalLinks.dart +++ b/lib/pages/governanceNew/govExternalLinks.dart @@ -32,7 +32,7 @@ class GovExternalLinks extends StatelessWidget { data['name'], style: Theme.of(context).textTheme.headline5?.copyWith( color: Colors.white, - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w300), ) ], diff --git a/lib/pages/governanceNew/governancePage.dart b/lib/pages/governanceNew/governancePage.dart index 3e38562dd..d8f5cf2bf 100644 --- a/lib/pages/governanceNew/governancePage.dart +++ b/lib/pages/governanceNew/governancePage.dart @@ -344,7 +344,8 @@ class _GovernancePageState extends State { .headline3 ?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize( + 22, context), fontWeight: FontWeight.bold), ), PluginInfoItem( @@ -369,7 +370,8 @@ class _GovernancePageState extends State { .headline3 ?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize( + 22, context), fontWeight: FontWeight.bold), ) ], @@ -642,7 +644,8 @@ class _GovernancePageState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize( + 12, context), color: Colors.white), ), Padding( @@ -657,7 +660,10 @@ class _GovernancePageState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: + UI.getTextSize( + 12, + context), color: Colors.white)), Row( @@ -673,9 +679,8 @@ class _GovernancePageState extends State { size: 14, ), Padding( - padding: - EdgeInsets.only( - left: 5), + padding: EdgeInsets.only( + left: 5), child: UI.accountDisplayName( info.proposer, widget @@ -684,13 +689,12 @@ class _GovernancePageState extends State { .accounts .addressIndexMap[ info.proposer], - style: Theme.of( - context) + style: Theme.of(context) .textTheme .headline5 ?.copyWith( - fontSize: - 12, + fontSize: UI.getTextSize( + 12, context), color: Colors .white), expand: false)) @@ -711,13 +715,15 @@ class _GovernancePageState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize( + 12, context), color: Colors.white), contentStyle: Theme.of(context) .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize( + 12, context), color: Colors.white), ), ), diff --git a/lib/pages/governanceNew/proposalPanel.dart b/lib/pages/governanceNew/proposalPanel.dart index 7b7e26c34..0d61e4809 100644 --- a/lib/pages/governanceNew/proposalPanel.dart +++ b/lib/pages/governanceNew/proposalPanel.dart @@ -35,10 +35,8 @@ class _ProposalPanelState extends State { final decimals = widget.plugin.networkState.tokenDecimals![0]; final symbol = widget.plugin.networkState.tokenSymbol![0]; - final style = Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 12, color: Colors.white); + final style = Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(12, context), color: Colors.white); final List seconding = widget.proposal.seconds!.toList(); final bool isSecondOn = widget.proposal.seconds! .indexOf(widget.keyring.current.address!) >= @@ -125,7 +123,7 @@ class _ProposalPanelState extends State { .textTheme .headline3 ?.copyWith( - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, color: Colors.white), ), diff --git a/lib/pages/governanceNew/referendumPanel.dart b/lib/pages/governanceNew/referendumPanel.dart index a38eb0c2f..6f58d8f6d 100644 --- a/lib/pages/governanceNew/referendumPanel.dart +++ b/lib/pages/governanceNew/referendumPanel.dart @@ -7,6 +7,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/infoItemRow.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class ReferendumPanel extends StatefulWidget { ReferendumPanel({ @@ -63,10 +64,8 @@ class _ReferendumPanelState extends State { visible: widget.data!.detail!['content'].toString().isNotEmpty, child: Text( "${widget.data!.image != null && widget.data!.image!['proposal'] != null ? '${widget.data!.image!['proposal']['section']}.${widget.data!.image!['proposal']['method']}\n' : ''}${(widget.data!.detail!['content'] ?? "").toString().trim()}", - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 12, color: Colors.white), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(12, context), color: Colors.white), ), ), Padding( @@ -167,7 +166,7 @@ class _ReferendumPanelState extends State { Text( '${widget.data!.voteCountNay ?? 0}', style: Theme.of(context).textTheme.headline5?.copyWith( - fontSize: 14, + fontSize: UI.getTextSize(14, context), color: Colors.white, height: 1.2, fontWeight: FontWeight.w600), @@ -175,7 +174,7 @@ class _ReferendumPanelState extends State { Text( '${Fmt.balance(widget.data!.votedNay!, widget.decimals!)} ${widget.symbol}', style: Theme.of(context).textTheme.headline5?.copyWith( - fontSize: 10, + fontSize: UI.getTextSize(10, context), color: Colors.white, fontWeight: FontWeight.w300), ), @@ -280,7 +279,7 @@ class _ReferendumPanelState extends State { Text( '${widget.data!.voteCountAye ?? 0}', style: Theme.of(context).textTheme.headline5?.copyWith( - fontSize: 14, + fontSize: UI.getTextSize(14, context), color: Colors.white, height: 1.2, fontWeight: FontWeight.w600), @@ -288,7 +287,7 @@ class _ReferendumPanelState extends State { Text( '${Fmt.balance(widget.data!.votedAye!, widget.decimals!)} ${widget.symbol}', style: Theme.of(context).textTheme.headline5?.copyWith( - fontSize: 10, + fontSize: UI.getTextSize(10, context), color: Colors.white, fontWeight: FontWeight.w300), ), @@ -304,14 +303,10 @@ class _ReferendumPanelState extends State { child: InfoItemRow( dic['remain']!, '${Fmt.blockToTime(endLeft.toInt(), widget.blockDuration!)}(${Fmt.priceFloorBigInt(endLeft, 0, lengthFixed: 0)} blocks)', - labelStyle: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 12, color: Colors.white), - contentStyle: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 12, color: Colors.white), + labelStyle: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(12, context), color: Colors.white), + contentStyle: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(12, context), color: Colors.white), ), ), Visibility( @@ -321,14 +316,10 @@ class _ReferendumPanelState extends State { child: InfoItemRow( dic['activate']!, '${Fmt.blockToTime(activateLeft.toInt(), widget.blockDuration!)}(#${Fmt.priceFloorBigInt(widget.bestNumber! + activateLeft, 0, lengthFixed: 0)})', - labelStyle: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 12, color: Colors.white), - contentStyle: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 12, color: Colors.white), + labelStyle: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(12, context), color: Colors.white), + contentStyle: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(12, context), color: Colors.white), ), )), Container( @@ -371,7 +362,7 @@ class _ReferendumPanelState extends State { .textTheme .headline3 ?.copyWith( - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, color: Colors.white), ), @@ -401,7 +392,7 @@ class _ReferendumPanelState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.bold, color: (widget.data!.isPassing ?? false) ? PluginColorsDark.green diff --git a/lib/pages/governanceNew/referendumVotePage.dart b/lib/pages/governanceNew/referendumVotePage.dart index 36187da3f..b4f28b796 100644 --- a/lib/pages/governanceNew/referendumVotePage.dart +++ b/lib/pages/governanceNew/referendumVotePage.dart @@ -121,7 +121,7 @@ class _ReferendumVoteState extends State { padding: EdgeInsets.all(16), child: Text( _getConvictionLabel(i)!, - style: TextStyle(fontSize: 16), + style: TextStyle(fontSize: UI.getTextSize(16, context)), )); }).toList(), onSelectedItemChanged: (v) { @@ -197,7 +197,8 @@ class _ReferendumVoteState extends State { .textTheme .headline3 ?.copyWith( - color: Colors.white, fontSize: 40), + color: Colors.white, + fontSize: UI.getTextSize(40, context)), decoration: InputDecoration( contentPadding: EdgeInsets.zero, border: InputBorder.none, diff --git a/lib/pages/governanceNew/treasuryPage.dart b/lib/pages/governanceNew/treasuryPage.dart index 78998e3b2..741defab2 100644 --- a/lib/pages/governanceNew/treasuryPage.dart +++ b/lib/pages/governanceNew/treasuryPage.dart @@ -282,7 +282,10 @@ class _TreasuryPageState extends State { ?.copyWith( color: PluginColorsDark .headline1, - fontSize: 10, + fontSize: UI + .getTextSize( + 10, + context), fontWeight: FontWeight .w600)), @@ -295,7 +298,10 @@ class _TreasuryPageState extends State { ?.copyWith( color: PluginColorsDark .headline1, - fontSize: 10, + fontSize: UI + .getTextSize( + 10, + context), fontWeight: FontWeight .w300)) @@ -320,7 +326,9 @@ class _TreasuryPageState extends State { color: PluginColorsDark .headline1, - fontSize: 12, + fontSize: + UI.getTextSize( + 12, context), fontWeight: FontWeight.w600), ), @@ -336,7 +344,9 @@ class _TreasuryPageState extends State { color: PluginColorsDark .headline1, - fontSize: 12, + fontSize: + UI.getTextSize( + 12, context), fontWeight: FontWeight.w600), ), @@ -374,14 +384,12 @@ class _OverviewCard extends StatelessWidget { @override Widget build(BuildContext context) { final Map dic = I18n.of(context)!.getDic(i18n_full_dic_kusama, 'gov')!; - final labelStyle = Theme.of(context) - .textTheme - .headline4 - ?.copyWith(fontSize: 12, color: PluginColorsDark.headline2); - final titleStyle = Theme.of(context) - .textTheme - .headline1 - ?.copyWith(fontSize: 14, color: PluginColorsDark.headline1); + final labelStyle = Theme.of(context).textTheme.headline4?.copyWith( + fontSize: UI.getTextSize(12, context), + color: PluginColorsDark.headline2); + final titleStyle = Theme.of(context).textTheme.headline1?.copyWith( + fontSize: UI.getTextSize(14, context), + color: PluginColorsDark.headline1); final available = Fmt.priceFloorBigIntFormatter( Fmt.balanceInt(overview?.balance ?? '0'), decimals); @@ -531,7 +539,7 @@ class __ProposalItemState extends State<_ProposalItem> { final style = Theme.of(context) .textTheme .headline5 - ?.copyWith(fontSize: 12, color: Colors.white); + ?.copyWith(fontSize: UI.getTextSize(12, context), color: Colors.white); List widgets = []; if (_isExpansion) { widgets.addAll([ @@ -612,7 +620,7 @@ class __ProposalItemState extends State<_ProposalItem> { child: Text( '#${int.parse(widget.proposal!.id!)}', style: Theme.of(context).textTheme.headline3?.copyWith( - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, color: Colors.white), )), @@ -628,7 +636,7 @@ class __ProposalItemState extends State<_ProposalItem> { child: Text( dic['v3.treasury.${widget.isApproved ? 'Approved' : 'pending'}']!, style: Theme.of(context).textTheme.headline5?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.bold, color: widget.isApproved ? PluginColorsDark.green diff --git a/lib/pages/parasNew/auctionPanel.dart b/lib/pages/parasNew/auctionPanel.dart index 50222a6e7..e84a528ff 100644 --- a/lib/pages/parasNew/auctionPanel.dart +++ b/lib/pages/parasNew/auctionPanel.dart @@ -6,6 +6,7 @@ import 'package:polkawallet_ui/components/linearProgressBar.dart'; import 'package:polkawallet_ui/components/v3/plugin/roundedPluginCard.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class AuctionPanel extends StatelessWidget { AuctionPanel(this.auction, this.config, this.decimals, this.tokenSymbol, @@ -26,7 +27,7 @@ class AuctionPanel extends StatelessWidget { final textStyleSmall = Theme.of(context) .textTheme .headline5 - ?.copyWith(color: Colors.white, fontSize: 12); + ?.copyWith(color: Colors.white, fontSize: UI.getTextSize(12, context)); final auctionPeriodBlocks = endingPeriodBlocks * 3 ~/ 8; final endBlock = int.parse(auction.auction.endBlock ?? '0'); @@ -102,7 +103,7 @@ class AuctionPanel extends StatelessWidget { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.bold, color: Colors.black, ), @@ -209,13 +210,17 @@ class AuctionPanel extends StatelessWidget { Text( e.paraId ?? '', style: textStyle?.copyWith( - fontSize: 16, height: 1.2), + fontSize: + UI.getTextSize(16, context), + height: 1.2), ), Text( ((config[e.paraId] ?? {})['name'] ?? ''), style: textStyleSmall?.copyWith( - fontSize: 10, height: 1), + fontSize: + UI.getTextSize(10, context), + height: 1), ) ], ), diff --git a/lib/pages/parasNew/contributePage.dart b/lib/pages/parasNew/contributePage.dart index f40fd7411..afac02bfa 100644 --- a/lib/pages/parasNew/contributePage.dart +++ b/lib/pages/parasNew/contributePage.dart @@ -109,10 +109,8 @@ class _ContributePageState extends State { final logoUri = widget.plugin.store.paras.fundsVisible[fund.paraId] ['logo'] as String; - final titleStyle = Theme.of(context) - .textTheme - .headline3 - ?.copyWith(color: Colors.white, fontSize: 14); + final titleStyle = Theme.of(context).textTheme.headline3?.copyWith( + color: Colors.white, fontSize: UI.getTextSize(14, context)); return PluginScaffold( appBar: PluginAppBar(title: Text('Contribute')), body: Container( @@ -147,8 +145,9 @@ class _ContributePageState extends State { Text( widget.plugin.store.paras .fundsVisible[fund.paraId]['name'], - style: - titleStyle?.copyWith(fontSize: 12, height: 1), + style: titleStyle?.copyWith( + fontSize: UI.getTextSize(12, context), + height: 1), ), ], )) @@ -173,7 +172,9 @@ class _ContributePageState extends State { style: Theme.of(context) .textTheme .headline3 - ?.copyWith(color: Colors.white, fontSize: 40), + ?.copyWith( + color: Colors.white, + fontSize: UI.getTextSize(40, context)), decoration: InputDecoration( contentPadding: EdgeInsets.zero, border: InputBorder.none, diff --git a/lib/pages/parasNew/crowdLoanList.dart b/lib/pages/parasNew/crowdLoanList.dart index 9a7259fe8..03f0f6c60 100644 --- a/lib/pages/parasNew/crowdLoanList.dart +++ b/lib/pages/parasNew/crowdLoanList.dart @@ -74,7 +74,7 @@ class _CrowdLoanListItemState extends State { color: isEnded ? PluginColorsDark.headline3 : PluginColorsDark.green, - fontSize: 14), + fontSize: UI.getTextSize(14, context)), ), Container( child: Row( @@ -84,7 +84,7 @@ class _CrowdLoanListItemState extends State { '#${widget.fund.paraId}', style: Theme.of(context).textTheme.headline3!.copyWith( color: PluginColorsDark.headline1, - fontSize: 22, + fontSize: UI.getTextSize(22, context), height: 1.2), )), isEnded @@ -122,7 +122,8 @@ class _CrowdLoanListItemState extends State { child: Text( name, style: Theme.of(context).textTheme.headline3!.copyWith( - color: PluginColorsDark.headline1, fontSize: 16), + color: PluginColorsDark.headline1, + fontSize: UI.getTextSize(16, context)), ), ), GestureDetector( @@ -138,7 +139,8 @@ class _CrowdLoanListItemState extends State { 'You Contributed: $amount ${widget.tokenSymbol}', textAlign: TextAlign.end, style: Theme.of(context).textTheme.headline4!.copyWith( - color: PluginColorsDark.headline1, fontSize: 12), + color: PluginColorsDark.headline1, + fontSize: UI.getTextSize(12, context)), ), ) ], diff --git a/lib/pages/parasNew/parasPage.dart b/lib/pages/parasNew/parasPage.dart index 8205ad953..0ea32a248 100644 --- a/lib/pages/parasNew/parasPage.dart +++ b/lib/pages/parasNew/parasPage.dart @@ -23,6 +23,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginTabCard.dart'; import 'package:polkawallet_ui/components/v3/plugin/roundedPluginCard.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class ParasPage extends StatefulWidget { ParasPage(this.plugin, this.keyring); @@ -234,14 +235,12 @@ class _OverviewCard extends StatelessWidget { final textStyle = Theme.of(context).textTheme.headline5?.copyWith(color: Colors.white); - final labelStyle = Theme.of(context) - .textTheme - .headline3 - ?.copyWith(fontSize: 14, color: PluginColorsDark.headline1); - final contentStyle = Theme.of(context) - .textTheme - .headline1 - ?.copyWith(fontSize: 22, color: PluginColorsDark.headline1); + final labelStyle = Theme.of(context).textTheme.headline3?.copyWith( + fontSize: UI.getTextSize(14, context), + color: PluginColorsDark.headline1); + final contentStyle = Theme.of(context).textTheme.headline1?.copyWith( + fontSize: UI.getTextSize(22, context), + color: PluginColorsDark.headline1); final contributed = contributions.values.map((e) => Fmt.balanceInt(e)).toList(); diff --git a/lib/pages/staking/actions/bondExtraPage.dart b/lib/pages/staking/actions/bondExtraPage.dart index 738c1b2d9..abd3fd5f9 100644 --- a/lib/pages/staking/actions/bondExtraPage.dart +++ b/lib/pages/staking/actions/bondExtraPage.dart @@ -10,6 +10,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; import 'package:polkawallet_ui/utils/consts.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class BondExtraPage extends StatefulWidget { BondExtraPage(this.plugin, this.keyring); @@ -155,7 +156,8 @@ class ErrorMessage extends StatelessWidget { Expanded( child: Text( error, - style: TextStyle(fontSize: 12, color: Colors.red), + style: TextStyle( + fontSize: UI.getTextSize(12, context), color: Colors.red), )) ]), ); diff --git a/lib/pages/staking/actions/bondPage.dart b/lib/pages/staking/actions/bondPage.dart index c240a5bc2..509367a36 100644 --- a/lib/pages/staking/actions/bondPage.dart +++ b/lib/pages/staking/actions/bondPage.dart @@ -97,7 +97,7 @@ class _BondPageState extends State { I18n.of(context)!.getDic( i18n_full_dic_kusama, 'staking')!['stake.warn'], color: Colors.deepOrange, - fontSize: 12, + fontSize: UI.getTextSize(12, context), margin: EdgeInsets.all(0), padding: EdgeInsets.all(8), )) diff --git a/lib/pages/staking/actions/controllerSelectPage.dart b/lib/pages/staking/actions/controllerSelectPage.dart index 2039c3b04..e454267f8 100644 --- a/lib/pages/staking/actions/controllerSelectPage.dart +++ b/lib/pages/staking/actions/controllerSelectPage.dart @@ -7,6 +7,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/v3/addressIcon.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class ControllerSelectPage extends StatelessWidget { ControllerSelectPage(this.plugin, this.keyring); @@ -70,7 +71,8 @@ class ControllerSelectPage extends StatelessWidget { unavailable, style: TextStyle( color: Colors.orange, - fontSize: 12, + fontSize: + UI.getTextSize(12, context), ), ), ], diff --git a/lib/pages/staking/actions/nominateForm.dart b/lib/pages/staking/actions/nominateForm.dart index aefab223c..a925cc904 100644 --- a/lib/pages/staking/actions/nominateForm.dart +++ b/lib/pages/staking/actions/nominateForm.dart @@ -75,10 +75,10 @@ class _NominateFormState extends State { : widget.plugin.store.staking.nominationsCount![validator.accountId] ?? 0; - final textStyle = Theme.of(context) - .textTheme - .headline4! - .copyWith(color: PluginColorsDark.headline2, fontSize: 12, height: 1.2); + final textStyle = Theme.of(context).textTheme.headline4!.copyWith( + color: PluginColorsDark.headline2, + fontSize: UI.getTextSize(12, context), + height: 1.2); final comm = NumberFormat('0.00%').format(validator.commission / 100); return GestureDetector( child: Container( @@ -148,7 +148,7 @@ class _NominateFormState extends State { '${validator.stakedReturnCmp.toStringAsFixed(2)}%', style: Theme.of(context).textTheme.headline1!.copyWith( color: PluginColorsDark.headline1, - fontSize: 16, + fontSize: UI.getTextSize(16, context), fontWeight: FontWeight.bold, ), ), diff --git a/lib/pages/staking/actions/payoutPage.dart b/lib/pages/staking/actions/payoutPage.dart index e3be9e3d5..f3feea677 100644 --- a/lib/pages/staking/actions/payoutPage.dart +++ b/lib/pages/staking/actions/payoutPage.dart @@ -79,7 +79,7 @@ class _PayoutPageState extends State { padding: EdgeInsets.all(16), child: Text( _getEraText(i), - style: TextStyle(fontSize: 16), + style: TextStyle(fontSize: UI.getTextSize(16, context)), ), ); }).toList(), diff --git a/lib/pages/staking/actions/setPayeePage.dart b/lib/pages/staking/actions/setPayeePage.dart index fc4330cd8..639e095dd 100644 --- a/lib/pages/staking/actions/setPayeePage.dart +++ b/lib/pages/staking/actions/setPayeePage.dart @@ -14,6 +14,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginAddressTextFormField.d import 'package:polkawallet_ui/components/v3/plugin/pluginInputItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class SetPayeePage extends StatefulWidget { SetPayeePage(this.plugin, this.keyring); @@ -197,7 +198,9 @@ class _PayeeSelectorState extends State { widget.initialValue!.destinationId ?? 0]!, style: Theme.of(context).textTheme.headline4!.copyWith( - color: Color(0xCCFFFFFF), fontSize: 14, height: 1.2), + color: Color(0xCCFFFFFF), + fontSize: UI.getTextSize(14, context), + height: 1.2), ), ), Icon( @@ -225,7 +228,8 @@ class _PayeeSelectorState extends State { padding: EdgeInsets.all(12), child: Text( i!, - style: TextStyle(fontSize: 14), + style: TextStyle( + fontSize: UI.getTextSize(14, context)), ), )) .toList(), @@ -267,7 +271,7 @@ class _PayeeSelectorState extends State { child: TextTag( dic['stake.payee.warn'], color: Colors.deepOrange, - fontSize: 12, + fontSize: UI.getTextSize(12, context), margin: EdgeInsets.symmetric(vertical: 16), padding: EdgeInsets.all(8), )) diff --git a/lib/pages/staking/validators/validatorDetailPage.dart b/lib/pages/staking/validators/validatorDetailPage.dart index ef322b5b6..1063ac640 100644 --- a/lib/pages/staking/validators/validatorDetailPage.dart +++ b/lib/pages/staking/validators/validatorDetailPage.dart @@ -133,7 +133,7 @@ class ValidatorDetailPage extends StatelessWidget { dicStaking['validator.chart']!, style: TextStyle( color: PluginColorsDark.primary, - fontSize: 14), + fontSize: UI.getTextSize(14, context)), ), Padding( padding: EdgeInsets.only(left: 2), @@ -173,7 +173,8 @@ class ValidatorDetailPage extends StatelessWidget { .textTheme .headline1 ?.copyWith( - fontSize: 22, + fontSize: + UI.getTextSize(22, context), color: Colors.white), ), PluginInfoItem( @@ -190,7 +191,8 @@ class ValidatorDetailPage extends StatelessWidget { .textTheme .headline1 ?.copyWith( - fontSize: 22, + fontSize: + UI.getTextSize(22, context), color: Colors.white), ), ], @@ -215,7 +217,8 @@ class ValidatorDetailPage extends StatelessWidget { .textTheme .headline1 ?.copyWith( - fontSize: 22, + fontSize: + UI.getTextSize(22, context), color: Colors.white), ), PluginInfoItem( @@ -232,7 +235,8 @@ class ValidatorDetailPage extends StatelessWidget { .textTheme .headline1 ?.copyWith( - fontSize: 22, + fontSize: + UI.getTextSize(22, context), color: Colors.white), ), ], @@ -262,7 +266,7 @@ class ValidatorDetailPage extends StatelessWidget { .textTheme .headline3 ?.copyWith( - fontSize: 18, + fontSize: UI.getTextSize(18, context), fontWeight: FontWeight.w600, color: Colors.white), ), diff --git a/lib/pages/staking/validators/validatorListFilter.dart b/lib/pages/staking/validators/validatorListFilter.dart index 631fa9b0c..958318da8 100644 --- a/lib/pages/staking/validators/validatorListFilter.dart +++ b/lib/pages/staking/validators/validatorListFilter.dart @@ -6,6 +6,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginIconButton.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginInputItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginOutlinedButtonSmall.dart'; import 'package:polkawallet_ui/utils/consts.dart'; +import 'package:polkawallet_ui/utils/index.dart'; enum ValidatorSortOptions { reward, staked, commission, judgements } @@ -67,7 +68,8 @@ class ValidatorListFilter extends StatelessWidget { .textTheme .headline4! .copyWith( - color: PluginColorsDark.headline3, fontSize: 14), + color: PluginColorsDark.headline3, + fontSize: UI.getTextSize(14, context)), decoration: BoxDecoration(color: Colors.transparent), suffix: Container( padding: EdgeInsets.only(right: 8), @@ -75,7 +77,8 @@ class ValidatorListFilter extends StatelessWidget { color: PluginColorsDark.headline3, size: 24), ), style: Theme.of(context).textTheme.headline4!.copyWith( - color: PluginColorsDark.headline2, fontSize: 14), + color: PluginColorsDark.headline2, + fontSize: UI.getTextSize(14, context)), onChanged: (value) => onSearchChange(value.trim()), ), bgHeight: 40, diff --git a/lib/pages/staking/validators/validatorRewardsChart.dart b/lib/pages/staking/validators/validatorRewardsChart.dart index 1e6ac0eff..60e2bf419 100644 --- a/lib/pages/staking/validators/validatorRewardsChart.dart +++ b/lib/pages/staking/validators/validatorRewardsChart.dart @@ -1,5 +1,6 @@ import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class RewardsChart extends StatelessWidget { final List> seriesList; @@ -111,8 +112,8 @@ class RewardsChart extends StatelessWidget { bottomTitles: SideTitles( showTitles: true, reservedSize: 22, - getTextStyles: (context, index) => - const TextStyle(fontSize: 12, color: Colors.white), + getTextStyles: (context, index) => TextStyle( + fontSize: UI.getTextSize(12, context), color: Colors.white), getTitles: (value) { return "${(minXValue + value).toInt()}"; }, @@ -122,8 +123,8 @@ class RewardsChart extends StatelessWidget { rightTitles: SideTitles(showTitles: false), leftTitles: SideTitles( showTitles: true, - getTextStyles: (context, index) => - const TextStyle(fontSize: 12, color: Colors.white), + getTextStyles: (context, index) => TextStyle( + fontSize: UI.getTextSize(12, context), color: Colors.white), getTitles: (value) { return value.toStringAsFixed(2); }, diff --git a/lib/pages/stakingNew/RewardDetailPage.dart b/lib/pages/stakingNew/RewardDetailPage.dart index 5cf6f367c..db8d93014 100644 --- a/lib/pages/stakingNew/RewardDetailPage.dart +++ b/lib/pages/stakingNew/RewardDetailPage.dart @@ -13,6 +13,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginTextTag.dart'; import 'package:polkawallet_plugin_kusama/pages/staking/actions/rewardDetailPage.dart'; import 'package:polkawallet_ui/utils/format.dart'; import 'package:polkawallet_ui/utils/i18n.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class RewardDetailNewPage extends StatefulWidget { RewardDetailNewPage(this.plugin, {Key? key}) : super(key: key); @@ -123,7 +124,8 @@ class _RewardDetailNewPageState extends State { padding: EdgeInsets.only(left: 50, top: 8), child: Text('Rewards ($symbol)', style: TextStyle( - fontSize: 12, color: Colors.white)), + fontSize: UI.getTextSize(12, context), + color: Colors.white)), ), Container( height: MediaQuery.of(context).size.width / 2.4, @@ -187,7 +189,8 @@ class _RewardDetailNewPageState extends State { .headline5 ?.copyWith( color: Colors.white, - fontSize: 10)), + fontSize: UI.getTextSize( + 10, context))), trailing: Text( '${isReward ? '+' : '-'} ${Fmt.balance(i.amount!, decimals)} $symbol', style: Theme.of(context) diff --git a/lib/pages/stakingNew/RewardsChart.dart b/lib/pages/stakingNew/RewardsChart.dart index 3392b460d..b2b17e8d4 100644 --- a/lib/pages/stakingNew/RewardsChart.dart +++ b/lib/pages/stakingNew/RewardsChart.dart @@ -2,6 +2,7 @@ import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class RewardsChart extends StatelessWidget { final List seriesList; @@ -133,14 +134,14 @@ class RewardsChart extends StatelessWidget { text: "${DateFormat.yMd().format(time.toLocal())}\n", style: Theme.of(context).textTheme.headline5?.copyWith( color: Colors.white, - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w600)), TextSpan( text: "${Fmt.priceFloorFormatter(e.y / yBase, lengthMax: 6)}", style: Theme.of(context).textTheme.headline5?.copyWith( color: Colors.white, - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w600)), ]); }).toList(); @@ -155,7 +156,7 @@ class RewardsChart extends StatelessWidget { .headline5 ?.copyWith( color: Colors.white, - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w600), getTitles: (value) { int b = xBase ~/ 2; @@ -184,7 +185,7 @@ class RewardsChart extends StatelessWidget { .headline5 ?.copyWith( color: Colors.white, - fontSize: 10, + fontSize: UI.getTextSize(10, context), fontWeight: FontWeight.w600), getTitles: (value) { return Fmt.priceFloorFormatter(value / yBase, lengthMax: 5); diff --git a/lib/pages/stakingNew/overView.dart b/lib/pages/stakingNew/overView.dart index a7325adf0..ce305e04f 100644 --- a/lib/pages/stakingNew/overView.dart +++ b/lib/pages/stakingNew/overView.dart @@ -16,6 +16,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginInfoItem.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginLoadingWidget.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTagCard.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class OverView extends StatefulWidget { OverView(this.plugin, {Key? key}) : super(key: key); @@ -52,10 +53,9 @@ class _OverViewState extends State { padding: EdgeInsets.only(top: 5, bottom: 26), child: Text( dicStaking['v3.noStaked']!, - style: Theme.of(context) - .textTheme - .headline1 - ?.copyWith(color: Colors.white, fontSize: 20), + style: Theme.of(context).textTheme.headline1?.copyWith( + color: Colors.white, + fontSize: UI.getTextSize(20, context)), )), PluginButton( title: dicStaking['v3.goStake']!, @@ -171,7 +171,7 @@ class _OverViewWidgetState extends State .headline4 ?.copyWith( fontWeight: FontWeight.bold, - fontSize: 22, + fontSize: UI.getTextSize(22, context), color: Colors.white)), Text( "\$${Fmt.priceFloorFormatter(Fmt.bigIntToDouble(totalStaked, decimals) * marketPrice)}", @@ -180,7 +180,7 @@ class _OverViewWidgetState extends State .headline4 ?.copyWith( fontWeight: FontWeight.bold, - fontSize: 22, + fontSize: UI.getTextSize(22, context), color: Colors.white)) ], ), @@ -203,7 +203,7 @@ class _OverViewWidgetState extends State .headline5 ?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 2.0), contentCrossAxisAlignment: @@ -216,7 +216,7 @@ class _OverViewWidgetState extends State .headline5 ?.copyWith( color: Colors.white, - fontSize: 22, + fontSize: UI.getTextSize(22, context), fontWeight: FontWeight.bold, height: 2.0), content: diff --git a/lib/pages/stakingNew/rebondPage.dart b/lib/pages/stakingNew/rebondPage.dart index 1df9224d4..3d9010eb1 100644 --- a/lib/pages/stakingNew/rebondPage.dart +++ b/lib/pages/stakingNew/rebondPage.dart @@ -13,6 +13,7 @@ import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginTxButton.dart'; import 'package:polkawallet_ui/pages/v3/txConfirmPage.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class RebondPage extends StatefulWidget { RebondPage(this.plugin, {Key? key}) : super(key: key); @@ -136,7 +137,8 @@ class _RebondPageState extends State { Text( unlockDetail[index]["time"]!, style: labelStyle?.copyWith( - fontSize: 10, + fontSize: + UI.getTextSize(10, context), fontWeight: FontWeight.w300), ) ], diff --git a/lib/pages/stakingNew/stakingHistoryPage.dart b/lib/pages/stakingNew/stakingHistoryPage.dart index 91270542e..cb9b493d5 100644 --- a/lib/pages/stakingNew/stakingHistoryPage.dart +++ b/lib/pages/stakingNew/stakingHistoryPage.dart @@ -8,6 +8,7 @@ import 'package:polkawallet_sdk/utils/i18n.dart'; import 'package:polkawallet_ui/components/listTail.dart'; import 'package:polkawallet_ui/components/v3/plugin/pluginScaffold.dart'; import 'package:polkawallet_ui/utils/format.dart'; +import 'package:polkawallet_ui/utils/index.dart'; class StakingHistoryPage extends StatefulWidget { StakingHistoryPage(this.plugin, {Key? key}) : super(key: key); @@ -128,10 +129,9 @@ class _StakingHistoryPageState extends State { subtitle: Text( Fmt.dateTime(DateTime.fromMillisecondsSinceEpoch( i.blockTimestamp! * 1000)), - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(color: Colors.white, fontSize: 10)), + style: Theme.of(context).textTheme.headline5?.copyWith( + color: Colors.white, + fontSize: UI.getTextSize(10, context))), trailing: i.success! ? Text( dicCommon['success']!, diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index 16ae3d969..b653ce701 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -214,7 +214,10 @@ class _StakingViewState extends State { ?.copyWith( color: Colors .white, - fontSize: 22, + fontSize: UI + .getTextSize( + 22, + context), fontWeight: FontWeight .bold, @@ -227,7 +230,10 @@ class _StakingViewState extends State { ?.copyWith( color: Colors .white, - fontSize: 10)), + fontSize: UI + .getTextSize( + 10, + context))), ], )), Expanded( @@ -258,8 +264,9 @@ class _StakingViewState extends State { ?.copyWith( color: Colors .white, - fontSize: + fontSize: UI.getTextSize( 22, + context), fontWeight: FontWeight .bold, @@ -274,8 +281,9 @@ class _StakingViewState extends State { ?.copyWith( color: Colors .white, - fontSize: - 10)), + fontSize: UI.getTextSize( + 10, + context))), ], ))), ], @@ -360,10 +368,11 @@ class _StakingViewState extends State { 'zh' ? "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol 将于${unlockDetail[0]['time']}后可提取" : "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol can be redeemed in ${unlockDetail[0]['time']}", - style: labelStyle - ?.copyWith( - fontSize: - 10), + style: labelStyle?.copyWith( + fontSize: + UI.getTextSize( + 10, + context)), )) ], ), @@ -680,7 +689,7 @@ class _StakingViewState extends State { content: dic['v3.stopAll'], color: Color(0xFFFF7849), active: true, - fontSize: 12, + fontSize: UI.getTextSize(12, context), minSize: 19, onPressed: () { if (isStash && !isController!) { @@ -742,7 +751,8 @@ class _StakingViewState extends State { .textTheme .headline5 ?.copyWith( - fontSize: 12, + fontSize: UI.getTextSize( + 12, context), color: Colors.white), ), )) @@ -893,23 +903,19 @@ class _NomineeItem extends StatelessWidget { children: [ UI.accountDisplayName(validator.accountId, accInfo, style: TextStyle( - fontSize: 14, + fontSize: UI.getTextSize(14, context), fontFamily: "TitilliumWeb", fontWeight: FontWeight.w600, color: Colors.white)), Text( "${dicStaking['total']}: ${Fmt.token(meStaked ?? BigInt.zero, decimals)}", - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 10, color: Colors.white), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(10, context), color: Colors.white), ), Text( "${dicStaking['commission']}: ${NumberFormat('0.00%').format(validator.commission / 100)}", - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 10, color: Colors.white), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(10, context), color: Colors.white), ) ], ), @@ -926,10 +932,9 @@ class _NomineeItem extends StatelessWidget { mainAxisSize: MainAxisSize.min, children: [ Text(dicStaking['reward']!, - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 10, color: Colors.white)), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(10, context), + color: Colors.white)), Text( validator.isActive! ? '${validator.stakedReturnCmp.toStringAsFixed(2)}%' @@ -1030,7 +1035,7 @@ class _GridViewItemBtnState extends State { widget.text, style: Theme.of(context).textTheme.headline5?.copyWith( color: Color(0xFFFF7849), - fontSize: 12, + fontSize: UI.getTextSize(12, context), fontWeight: FontWeight.bold), ) ], diff --git a/lib/pages/stakingNew/validator.dart b/lib/pages/stakingNew/validator.dart index 12683b11b..a0652206a 100644 --- a/lib/pages/stakingNew/validator.dart +++ b/lib/pages/stakingNew/validator.dart @@ -65,7 +65,7 @@ class Validator extends StatelessWidget { child: UI.accountDisplayName( validator.accountId, accInfo, style: TextStyle( - fontSize: 14, + fontSize: UI.getTextSize(14, context), fontFamily: "TitilliumWeb", fontWeight: FontWeight.w600, color: Colors.white)), @@ -77,17 +77,15 @@ class Validator extends StatelessWidget { // ignore: unnecessary_null_comparison ? '${dic['total']}: ${validator.total != null ? Fmt.token(validator.total, decimals) : '~'}' : '${dic['nominators']}: $nominationsCount', - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 10, color: Colors.white), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(10, context), + color: Colors.white), ), Text( '${dic['commission']}: ${NumberFormat('0.00%').format(validator.commission / 100)}', - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 10, color: Colors.white), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(10, context), + color: Colors.white), ) ], ), @@ -99,10 +97,9 @@ class Validator extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text(dic['reward']!, - style: Theme.of(context) - .textTheme - .headline5 - ?.copyWith(fontSize: 10, color: Colors.white)), + style: Theme.of(context).textTheme.headline5?.copyWith( + fontSize: UI.getTextSize(10, context), + color: Colors.white)), Text( validator.isActive! ? '${validator.stakedReturnCmp.toStringAsFixed(2)}%' diff --git a/pubspec.lock b/pubspec.lock index 2b717b5da..041caf757 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -257,7 +257,7 @@ packages: name: flutter_inappwebview url: "https://pub.dartlang.org" source: hosted - version: "5.4.3+7" + version: "5.3.2" flutter_mobx: dependency: "direct main" description: From cda15bdf98b7fe2f80fc3bfb4a6d4d81293350ea Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 14 Jun 2022 18:20:32 +0800 Subject: [PATCH 13/17] fix unlock null bug,ui update --- lib/pages/governanceNew/councilPage.dart | 4 +- .../governanceNew/referendumVotePage.dart | 1 - .../validators/validatorDetailPage.dart | 8 +-- lib/pages/stakingNew/overView.dart | 1 - lib/pages/stakingNew/overViewPage.dart | 7 +-- lib/pages/stakingNew/stakingView.dart | 56 +++++++++---------- 6 files changed, 35 insertions(+), 42 deletions(-) diff --git a/lib/pages/governanceNew/councilPage.dart b/lib/pages/governanceNew/councilPage.dart index 71e97666d..bc08cd766 100644 --- a/lib/pages/governanceNew/councilPage.dart +++ b/lib/pages/governanceNew/councilPage.dart @@ -114,8 +114,8 @@ class _CouncilPageState extends State { width: double.infinity, decoration: BoxDecoration( borderRadius: BorderRadius.only( - topLeft: const Radius.circular(14), - topRight: const Radius.circular(14)), + topLeft: const Radius.circular(8), + topRight: const Radius.circular(8)), color: Color.fromARGB(255, 68, 70, 74), ), child: Row( diff --git a/lib/pages/governanceNew/referendumVotePage.dart b/lib/pages/governanceNew/referendumVotePage.dart index b4f28b796..cfe8f0cd9 100644 --- a/lib/pages/governanceNew/referendumVotePage.dart +++ b/lib/pages/governanceNew/referendumVotePage.dart @@ -170,7 +170,6 @@ class _ReferendumVoteState extends State { PluginTagCard( margin: EdgeInsets.zero, padding: EdgeInsets.symmetric(vertical: 25), - radius: const Radius.circular(14), titleTag: dicGov['v3.voting'], child: Container( alignment: Alignment.center, diff --git a/lib/pages/staking/validators/validatorDetailPage.dart b/lib/pages/staking/validators/validatorDetailPage.dart index 1063ac640..c349e5ee7 100644 --- a/lib/pages/staking/validators/validatorDetailPage.dart +++ b/lib/pages/staking/validators/validatorDetailPage.dart @@ -62,8 +62,8 @@ class ValidatorDetailPage extends StatelessWidget { decoration: BoxDecoration( color: Color(0x0FFFFFFF), borderRadius: BorderRadius.only( - topLeft: Radius.circular(14), - topRight: Radius.circular(14)), + topLeft: Radius.circular(8), + topRight: Radius.circular(8)), ), child: Column( children: [ @@ -150,8 +150,8 @@ class ValidatorDetailPage extends StatelessWidget { decoration: BoxDecoration( color: Color(0x0FFFFFFF), borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(14), - bottomRight: Radius.circular(14)), + bottomLeft: Radius.circular(8), + bottomRight: Radius.circular(8)), ), child: Column( children: [ diff --git a/lib/pages/stakingNew/overView.dart b/lib/pages/stakingNew/overView.dart index ce305e04f..d5ba69231 100644 --- a/lib/pages/stakingNew/overView.dart +++ b/lib/pages/stakingNew/overView.dart @@ -189,7 +189,6 @@ class _OverViewWidgetState extends State margin: EdgeInsets.only(top: 15), padding: EdgeInsets.symmetric(horizontal: 16, vertical: 20), titleTag: dicStaking['v3.information'], - radius: const Radius.circular(14), child: Column( children: [ Row( diff --git a/lib/pages/stakingNew/overViewPage.dart b/lib/pages/stakingNew/overViewPage.dart index ddf89ae18..f9ab26953 100644 --- a/lib/pages/stakingNew/overViewPage.dart +++ b/lib/pages/stakingNew/overViewPage.dart @@ -85,11 +85,10 @@ class _OverViewPageState extends State { decoration: BoxDecoration( color: Color(0x24FFFFFF), borderRadius: BorderRadius.only( - topRight: Radius.circular(index == 1 ? 14 : 0), - bottomLeft: - Radius.circular(index == ls.length ? 14 : 0), + topRight: Radius.circular(index == 1 ? 8 : 0), + bottomLeft: Radius.circular(index == ls.length ? 8 : 0), bottomRight: - Radius.circular(index == ls.length ? 14 : 0))), + Radius.circular(index == ls.length ? 8 : 0))), child: Column( children: [ Validator(acc, accInfo, icon, decimals, nomCount, diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index b653ce701..406a3a071 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -299,15 +299,16 @@ class _StakingViewState extends State { )), GestureDetector( onTap: () async { - final res = - await Navigator.of( - context) - .pushNamed( - RebondPage.route, - arguments: - unlockDetail); - if (res != null) { - _updateData(); + if (unlockDetail.length > 0) { + final res = await Navigator + .of(context) + .pushNamed( + RebondPage.route, + arguments: + unlockDetail); + if (res != null) { + _updateData(); + } } }, child: Padding( @@ -356,24 +357,19 @@ class _StakingViewState extends State { .bold, color: Colors .black))), - Visibility( - visible: - unlockDetail - .length > - 0, - child: Text( - I18n.of(context)! - .locale - .languageCode == - 'zh' - ? "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol 将于${unlockDetail[0]['time']}后可提取" - : "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol can be redeemed in ${unlockDetail[0]['time']}", - style: labelStyle?.copyWith( - fontSize: - UI.getTextSize( - 10, - context)), - )) + unlockDetail.length > + 0 + ? Text( + I18n.of(context)!.locale.languageCode == + 'zh' + ? "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol 将于${unlockDetail[0]['time']}后可提取" + : "${Fmt.balance(unlockDetail[0]["balance"], decimals)} $symbol can be redeemed in ${unlockDetail[0]['time']}", + style: labelStyle?.copyWith( + fontSize: UI.getTextSize( + 10, + context)), + ) + : Container() ], ), ), @@ -726,9 +722,9 @@ class _StakingViewState extends State { decoration: BoxDecoration( color: Color(0x24FFFFFF), borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(14), - topRight: Radius.circular(14), - bottomRight: Radius.circular(14))), + bottomLeft: Radius.circular(8), + topRight: Radius.circular(8), + bottomRight: Radius.circular(8))), child: widget.plugin.store.staking.ownStashInfo! .nominating!.length > 0 From c51a2d5a72c566f7dfe82bc5b085425c3f1f4082 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 14 Jun 2022 18:21:43 +0800 Subject: [PATCH 14/17] ui update --- lib/pages/stakingNew/RewardDetailPage.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pages/stakingNew/RewardDetailPage.dart b/lib/pages/stakingNew/RewardDetailPage.dart index db8d93014..0278cfe2d 100644 --- a/lib/pages/stakingNew/RewardDetailPage.dart +++ b/lib/pages/stakingNew/RewardDetailPage.dart @@ -94,8 +94,8 @@ class _RewardDetailNewPageState extends State { decoration: BoxDecoration( color: Color(0x24FFFFFF), borderRadius: BorderRadius.only( - topLeft: Radius.circular(14), - topRight: Radius.circular(14))), + topLeft: Radius.circular(8), + topRight: Radius.circular(8))), child: PluginInfoItem( title: dic['v3.stagedRewards'], isExpanded: false, @@ -114,9 +114,9 @@ class _RewardDetailNewPageState extends State { decoration: BoxDecoration( color: Color(0x1AFFFFFF), borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(14), - topRight: Radius.circular(14), - bottomRight: Radius.circular(14))), + bottomLeft: Radius.circular(8), + topRight: Radius.circular(8), + bottomRight: Radius.circular(8))), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ From 33e2697287cc8fde2aef2f4ebc70f5464a60fbd0 Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Tue, 14 Jun 2022 18:56:46 +0800 Subject: [PATCH 15/17] fix rebond bug --- lib/pages/stakingNew/rebondPage.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/pages/stakingNew/rebondPage.dart b/lib/pages/stakingNew/rebondPage.dart index 3d9010eb1..12f283ebd 100644 --- a/lib/pages/stakingNew/rebondPage.dart +++ b/lib/pages/stakingNew/rebondPage.dart @@ -67,12 +67,14 @@ class _RebondPageState extends State { onClear: () { setState(() { _amountCtrl.text = ""; + _error = null; }); }, onSetMax: (amount) { setState(() { _amountCtrl.text = Fmt.balance(unlocking.toString(), decimals); + _error = null; }); }, onInputChange: (value) { @@ -81,7 +83,8 @@ class _RebondPageState extends State { final amount = double.parse(value.trim()); if (amount >= unlocking / BigInt.from(pow(10, decimals)) - 0.001) { - error = dic['amount.low']; + error = I18n.of(context)!.getDic( + i18n_full_dic_kusama, 'common')!['amount.low']; } } setState(() { From 5ec945c555559cc2ef352697131ab573d350633c Mon Sep 17 00:00:00 2001 From: dingzuhua Date: Thu, 16 Jun 2022 18:42:28 +0800 Subject: [PATCH 16/17] update fontFamily --- lib/pages/stakingNew/stakingView.dart | 2 +- lib/pages/stakingNew/validator.dart | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/pages/stakingNew/stakingView.dart b/lib/pages/stakingNew/stakingView.dart index 406a3a071..8d6939df7 100644 --- a/lib/pages/stakingNew/stakingView.dart +++ b/lib/pages/stakingNew/stakingView.dart @@ -900,7 +900,7 @@ class _NomineeItem extends StatelessWidget { UI.accountDisplayName(validator.accountId, accInfo, style: TextStyle( fontSize: UI.getTextSize(14, context), - fontFamily: "TitilliumWeb", + fontFamily: UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600, color: Colors.white)), Text( diff --git a/lib/pages/stakingNew/validator.dart b/lib/pages/stakingNew/validator.dart index a0652206a..73bb7bbcb 100644 --- a/lib/pages/stakingNew/validator.dart +++ b/lib/pages/stakingNew/validator.dart @@ -66,7 +66,8 @@ class Validator extends StatelessWidget { validator.accountId, accInfo, style: TextStyle( fontSize: UI.getTextSize(14, context), - fontFamily: "TitilliumWeb", + fontFamily: + UI.getFontFamily('TitilliumWeb', context), fontWeight: FontWeight.w600, color: Colors.white)), ) From 9b85aff9b6336e87ef123c7abb5e15b1ab07dbee Mon Sep 17 00:00:00 2001 From: shawn Date: Tue, 21 Jun 2022 11:50:54 +0800 Subject: [PATCH 17/17] release 0.4.8 --- CHANGELOG.md | 5 +++++ pubspec.yaml | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf0d519b6..fbdd9e75a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [0.4.8] - 20220621. + +* bump polkawallet_sdk: 0.4.8. +* ui update. + ## [0.4.6] - 20220527. * bump polkawallet_sdk: 0.4.6. diff --git a/pubspec.yaml b/pubspec.yaml index e7e3c651f..d48506b23 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: polkawallet_plugin_kusama description: The kusama/polkadot network flutter plugin for polkawallet app. -version: 0.4.6 +version: 0.4.8 homepage: environment: @@ -17,8 +17,8 @@ dependencies: flutter_svg: ^1.0.3 get_storage: ^2.0.3 json_annotation: ^4.0.1 - polkawallet_sdk: ^0.4.6 - polkawallet_ui: ^0.4.6 + polkawallet_sdk: ^0.4.8 + polkawallet_ui: ^0.4.8 fl_chart: ^0.40.2 sticky_headers: ^0.2.0 flutter_swiper: ^1.1.6 @@ -30,11 +30,11 @@ dev_dependencies: flutter_test: sdk: flutter -dependency_overrides: - polkawallet_ui: - path: ../ui - polkawallet_sdk: - path: ../sdk +#dependency_overrides: +# polkawallet_ui: +# path: ../ui +# polkawallet_sdk: +# path: ../sdk # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec