diff --git a/CHANGELOG.md b/CHANGELOG.md index 13cf2266..373616e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # 0.8.3 - add tx sending with tips - fix Acala token transfer history bug +- fix UI bugs of Acala pages - fix staking history display bug +- fix scan to transfer balance display # 0.8.2 - add acala TC4 support diff --git a/android/app/appcenter-post-clone.sh b/android/app/appcenter-post-clone.sh index 9b96feda..be8ce4bf 100644 --- a/android/app/appcenter-post-clone.sh +++ b/android/app/appcenter-post-clone.sh @@ -22,10 +22,10 @@ sudo installer -store -pkg "$HOME/Downloads/node-installer.pkg" -target "/" cd ./lib/js_service_kusama && yarn install && yarn run build && cd ../.. cd ./lib/js_service_acala && yarn install && yarn run build && cd ../.. -flutter build apk --release -flutter build appbundle --release +flutter build apk --release --flavor prod +flutter build appbundle --release --flavor prod # copy the APK where AppCenter will find it -mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/release/app-release.apk $_ +mkdir -p android/app/build/outputs/apk/; mv build/app/outputs/apk/prod/release/app-prod-release.apk $_ # copy the AAB where AppCenter will find it -mkdir -p android/app/build/outputs/bundle/; mv build/app/outputs/bundle/release/app-release.aab $_ \ No newline at end of file +mkdir -p android/app/build/outputs/bundle/; mv build/app/outputs/bundle/prodRelease/app-prod-release.aab $_ \ No newline at end of file diff --git a/lib/common/components/currencyWithIcon.dart b/lib/common/components/currencyWithIcon.dart index 07653b83..7a43912b 100644 --- a/lib/common/components/currencyWithIcon.dart +++ b/lib/common/components/currencyWithIcon.dart @@ -5,13 +5,11 @@ class CurrencyWithIcon extends StatelessWidget { CurrencyWithIcon( this.symbol, { this.textStyle, - this.textWidth, this.trailing, this.mainAxisAlignment, }); final String symbol; - final double textWidth; final TextStyle textStyle; final MainAxisAlignment mainAxisAlignment; final Widget trailing; @@ -27,8 +25,8 @@ class CurrencyWithIcon extends StatelessWidget { child: Image.asset('assets/images/assets/${symbol.toUpperCase()}.png'), ), - Container( - width: textWidth ?? 64, + Expanded( + flex: 0, child: Text( symbol, style: textStyle, diff --git a/lib/common/consts/settings.dart b/lib/common/consts/settings.dart index 4bfa4025..eb12b526 100644 --- a/lib/common/consts/settings.dart +++ b/lib/common/consts/settings.dart @@ -79,4 +79,4 @@ const String acala_stable_coin = 'AUSD'; const String acala_stable_coin_view = 'aUSD'; /// test app versions -const String app_beta_version = '0.8.3-beta.1'; +const String app_beta_version = '0.8.3-beta.2'; diff --git a/lib/js_service_kusama/src/service/gov.js b/lib/js_service_kusama/src/service/gov.js index 2fb3b1cc..c0347eff 100644 --- a/lib/js_service_kusama/src/service/gov.js +++ b/lib/js_service_kusama/src/service/gov.js @@ -26,6 +26,12 @@ async function fetchReferendums(address) { const callData = api.registry.findMetaCall(image.proposal.callIndex); const parsedMeta = _extractMetaData(callData.meta); image.proposal = image.proposal.toHuman(); + if (image.proposal.method == "setCode") { + const args = image.proposal.args; + image.proposal.args = [ + args[0].slice(0, 16) + "..." + args[0].slice(args[0].length - 16), + ]; + } const changes = approxChanges(status.threshold, sqrtElectorate, { votedAye, diff --git a/lib/page-acala/earn/addLiquidityPage.dart b/lib/page-acala/earn/addLiquidityPage.dart index a15dd9b4..ba87394f 100644 --- a/lib/page-acala/earn/addLiquidityPage.dart +++ b/lib/page-acala/earn/addLiquidityPage.dart @@ -179,7 +179,6 @@ class _AddLiquidityPageState extends State { width: inputWidth, child: CurrencyWithIcon( token, - textWidth: 48, textStyle: Theme.of(context).textTheme.headline4, ), ), @@ -192,7 +191,6 @@ class _AddLiquidityPageState extends State { width: inputWidth, child: CurrencyWithIcon( acala_stable_coin_view, - textWidth: 48, textStyle: Theme.of(context).textTheme.headline4, ), ), @@ -289,39 +287,47 @@ class _AddLiquidityPageState extends State { ], ), ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - width: inputWidth, - child: Text( - '${dicAssets['balance']}: ${Fmt.priceFloorBigInt(balanceTokenUser, lengthMax: 3)}', - style: TextStyle( - fontSize: 14, - color: Theme.of(context).unselectedWidgetColor, + Padding( + padding: EdgeInsets.only(top: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Container( + width: inputWidth, + child: Text( + '${dicAssets['balance']}: ${Fmt.priceFloorBigInt(balanceTokenUser, lengthMax: 3)}', + style: TextStyle( + fontSize: 14, + color: + Theme.of(context).unselectedWidgetColor, + ), ), ), - ), - Container( - width: inputWidth, - child: Text( - '${dicAssets['balance']}: ${Fmt.priceFloorBigInt(balanceStableCoinUser, lengthMax: 2)}', - style: TextStyle( - fontSize: 14, - color: Theme.of(context).unselectedWidgetColor, + Container( + width: inputWidth, + child: Text( + '${dicAssets['balance']}: ${Fmt.priceFloorBigInt(balanceStableCoinUser, lengthMax: 2)}', + style: TextStyle( + fontSize: 14, + color: + Theme.of(context).unselectedWidgetColor, + ), ), - ), - ) - ], + ) + ], + ), ), Divider(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - dic['dex.rate'], - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), + Expanded( + child: Text( + dic['dex.rate'], + style: TextStyle( + color: Theme.of(context).unselectedWidgetColor, + ), + ), ), Text( '1 $token = ${Fmt.doubleFormat(swapRatio, length: 2)} $acala_stable_coin_view'), @@ -330,22 +336,30 @@ class _AddLiquidityPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - dic['earn.pool'], - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), + Expanded( + child: Text( + dic['earn.pool'], + style: TextStyle( + color: + Theme.of(context).unselectedWidgetColor), + ), ), Text( - '${Fmt.doubleFormat(amountToken)} $token + ${Fmt.doubleFormat(amountStableCoin, length: 2)} $acala_stable_coin_view'), + '${Fmt.doubleFormat(amountToken)} $token\n+ ${Fmt.doubleFormat(amountStableCoin, length: 2)} $acala_stable_coin_view', + textAlign: TextAlign.right, + ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - dic['earn.share'], - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), + Expanded( + child: Text( + dic['earn.share'], + style: TextStyle( + color: + Theme.of(context).unselectedWidgetColor), + ), ), Text(Fmt.ratio(userShareNew)), ], diff --git a/lib/page-acala/earn/withdrawLiquidityPage.dart b/lib/page-acala/earn/withdrawLiquidityPage.dart index d0c60690..2fe4c74a 100644 --- a/lib/page-acala/earn/withdrawLiquidityPage.dart +++ b/lib/page-acala/earn/withdrawLiquidityPage.dart @@ -255,10 +255,13 @@ class _WithdrawLiquidityPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - dic['dex.rate'], - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), + Expanded( + child: Text( + dic['dex.rate'], + style: TextStyle( + color: Theme.of(context).unselectedWidgetColor, + ), + ), ), Text( '1 $token = ${Fmt.doubleFormat(swapRatio, length: 2)} $acala_stable_coin_view'), @@ -267,22 +270,30 @@ class _WithdrawLiquidityPageState extends State { Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - dic['earn.pool'], - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), + Expanded( + child: Text( + dic['earn.pool'], + style: TextStyle( + color: Theme.of(context).unselectedWidgetColor, + ), + ), ), Text( - '${Fmt.doubleFormat(poolToken)} $token + ${Fmt.doubleFormat(poolStableCoin, length: 2)} $acala_stable_coin_view'), + '${Fmt.doubleFormat(poolToken)} $token\n+ ${Fmt.doubleFormat(poolStableCoin, length: 2)} $acala_stable_coin_view', + textAlign: TextAlign.right, + ), ], ), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - dic['earn.share'], - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), + Expanded( + child: Text( + dic['earn.share'], + style: TextStyle( + color: Theme.of(context).unselectedWidgetColor, + ), + ), ), Text(Fmt.ratio(shareRatioNew)), ], diff --git a/lib/page-acala/homa/mintPage.dart b/lib/page-acala/homa/mintPage.dart index ee51ee63..6bb1b488 100644 --- a/lib/page-acala/homa/mintPage.dart +++ b/lib/page-acala/homa/mintPage.dart @@ -119,8 +119,6 @@ class _MintPageState extends State { final Map dicAssets = I18n.of(context).assets; int decimals = store.settings.networkState.tokenDecimals; - final double inputWidth = MediaQuery.of(context).size.width / 3; - BigInt balance = Fmt.balanceInt(store.assets.tokenBalances['DOT']); StakingPoolInfoData pool = store.acala.stakingPoolInfo; @@ -141,96 +139,104 @@ class _MintPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CurrencyWithIcon( - 'DOT', - textWidth: 48, - textStyle: Theme.of(context).textTheme.headline4, - ), - Icon( - Icons.repeat, - color: Theme.of(context).primaryColor, - ), - CurrencyWithIcon( - 'LDOT', - textWidth: 48, - textStyle: Theme.of(context).textTheme.headline4, - ), - ], - ), Form( key: _formKey, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: inputWidth, - child: TextFormField( - decoration: InputDecoration( - hintText: dic['dex.pay'], - labelText: dic['dex.pay'], - suffix: GestureDetector( - child: Icon( - CupertinoIcons.clear_thick_circled, - color: Theme.of(context).disabledColor, - size: 18, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CurrencyWithIcon( + 'DOT', + textStyle: + Theme.of(context).textTheme.headline4, + ), + TextFormField( + decoration: InputDecoration( + hintText: dic['dex.pay'], + labelText: dic['dex.pay'], + suffix: GestureDetector( + child: Icon( + CupertinoIcons.clear_thick_circled, + color: + Theme.of(context).disabledColor, + size: 18, + ), + onTap: () { + WidgetsBinding.instance + .addPostFrameCallback((_) => + _amountPayCtrl.clear()); + }, + ), ), - onTap: () { - WidgetsBinding.instance - .addPostFrameCallback( - (_) => _amountPayCtrl.clear()); + inputFormatters: [ + RegExInputFormatter.withRegex( + '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') + ], + controller: _amountPayCtrl, + keyboardType: + TextInputType.numberWithOptions( + decimal: true), + validator: (v) { + if (v.isEmpty) { + return dicAssets['amount.error']; + } + if (double.parse(v.trim()) >= + Fmt.bigIntToDouble(balance, + decimals: decimals)) { + return dicAssets['amount.low']; + } + return null; }, + onChanged: _onSupplyAmountChange, + ), + Padding( + padding: EdgeInsets.only(top: 8), + child: Text( + '${dicAssets['balance']}: ${Fmt.token(balance, decimals: decimals)} DOT', + style: TextStyle( + color: Theme.of(context) + .unselectedWidgetColor), + ), ), - ), - inputFormatters: [ - RegExInputFormatter.withRegex( - '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') ], - controller: _amountPayCtrl, - keyboardType: TextInputType.numberWithOptions( - decimal: true), - validator: (v) { - if (v.isEmpty) { - return dicAssets['amount.error']; - } - if (double.parse(v.trim()) >= - Fmt.bigIntToDouble(balance, - decimals: decimals)) { - return dicAssets['amount.low']; - } - return null; - }, - onChanged: _onSupplyAmountChange, ), ), - Container( - width: inputWidth, - child: TextFormField( - decoration: InputDecoration( - labelText: dic['dex.receive'], - suffix: Container( - height: 21, - width: 8, + Padding( + padding: EdgeInsets.fromLTRB(8, 2, 8, 0), + child: Icon( + Icons.repeat, + color: Theme.of(context).primaryColor, + ), + ), + Expanded( + child: Column( + children: [ + CurrencyWithIcon( + 'LDOT', + textStyle: + Theme.of(context).textTheme.headline4, ), - ), - controller: _amountReceiveCtrl, - readOnly: true, + TextFormField( + decoration: InputDecoration( + labelText: dic['dex.receive'], + suffix: Container( + height: 16, + width: 8, + ), + ), + controller: _amountReceiveCtrl, + readOnly: true, + ), + ], ), - ) + ), ], ), ), - Padding( - padding: EdgeInsets.only(top: 8), - child: Text( - '${dicAssets['balance']}: ${Fmt.token(balance, decimals: decimals)} DOT', - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), - ), - ), Divider(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/page-acala/homa/redeemPage.dart b/lib/page-acala/homa/redeemPage.dart index b99e67e0..4cb9d547 100644 --- a/lib/page-acala/homa/redeemPage.dart +++ b/lib/page-acala/homa/redeemPage.dart @@ -187,8 +187,6 @@ class _HomaRedeemPageState extends State { final Map dicAssets = I18n.of(context).assets; int decimals = store.settings.networkState.tokenDecimals; - final double inputWidth = MediaQuery.of(context).size.width / 3; - BigInt balance = Fmt.balanceInt(store.assets.tokenBalances['LDOT']); StakingPoolInfoData pool = store.acala.stakingPoolInfo; @@ -230,100 +228,110 @@ class _HomaRedeemPageState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - CurrencyWithIcon( - 'LDOT', - textWidth: 48, - textStyle: Theme.of(context).textTheme.headline4, - ), - Icon( - Icons.repeat, - color: Theme.of(context).primaryColor, - ), - CurrencyWithIcon( - 'DOT', - textWidth: 48, - textStyle: Theme.of(context).textTheme.headline4, - ), - ], - ), Form( key: _formKey, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: inputWidth, - child: TextFormField( - decoration: InputDecoration( - hintText: dic['dex.pay'], - labelText: dic['dex.pay'], - suffix: GestureDetector( - child: Icon( - CupertinoIcons.clear_thick_circled, - color: Theme.of(context).disabledColor, - size: 18, + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CurrencyWithIcon( + 'LDOT', + textStyle: + Theme.of(context).textTheme.headline4, + ), + TextFormField( + decoration: InputDecoration( + hintText: dic['dex.pay'], + labelText: dic['dex.pay'], + suffix: GestureDetector( + child: Icon( + CupertinoIcons.clear_thick_circled, + color: + Theme.of(context).disabledColor, + size: 18, + ), + onTap: () { + WidgetsBinding.instance + .addPostFrameCallback((_) => + _amountPayCtrl.clear()); + }, + ), ), - onTap: () { - WidgetsBinding.instance - .addPostFrameCallback( - (_) => _amountPayCtrl.clear()); + inputFormatters: [ + RegExInputFormatter.withRegex( + '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') + ], + controller: _amountPayCtrl, + keyboardType: + TextInputType.numberWithOptions( + decimal: true), + validator: (v) { + if (v.isEmpty) { + return dicAssets['amount.error']; + } + if (double.parse(v.trim()) >= + Fmt.bigIntToDouble(balance, + decimals: decimals)) { + return dicAssets['amount.low']; + } + if (_radioSelect < 2 && + double.parse(v.trim()) > + available) { + return dic['homa.pool.low']; + } + return null; }, + onChanged: _onSupplyAmountChange, + ), + Padding( + padding: EdgeInsets.only(top: 8), + child: Text( + '${dicAssets['balance']}: ${Fmt.token(balance, decimals: decimals)} LDOT', + style: TextStyle( + color: Theme.of(context) + .unselectedWidgetColor), + ), ), - ), - inputFormatters: [ - RegExInputFormatter.withRegex( - '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') ], - controller: _amountPayCtrl, - keyboardType: TextInputType.numberWithOptions( - decimal: true), - validator: (v) { - if (v.isEmpty) { - return dicAssets['amount.error']; - } - if (double.parse(v.trim()) >= - Fmt.bigIntToDouble(balance, - decimals: decimals)) { - return dicAssets['amount.low']; - } - if (_radioSelect < 2 && - double.parse(v.trim()) > available) { - return dic['homa.pool.low']; - } - return null; - }, - onChanged: _onSupplyAmountChange, ), ), - Container( - width: inputWidth, - child: TextFormField( - decoration: InputDecoration( - labelText: dic['dex.receive'], - suffix: Container( - height: 21, - width: 8, + Padding( + padding: EdgeInsets.fromLTRB(8, 2, 8, 0), + child: Icon( + Icons.repeat, + color: Theme.of(context).primaryColor, + ), + ), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + CurrencyWithIcon( + 'DOT', + textStyle: + Theme.of(context).textTheme.headline4, ), - ), - controller: _amountReceiveCtrl, - readOnly: true, + TextFormField( + decoration: InputDecoration( + labelText: dic['dex.receive'], + suffix: Container( + height: 16, + width: 8, + ), + ), + controller: _amountReceiveCtrl, + readOnly: true, + ), + ], ), - ) + ), ], ), ), - Padding( - padding: EdgeInsets.only(top: 8), - child: Text( - '${dicAssets['balance']}: ${Fmt.token(balance, decimals: decimals)} LDOT', - style: TextStyle( - color: Theme.of(context).unselectedWidgetColor), - ), - ), Divider(), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, diff --git a/lib/page-acala/swap/swapPage.dart b/lib/page-acala/swap/swapPage.dart index cc18e511..f5eeaf4e 100644 --- a/lib/page-acala/swap/swapPage.dart +++ b/lib/page-acala/swap/swapPage.dart @@ -226,8 +226,6 @@ class _SwapPageState extends State { int decimals = store.settings.networkState.tokenDecimals; List swapPair = store.acala.currentSwapPair; - final double inputWidth = MediaQuery.of(context).size.width / 3; - BigInt balance = BigInt.zero; if (store.acala.swapTokens != null && swapPair.length > 0) { balance = Fmt.balanceInt( @@ -236,7 +234,6 @@ class _SwapPageState extends State { Color primary = Theme.of(context).primaryColor; Color grey = Theme.of(context).unselectedWidgetColor; - Color lightGrey = Theme.of(context).dividerColor; return Scaffold( appBar: AppBar(title: Text(dic['dex.title']), centerTitle: true), @@ -253,39 +250,6 @@ class _SwapPageState extends State { ? Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - GestureDetector( - child: CurrencyWithIcon( - swapPair[0], - textWidth: 48, - textStyle: - Theme.of(context).textTheme.headline4, - trailing: Icon(Icons.keyboard_arrow_down), - ), - onTap: () => _selectCurrencyPay(), - ), - IconButton( - icon: Icon( - Icons.repeat, - color: Theme.of(context).primaryColor, - ), - onPressed: () => _switchPair(), - ), - GestureDetector( - child: CurrencyWithIcon( - swapPair[1], - textWidth: 48, - textStyle: - Theme.of(context).textTheme.headline4, - trailing: Icon(Icons.keyboard_arrow_down), - ), - onTap: () => _selectCurrencyReceive(), - ) - ], - ), Form( key: _formKey, child: Row( @@ -293,104 +257,152 @@ class _SwapPageState extends State { MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - width: inputWidth, - child: TextFormField( - decoration: InputDecoration( - hintText: dic['dex.pay'], - labelText: dic['dex.pay'], - suffix: GestureDetector( - child: Icon( - CupertinoIcons - .clear_thick_circled, - color: Theme.of(context) - .disabledColor, - size: 18, + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + GestureDetector( + child: CurrencyWithIcon( + swapPair[0], + textStyle: Theme.of(context) + .textTheme + .headline4, + trailing: Icon( + Icons.keyboard_arrow_down), + ), + onTap: () => _selectCurrencyPay(), + ), + TextFormField( + decoration: InputDecoration( + hintText: dic['dex.pay'], + labelText: dic['dex.pay'], + suffix: GestureDetector( + child: Icon( + CupertinoIcons + .clear_thick_circled, + color: Theme.of(context) + .disabledColor, + size: 18, + ), + onTap: () { + WidgetsBinding.instance + .addPostFrameCallback( + (_) => _amountPayCtrl + .clear()); + }, + ), ), - onTap: () { - WidgetsBinding.instance - .addPostFrameCallback((_) => - _amountPayCtrl.clear()); + inputFormatters: [ + RegExInputFormatter.withRegex( + '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') + ], + controller: _amountPayCtrl, + keyboardType: + TextInputType.numberWithOptions( + decimal: true), + validator: (v) { + if (v.isEmpty) { + return dicAssets[ + 'amount.error']; + } + if (double.parse(v.trim()) > + Fmt.bigIntToDouble(balance, + decimals: decimals)) { + return dicAssets['amount.low']; + } + return null; }, + onChanged: _onSupplyAmountChange, + ), + Padding( + padding: EdgeInsets.only(top: 8), + child: Text( + '${dicAssets['balance']}: ${Fmt.token(balance, decimals: decimals)} ${swapPair[0]}', + style: TextStyle( + color: Theme.of(context) + .unselectedWidgetColor), + ), ), - ), - inputFormatters: [ - RegExInputFormatter.withRegex( - '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') ], - controller: _amountPayCtrl, - keyboardType: - TextInputType.numberWithOptions( - decimal: true), - validator: (v) { - if (v.isEmpty) { - return dicAssets['amount.error']; - } - if (double.parse(v.trim()) > - Fmt.bigIntToDouble(balance, - decimals: decimals)) { - return dicAssets['amount.low']; - } - return null; - }, - onChanged: _onSupplyAmountChange, ), ), - Container( - width: inputWidth, - child: TextFormField( - decoration: InputDecoration( - hintText: dic['dex.receive'], - labelText: dic['dex.receive'], - suffix: GestureDetector( - child: Icon( - CupertinoIcons - .clear_thick_circled, - color: Theme.of(context) - .disabledColor, - size: 18, + GestureDetector( + child: Padding( + padding: + EdgeInsets.fromLTRB(8, 2, 8, 0), + child: Icon( + Icons.repeat, + color: Theme.of(context).primaryColor, + ), + ), + onTap: () => _switchPair(), + ), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + GestureDetector( + child: CurrencyWithIcon( + swapPair[1], + textStyle: Theme.of(context) + .textTheme + .headline4, + trailing: Icon( + Icons.keyboard_arrow_down), ), - onTap: () { - WidgetsBinding.instance - .addPostFrameCallback((_) => - _amountReceiveCtrl - .clear()); - }, + onTap: () => + _selectCurrencyReceive(), ), - ), - inputFormatters: [ - RegExInputFormatter.withRegex( - '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') - ], - controller: _amountReceiveCtrl, - keyboardType: - TextInputType.numberWithOptions( - decimal: true), - validator: (v) { - if (v.isEmpty) { - return dicAssets['amount.error']; - } - // check if pool has sufficient assets + TextFormField( + decoration: InputDecoration( + hintText: dic['dex.receive'], + labelText: dic['dex.receive'], + suffix: GestureDetector( + child: Icon( + CupertinoIcons + .clear_thick_circled, + color: Theme.of(context) + .disabledColor, + size: 18, + ), + onTap: () { + WidgetsBinding.instance + .addPostFrameCallback( + (_) => + _amountReceiveCtrl + .clear()); + }, + ), + ), + inputFormatters: [ + RegExInputFormatter.withRegex( + '^[0-9]{0,6}(\\.[0-9]{0,$decimals})?\$') + ], + controller: _amountReceiveCtrl, + keyboardType: + TextInputType.numberWithOptions( + decimal: true), + validator: (v) { + if (v.isEmpty) { + return dicAssets[ + 'amount.error']; + } + // check if pool has sufficient assets // if (true) { // return dicAssets['amount.low']; // } - return null; - }, - onChanged: _onTargetAmountChange, + return null; + }, + onChanged: _onTargetAmountChange, + ), + ], ), ) ], ), ), - Padding( - padding: EdgeInsets.only(top: 8), - child: Text( - '${dicAssets['balance']}: ${Fmt.token(balance, decimals: decimals)} ${swapPair[0]}', - style: TextStyle( - color: Theme.of(context) - .unselectedWidgetColor), - ), - ), Divider(), Row( mainAxisAlignment: diff --git a/lib/page/assets/index.dart b/lib/page/assets/index.dart index 2ef8a22f..39dbf9c8 100644 --- a/lib/page/assets/index.dart +++ b/lib/page/assets/index.dart @@ -344,7 +344,7 @@ class _AssetsState extends State { } WidgetsBinding.instance.addPostFrameCallback((_) { if (!store.settings.loading) { - globalBalanceRefreshKey.currentState.show(); + globalBalanceRefreshKey.currentState?.show(); } }); super.initState(); diff --git a/lib/page/assets/transfer/transferPage.dart b/lib/page/assets/transfer/transferPage.dart index 18acdb4a..5d9a75ed 100644 --- a/lib/page/assets/transfer/transferPage.dart +++ b/lib/page/assets/transfer/transferPage.dart @@ -137,11 +137,9 @@ class _TransferPageState extends State { _addressCtrl.text = args.address; }); } - if (args.symbol != null) { - setState(() { - _tokenSymbol = args.symbol; - }); - } + setState(() { + _tokenSymbol = args.symbol ?? store.settings.networkState.tokenSymbol; + }); webApi.assets.fetchBalance(); }); diff --git a/lib/utils/UI.dart b/lib/utils/UI.dart index b0997b76..7d730448 100644 --- a/lib/utils/UI.dart +++ b/lib/utils/UI.dart @@ -44,36 +44,6 @@ class UI { } } - static void showCurrencyPicker(BuildContext context, List currencyIds, - String selected, Function(String) onChange) { - showCupertinoModalPopup( - context: context, - builder: (_) => Container( - height: MediaQuery.of(context).copyWith().size.height / 3, - child: CupertinoPicker( - backgroundColor: Colors.white, - itemExtent: 56, - scrollController: FixedExtentScrollController( - initialItem: currencyIds.indexOf(selected)), - children: currencyIds - .map( - (i) => Padding( - padding: EdgeInsets.all(16), - child: CurrencyWithIcon( - i, - mainAxisAlignment: MainAxisAlignment.center, - ), - ), - ) - .toList(), - onSelectedItemChanged: (v) { - onChange(currencyIds[v]); - }, - ), - ), - ); - } - static Future checkUpdate(BuildContext context, Map versions, {bool autoCheck = false}) async { if (versions == null || !Platform.isAndroid && !Platform.isIOS) return; diff --git a/lib/utils/i18n/acala.dart b/lib/utils/i18n/acala.dart index 0a09e6c2..cd148265 100644 --- a/lib/utils/i18n/acala.dart +++ b/lib/utils/i18n/acala.dart @@ -50,7 +50,7 @@ const Map enDex = { 'earn.get': 'Withdraw Rewards', 'earn.reward.year': 'Annualized Rewards', 'earn.fee': 'Swap Fee', - 'earn.pool': 'Current Pool Size', + 'earn.pool': 'Current Pool', 'earn.deposit.user': 'My Deposit', 'earn.share': 'Pool Share', 'earn.reward': 'System Rewards', diff --git a/pubspec.yaml b/pubspec.yaml index d493bf81..7b009148 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: PolkaWallet made with Flutter. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.8.3+831 +version: 0.8.3+832 environment: sdk: ">=2.1.0 <3.0.0" diff --git a/versions.json b/versions.json index 5151e1c6..35c14c75 100644 --- a/versions.json +++ b/versions.json @@ -1,34 +1,36 @@ { "android": { - "version": "0.8.1", - "version-beta": "0.8.1-beta.3", - "url": "https://apps.acala.network/polkawallet/polkawallet-v0.8.0-beta.3.apk", + "version": "0.8.3", + "version-beta": "0.8.3-beta.2", + "url": "https://apps.acala.network/polkawallet/polkawallet-v0.8.3-beta.2.apk", "info": { "en": [ "You need to UNINSTALL the App to update to new version, BACKUP your mnemonics before that.", "add offline signature", - "fix bugs of social recovery" + "fix bugs of social recovery", + "fix UI of Acala pages" ], "zh": [ - "该版本与旧版本不兼容,需要先卸载旧版本,请保存好助记词。", + "该版本与 v0.7.x 旧版本不兼容,需要先卸载旧版本,请保存好助记词。", "新增离线签名功能", - "修复社交恢复的bug" + "修复社交恢复的bug", + "修复Acala页面的UI问题" ] } }, "ios": { - "version": "0.8.1", - "version-beta": "0.8.1-beta.3", + "version": "0.8.3", + "version-beta": "0.8.3-beta.2", "info": { "en": [ - "You need to UNINSTALL the App to update to new version, BACKUP your mnemonics before that.", "add offline signature", - "fix bugs of social recovery" + "fix bugs of social recovery", + "fix UI of Acala pages" ], "zh": [ - "该版本与旧版本不兼容,需要先卸载旧版本,请保存好助记词。", "新增离线签名功能", - "修复社交恢复的bug" + "修复社交恢复的bug", + "修复Acala页面的UI问题" ] } }