mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 12:29:51 +00:00
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:
parent
7d34494800
commit
65e771cbbe
2 changed files with 24 additions and 17 deletions
|
@ -656,20 +656,26 @@ class SendPage extends BasePage {
|
||||||
|
|
||||||
if (state is IsAwaitingDeviceResponseState) {
|
if (state is IsAwaitingDeviceResponseState) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
showPopUp<void>(
|
if (!context.mounted) return;
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
showModalBottomSheet<void>(
|
||||||
dialogContext = context;
|
context: context,
|
||||||
return AlertWithOneAction(
|
isDismissible: false,
|
||||||
alertTitle: S.of(context).proceed_on_device,
|
builder: (BuildContext bottomSheetContext) => InfoBottomSheet(
|
||||||
alertContent: S.of(context).proceed_on_device_description,
|
currentTheme: currentTheme,
|
||||||
buttonText: S.of(context).cancel,
|
titleText: S.of(bottomSheetContext).proceed_on_device,
|
||||||
alertBarrierDismissible: false,
|
contentImage: 'assets/images/hardware_wallet/ledger_nano_x.png',
|
||||||
buttonAction: () {
|
contentImageColor:
|
||||||
sendViewModel.state = InitialExecutionState();
|
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||||
Navigator.of(context).pop();
|
content: S.of(bottomSheetContext).proceed_on_device_description,
|
||||||
});
|
isTwoAction: false,
|
||||||
});
|
actionButtonText: S.of(context).cancel,
|
||||||
|
actionButton: () {
|
||||||
|
sendViewModel.state = InitialExecutionState();
|
||||||
|
Navigator.of(bottomSheetContext).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -393,9 +393,10 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
|
||||||
@action
|
@action
|
||||||
Future<PendingTransaction?> createTransaction({ExchangeProvider? provider}) async {
|
Future<PendingTransaction?> createTransaction({ExchangeProvider? provider}) async {
|
||||||
try {
|
try {
|
||||||
state = IsExecutingState();
|
if (wallet.isHardwareWallet)
|
||||||
|
state = IsAwaitingDeviceResponseState();
|
||||||
if (wallet.isHardwareWallet) state = IsAwaitingDeviceResponseState();
|
else
|
||||||
|
state = IsExecutingState();
|
||||||
|
|
||||||
pendingTransaction = await wallet.createTransaction(_credentials(provider));
|
pendingTransaction = await wallet.createTransaction(_credentials(provider));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue