Skip to content

Commit

Permalink
Refactor Send to BTC Address action
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Jul 13, 2023
1 parent a401c3b commit 5fdef96
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,7 @@ class SendOptionsBottomSheet extends StatelessWidget {
texts.bottom_action_bar_send_btc_address,
style: theme.bottomSheetTextStyle,
),
onTap: () => _push(
context,
"/withdraw_funds",
arguments: WithdrawFundsPolicy(
WithdrawKind.withdraw_funds,
0,
snapshot.balance,
),
),
onTap: () => _sendToBTCAddress(context, snapshot.balance),
);
},
),
Expand Down Expand Up @@ -104,9 +96,18 @@ class SendOptionsBottomSheet extends StatelessWidget {
}
}

void _push(BuildContext context, String route, {Object? arguments}) {
final navigatorState = Navigator.of(context);
navigatorState.pop();
navigatorState.pushNamed(route, arguments: arguments);
void _sendToBTCAddress(BuildContext context, int maxValue) {
final navigator = Navigator.of(context);
// Close bottom sheet
navigator.pop();
// and open Send to BTC Address page
navigator.pushNamed(
"/withdraw_funds",
arguments: WithdrawFundsPolicy(
WithdrawKind.withdraw_funds,
0,
maxValue,
),
);
}
}

0 comments on commit 5fdef96

Please sign in to comment.