fix back up views

This commit is contained in:
julian 2024-11-14 14:40:51 -06:00 committed by julian-CStack
parent 5452598064
commit 3177fadea6
2 changed files with 17 additions and 15 deletions

View file

@ -89,9 +89,10 @@ class WalletBackupView extends ConsumerWidget {
Padding( Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: CustomTextButton( child: CustomTextButton(
text: switch (keyData.runtimeType) { text: switch (keyData) {
const (XPrivData) => "xpriv(s)", final XPrivData _ => "xpriv(s)",
const (CWKeyData) => "keys", final CWKeyData _ => "keys",
final ViewOnlyWalletData _ => "keys",
_ => throw UnimplementedError( _ => throw UnimplementedError(
"Don't forget to add your KeyDataInterface here! ${keyData.runtimeType}", "Don't forget to add your KeyDataInterface here! ${keyData.runtimeType}",
), ),
@ -454,10 +455,10 @@ class MobileKeyDataView extends ConsumerWidget {
}, },
), ),
title: Text( title: Text(
"Wallet ${switch (keyData.runtimeType) { "Wallet ${switch (keyData) {
const (XPrivData) => "xpriv(s)", final XPrivData _ => "xpriv(s)",
const (CWKeyData) => "keys", final CWKeyData _ => "keys",
const (ViewOnlyWalletData) => "keys", final ViewOnlyWalletData _ => "keys",
_ => throw UnimplementedError( _ => throw UnimplementedError(
"Don't forget to add your KeyDataInterface here!", "Don't forget to add your KeyDataInterface here!",
), ),
@ -477,18 +478,18 @@ class MobileKeyDataView extends ConsumerWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Expanded( Expanded(
child: switch (keyData.runtimeType) { child: switch (keyData) {
const (XPrivData) => WalletXPrivs( final XPrivData e => WalletXPrivs(
walletId: walletId, walletId: walletId,
xprivData: keyData as XPrivData, xprivData: e,
), ),
const (CWKeyData) => CNWalletKeys( final CWKeyData e => CNWalletKeys(
walletId: walletId, walletId: walletId,
cwKeyData: keyData as CWKeyData, cwKeyData: e,
), ),
const (ViewOnlyWalletData) => final ViewOnlyWalletData e =>
ViewOnlyWalletDataWidget( ViewOnlyWalletDataWidget(
data: keyData as ViewOnlyWalletData, data: e,
), ),
_ => throw UnimplementedError( _ => throw UnimplementedError(
"Don't forget to add your KeyDataInterface here!", "Don't forget to add your KeyDataInterface here!",

View file

@ -342,7 +342,8 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
if (context.mounted) { if (context.mounted) {
if (keyData != null && if (keyData != null &&
wallet wallet
is ViewOnlyOptionInterface) { is ViewOnlyOptionInterface &&
wallet.isViewOnly) {
await Navigator.push( await Navigator.push(
context, context,
RouteGenerator.getRoute( RouteGenerator.getRoute(