Skip to content

Commit

Permalink
fix networkSelectPage addressIcon copy #137,
Browse files Browse the repository at this point in the history
fix DOT redeeming list #118
  • Loading branch information
RomeroYang committed Aug 17, 2020
1 parent b2b3852 commit 720e817
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 32 deletions.
14 changes: 11 additions & 3 deletions lib/common/components/addressIcon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@ import 'package:polka_wallet/store/app.dart';
import 'package:polka_wallet/utils/UI.dart';

class AddressIcon extends StatelessWidget {
AddressIcon(this.address, {this.size, this.pubKey, this.tapToCopy = true});
AddressIcon(
this.address, {
this.size,
this.pubKey,
this.tapToCopy = true,
this.addressToCopy,
});
final String address;
final String pubKey;
final double size;
final bool tapToCopy;
final String addressToCopy;

@override
Widget build(BuildContext context) {
Expand All @@ -36,8 +43,9 @@ class AddressIcon extends StatelessWidget {
? Image.asset('assets/images/assets/Assets_nav_0.png')
: SvgPicture.string(rawSvg),
),
onTap:
tapToCopy ? () => UI.copyAndNotify(context, addressView) : null,
onTap: tapToCopy
? () => UI.copyAndNotify(context, addressToCopy ?? addressView)
: null,
);
},
);
Expand Down
4 changes: 2 additions & 2 deletions lib/js_service_acala/src/service/acala.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ async function fetchDexPoolInfo(currencyId, address) {
proportion = balanceToNumber(pool[2]) / balanceToNumber(pool[1]);
}
const reward =
balanceToNumber(pool[3][0]) * proportion - balanceToNumber(pool[4]);
balanceToNumber(pool[3][0]) * proportion - balanceToNumber(pool[4]);
return {
token: currencyId,
pool: pool[0],
Expand Down Expand Up @@ -247,7 +247,7 @@ async function fetchHomaUserInfo(api, address) {
const start = stakingPool.currentEra.toNumber();
const duration = stakingPool.bondingDuration.toNumber();
const claims = [];
for (let i = start; i < start + duration; i++) {
for (let i = start; i < start + duration + 2; i++) {
const claimed = await api.query.stakingPool.claimedUnbond(address, i);
if (claimed.gtn(0)) {
claims[claims.length] = {
Expand Down
1 change: 0 additions & 1 deletion lib/page-acala/earn/addLiquidityPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'package:polka_wallet/common/components/currencyWithIcon.dart';
import 'package:polka_wallet/common/components/roundedButton.dart';
import 'package:polka_wallet/common/components/roundedCard.dart';
import 'package:polka_wallet/common/consts/settings.dart';
import 'package:polka_wallet/common/regInputFormatter.dart';
import 'package:polka_wallet/page-acala/earn/earnPage.dart';
import 'package:polka_wallet/page/account/txConfirmPage.dart';
import 'package:polka_wallet/service/substrateApi/api.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/page-acala/earn/withdrawLiquidityPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:polka_wallet/common/components/outlinedButtonSmall.dart';
import 'package:polka_wallet/common/components/roundedButton.dart';
import 'package:polka_wallet/common/components/roundedCard.dart';
import 'package:polka_wallet/common/consts/settings.dart';
import 'package:polka_wallet/common/regInputFormatter.dart';
import 'package:polka_wallet/page-acala/earn/earnPage.dart';
import 'package:polka_wallet/page/account/txConfirmPage.dart';
import 'package:polka_wallet/service/substrateApi/api.dart';
Expand Down
39 changes: 22 additions & 17 deletions lib/page-acala/homa/homaPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -206,23 +206,28 @@ class _HomaPageState extends State<HomaPage> {
(pool.currentEra ?? 0))
.toInt()
.toString();
return Row(
children: <Widget>[
InfoItem(
title: I18n.of(context)
.assets['amount'],
content:
Fmt.priceFloorBigInt(
i.claimed,
decimals: decimals),
),
InfoItem(
title:
dic['homa.user.time'],
content:
'$unlockTime Era ≈ $unlockTime ${dic['homa.redeem.day']}',
),
],
return Padding(
padding:
EdgeInsets.only(bottom: 8),
child: Row(
children: <Widget>[
InfoItem(
title: I18n.of(context)
.assets['amount'],
content:
Fmt.priceFloorBigInt(
i.claimed,
decimals:
decimals),
),
InfoItem(
title:
dic['homa.user.time'],
content:
'$unlockTime Era ≈ $unlockTime ${dic['homa.redeem.day']}',
),
],
),
);
}).toList(),
)
Expand Down
6 changes: 3 additions & 3 deletions lib/page-acala/homa/mintPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:polka_wallet/common/components/currencyWithIcon.dart';
import 'package:polka_wallet/common/components/roundedButton.dart';
import 'package:polka_wallet/common/components/roundedCard.dart';
import 'package:polka_wallet/common/regInputFormatter.dart';
import 'package:polka_wallet/page-acala/homa/homaHistoryPage.dart';
import 'package:polka_wallet/page-acala/homa/homaPage.dart';
import 'package:polka_wallet/page/account/txConfirmPage.dart';
import 'package:polka_wallet/service/substrateApi/api.dart';
import 'package:polka_wallet/store/acala/types/stakingPoolInfoData.dart';
Expand Down Expand Up @@ -89,8 +89,8 @@ class _MintPageState extends State<MintPage> {
res['amountReceive'] = receive;
store.acala.setHomaTxs([res]);
Navigator.popUntil(
txPageContext, ModalRoute.withName(MintPage.route));
_refreshKey.currentState.show();
txPageContext, ModalRoute.withName(HomaPage.route));
globalHomaRefreshKey.currentState.show();
}
};
Navigator.of(context).pushNamed(TxConfirmPage.route, arguments: args);
Expand Down
5 changes: 3 additions & 2 deletions lib/page-acala/homa/redeemPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:polka_wallet/common/components/roundedButton.dart';
import 'package:polka_wallet/common/components/roundedCard.dart';
import 'package:polka_wallet/common/consts/settings.dart';
import 'package:polka_wallet/page-acala/homa/homaHistoryPage.dart';
import 'package:polka_wallet/page-acala/homa/homaPage.dart';
import 'package:polka_wallet/page/account/txConfirmPage.dart';
import 'package:polka_wallet/service/substrateApi/api.dart';
import 'package:polka_wallet/store/acala/types/stakingPoolInfoData.dart';
Expand Down Expand Up @@ -158,8 +159,8 @@ class _HomaRedeemPageState extends State<HomaRedeemPage> {
res['amountReceive'] = receive;
store.acala.setHomaTxs([res]);
Navigator.popUntil(
txPageContext, ModalRoute.withName(HomaRedeemPage.route));
_refreshKey.currentState.show();
txPageContext, ModalRoute.withName(HomaPage.route));
globalHomaRefreshKey.currentState.show();
}
};
Navigator.of(context).pushNamed(TxConfirmPage.route, arguments: args);
Expand Down
1 change: 0 additions & 1 deletion lib/page-acala/loan/loanCreatePage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:polka_wallet/common/components/roundedButton.dart';
import 'package:polka_wallet/common/consts/settings.dart';
import 'package:polka_wallet/common/regInputFormatter.dart';
import 'package:polka_wallet/page-acala/loan/loanAdjustPage.dart';
import 'package:polka_wallet/page-acala/loan/loanInfoPanel.dart';
import 'package:polka_wallet/page/account/txConfirmPage.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/page-acala/swap/swapPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:polka_wallet/common/components/outlinedButtonSmall.dart';
import 'package:polka_wallet/common/components/roundedButton.dart';
import 'package:polka_wallet/common/components/roundedCard.dart';
import 'package:polka_wallet/common/consts/settings.dart';
import 'package:polka_wallet/common/regInputFormatter.dart';
import 'package:polka_wallet/page-acala/swap/swapHistoryPage.dart';
import 'package:polka_wallet/page/account/txConfirmPage.dart';
import 'package:polka_wallet/page/assets/transfer/currencySelectPage.dart';
Expand Down
2 changes: 1 addition & 1 deletion lib/page/networkSelectPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class _NetworkSelectPageState extends State<NetworkSelectPage> {
: Border.all(color: Theme.of(context).cardColor),
margin: EdgeInsets.only(bottom: 16),
child: ListTile(
leading: AddressIcon('', pubKey: i.pubKey),
leading: AddressIcon('', pubKey: i.pubKey, addressToCopy: address),
title: Text(Fmt.accountName(context, i)),
subtitle: Text(Fmt.address(address ?? 'address xxxx')),
onTap: _networkChanging ? null : () => _onSelect(i, address),
Expand Down

0 comments on commit 720e817

Please sign in to comment.