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 6, 2023
1 parent 8c5c246 commit c529ca7
Showing 1 changed file with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,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 @@ -108,9 +100,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 c529ca7

Please sign in to comment.