Adopt bottom-sheet send flow for ledger (#2140)

* feat: new bottom-sheet send flow for ledger

* refactor: use correct context in ledger bottom-sheet
This commit is contained in:
Konstantin Ullrich 2025-04-02 18:18:24 +02:00 committed by GitHub
parent 7d34494800
commit 65e771cbbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 17 deletions

View file

@ -656,20 +656,26 @@ class SendPage extends BasePage {
if (state is IsAwaitingDeviceResponseState) {
WidgetsBinding.instance.addPostFrameCallback((_) {
showPopUp<void>(
if (!context.mounted) return;
showModalBottomSheet<void>(
context: context,
builder: (BuildContext context) {
dialogContext = context;
return AlertWithOneAction(
alertTitle: S.of(context).proceed_on_device,
alertContent: S.of(context).proceed_on_device_description,
buttonText: S.of(context).cancel,
alertBarrierDismissible: false,
buttonAction: () {
isDismissible: false,
builder: (BuildContext bottomSheetContext) => InfoBottomSheet(
currentTheme: currentTheme,
titleText: S.of(bottomSheetContext).proceed_on_device,
contentImage: 'assets/images/hardware_wallet/ledger_nano_x.png',
contentImageColor:
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
content: S.of(bottomSheetContext).proceed_on_device_description,
isTwoAction: false,
actionButtonText: S.of(context).cancel,
actionButton: () {
sendViewModel.state = InitialExecutionState();
Navigator.of(context).pop();
});
});
Navigator.of(bottomSheetContext).pop();
},
),
);
});
}
});

View file

@ -393,10 +393,11 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
@action
Future<PendingTransaction?> createTransaction({ExchangeProvider? provider}) async {
try {
if (wallet.isHardwareWallet)
state = IsAwaitingDeviceResponseState();
else
state = IsExecutingState();
if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState();
pendingTransaction = await wallet.createTransaction(_credentials(provider));
if (provider is ThorChainExchangeProvider) {