Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ install:

fix-lint:
$(info Running flutter format)
fvm flutter format --line-length 120 --set-exit-if-changed lib test
fvm flutter format --line-length 120 --set-exit-if-changed starport_template/lib starport_template/test

42 changes: 24 additions & 18 deletions starport_template/lib/pages/assets_portfolio_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import 'package:starport_template/widgets/starport_button_bar.dart';
import 'package:transaction_signing_gateway/model/wallet_public_info.dart';

class AssetsPortfolioPage extends StatefulWidget {
const AssetsPortfolioPage({Key? key}) : super(key: key);
const AssetsPortfolioPage({
Key? key,
}) : super(key: key);

@override
State<AssetsPortfolioPage> createState() => _AssetsPortfolioPageState();
Expand All @@ -35,12 +37,6 @@ class _AssetsPortfolioPageState extends State<AssetsPortfolioPage> {

WalletPublicInfo get selectedWallet => StarportApp.walletsStore.selectedWallet;

@override
void initState() {
super.initState();
_fetchWalletBalances();
}

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -54,7 +50,10 @@ class _AssetsPortfolioPageState extends State<AssetsPortfolioPage> {
Column(
children: [
_gradientAvatar(context),
AssetPortfolioHeading(title: selectedWallet.name, onTap: _onTapDropDown),
AssetPortfolioHeading(
title: selectedWallet.name,
onTap: _onTapDropDown,
),
SizedBox(height: CosmosTheme.of(context).spacingXL),
const Divider(),
SizedBox(height: CosmosTheme.of(context).spacingL),
Expand All @@ -65,8 +64,11 @@ class _AssetsPortfolioPageState extends State<AssetsPortfolioPage> {
StarportButtonBar(
onReceivePressed: _onTapReceive,
onSendPressed: () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) => SelectAssetPage(balancesList: balancesList)));
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SelectAssetPage(balancesList: balancesList),
),
);
},
),
],
Expand Down Expand Up @@ -97,12 +99,9 @@ class _AssetsPortfolioPageState extends State<AssetsPortfolioPage> {
);
}

void _onTapAvatar(BuildContext context) =>
Navigator.of(context).push(MaterialPageRoute(builder: (context) => const TransactionHistoryPage()));

Future _fetchWalletBalances() async {
await StarportApp.walletsStore.getBalances(selectedWallet.publicAddress);
}
void _onTapAvatar(BuildContext context) => Navigator.of(context).push(
MaterialPageRoute(builder: (context) => const TransactionHistoryPage()),
);

Future<void> _onTapDropDown() async {
final wallet = await showMaterialModalBottomSheet(
Expand All @@ -125,7 +124,9 @@ class _AssetsPortfolioPageState extends State<AssetsPortfolioPage> {
backgroundColor: Colors.transparent,
builder: (context) => SizedBox(
height: MediaQuery.of(context).size.height / 1.06,
child: ReceiveMoneySheet(walletInfo: StarportApp.walletsStore.selectedWallet),
child: ReceiveMoneySheet(
walletInfo: StarportApp.walletsStore.selectedWallet,
),
),
);
}
Expand All @@ -134,7 +135,12 @@ class _AssetsPortfolioPageState extends State<AssetsPortfolioPage> {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty<WalletPublicInfo>('selectedWallet', selectedWallet))
..add(
DiagnosticsProperty<WalletPublicInfo>(
'selectedWallet',
selectedWallet,
),
)
..add(DiagnosticsProperty<bool>('isBalancesLoading', isBalancesLoading))
..add(DiagnosticsProperty<bool>('isSendMoneyLoading', isSendMoneyLoading))
..add(IterableProperty<Balance>('balancesList', balancesList))
Expand Down
4 changes: 3 additions & 1 deletion starport_template/lib/pages/create_wallet_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ class _CreateWalletPageState extends State<CreateWalletPage> {
);
if (mounted) {
await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (_) => const AssetsPortfolioPage()),
MaterialPageRoute(
builder: (_) => const AssetsPortfolioPage(),
),
(route) => false,
);
}
Expand Down
4 changes: 3 additions & 1 deletion starport_template/lib/pages/import_wallet_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ class _ImportWalletPageState extends State<ImportWalletPage> {
_showImportErrorDialog();
} else if (mounted) {
await Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (_) => const AssetsPortfolioPage()),
MaterialPageRoute(
builder: (_) => const AssetsPortfolioPage(),
),
(route) => false,
);
}
Expand Down
37 changes: 30 additions & 7 deletions starport_template/lib/pages/sign_transaction_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:starport_template/pages/assets_transfer_sheet.dart';
import 'package:starport_template/pages/passcode_prompt_page.dart';
import 'package:starport_template/starport_app.dart';
import 'package:starport_template/widgets/sign_transaction_tab_view_item.dart';
import 'package:transaction_signing_gateway/transaction_signing_gateway.dart';

class SignTransactionPage extends StatefulWidget {
const SignTransactionPage({
Expand All @@ -31,13 +32,17 @@ class SignTransactionPage extends StatefulWidget {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty<Balance>('balance', balance))
..add(DiagnosticsProperty<MsgSendTransaction>('transaction', transaction));
..add(
DiagnosticsProperty<MsgSendTransaction>('transaction', transaction),
);
}
}

class _SignTransactionPageState extends State<SignTransactionPage> {
double get recipientGetsAmount => widget.transaction.amount.value.toDouble() - widget.transaction.fee;

WalletPublicInfo get selectedWallet => StarportApp.walletsStore.selectedWallet;

@override
Widget build(BuildContext context) {
final theme = CosmosTheme.of(context);
Expand Down Expand Up @@ -123,13 +128,23 @@ class _SignTransactionPageState extends State<SignTransactionPage> {
builder: (context) => SizedBox(
height: MediaQuery.of(context).size.height / 2.24,
child: AssetsTransferSheet(
onTapDone: () => Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (_) => const AssetsPortfolioPage()),
(route) => false,
),
onTapDone: () => _onTapAssetTranserSheetDone(context),
),
),
);
}

Future<void> _onTapAssetTranserSheetDone(BuildContext context) async {
unawaited(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (_) => const AssetsPortfolioPage(),
),
(route) => false,
),
);

await StarportApp.walletsStore.getBalances(selectedWallet.publicAddress);
}

Padding _transactionFee(CosmosThemeData theme) {
Expand All @@ -152,8 +167,16 @@ class _SignTransactionPageState extends State<SignTransactionPage> {
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
super.debugFillProperties(properties);
properties
..add(DiagnosticsProperty<MsgSendTransaction>('transaction', widget.transaction))
..add(
DiagnosticsProperty<MsgSendTransaction>(
'transaction',
widget.transaction,
),
)
..add(DoubleProperty('recipientGetsAmount', recipientGetsAmount))
..add(DiagnosticsProperty<Balance>('balance', widget.balance));
..add(DiagnosticsProperty<Balance>('balance', widget.balance))
..add(
DiagnosticsProperty<WalletPublicInfo>('selectedWallet', selectedWallet),
);
}
}