From 790b66af29408c61c7b9c4f31ce48141b2a945f0 Mon Sep 17 00:00:00 2001 From: yekta Date: Mon, 4 Mar 2024 07:36:17 +0300 Subject: [PATCH] External account checks hooked up --- lib/ui/accounts/accounts_sheet.dart | 6 ++-- .../import_external_account_sheet.dart | 34 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/ui/accounts/accounts_sheet.dart b/lib/ui/accounts/accounts_sheet.dart index d41024a..c950dd0 100644 --- a/lib/ui/accounts/accounts_sheet.dart +++ b/lib/ui/accounts/accounts_sheet.dart @@ -420,7 +420,7 @@ class _AppAccountsWidgetState extends State { Widget _buildAccountListItem( BuildContext context, Account account, StateSetter setState) { - var isExternalAccount = false; + var isExternalAccount = account.index == -1; return Slidable( secondaryActions: _getSlideActionsForAccount(context, account, setState), actionExtentRatio: 0.24, @@ -612,7 +612,7 @@ class _AppAccountsWidgetState extends State { var deleteExternalAccountHeader = "Delete External Account"; var deleteExternalAccountParagraph = "Deleting an external account is irreversible. If you don't have its secret phrase backed up, you won't be able to recover it later. Are you sure you want to delete the account from this device?"; - var isExternalAccount = false; + var isExternalAccount = account.index == -1; List _actions = List(); _actions.add(SlideAction( child: Container( @@ -629,7 +629,7 @@ class _AppAccountsWidgetState extends State { onTap: () { AccountDetailsSheet(account).mainBottomSheet(context); })); - if (account.index > 0) { + if (account.index > 0 || isExternalAccount) { _actions.add(SlideAction( child: Container( margin: EdgeInsetsDirectional.only(start: 2, top: 1, bottom: 1), diff --git a/lib/ui/accounts/import_external_account_sheet.dart b/lib/ui/accounts/import_external_account_sheet.dart index dcdc14a..f12806d 100644 --- a/lib/ui/accounts/import_external_account_sheet.dart +++ b/lib/ui/accounts/import_external_account_sheet.dart @@ -119,13 +119,13 @@ class _ImportExternalAccountSheetState autoScroll: true, focusPadding: 40, child: SingleChildScrollView( - padding: EdgeInsets.only(bottom: 48), + padding: EdgeInsets.only(bottom: 64), child: Column( children: [ Container( margin: EdgeInsets.only( - left: smallScreen(context) ? 30 : 40, - right: smallScreen(context) ? 30 : 40), + left: smallScreen(context) ? 24 : 32, + right: smallScreen(context) ? 24 : 32), alignment: Alignment.centerLeft, child: AutoSizeText( _seedMode @@ -145,8 +145,8 @@ class _ImportExternalAccountSheetState // Explanation text for secret phrase Container( margin: EdgeInsets.only( - left: smallScreen(context) ? 30 : 40, - right: smallScreen(context) ? 30 : 40, + left: smallScreen(context) ? 24 : 32, + right: smallScreen(context) ? 24 : 32, top: 6.0), alignment: Alignment.centerLeft, child: Text( @@ -166,8 +166,8 @@ class _ImportExternalAccountSheetState }, child: _seedMode ? AppTextField( - leftMargin: smallScreen(context) ? 30 : 40, - rightMargin: smallScreen(context) ? 30 : 40, + leftMargin: smallScreen(context) ? 24 : 32, + rightMargin: smallScreen(context) ? 24 : 32, topMargin: 16, focusNode: _seedInputFocusNode, controller: _seedInputController, @@ -277,8 +277,8 @@ class _ImportExternalAccountSheetState }) : // Mnemonic mode AppTextField( - leftMargin: smallScreen(context) ? 30 : 40, - rightMargin: smallScreen(context) ? 30 : 40, + leftMargin: smallScreen(context) ? 24 : 32, + rightMargin: smallScreen(context) ? 24 : 32, topMargin: 16, focusNode: _mnemonicFocusNode, controller: _mnemonicController, @@ -431,8 +431,8 @@ class _ImportExternalAccountSheetState Container( margin: EdgeInsets.only( top: 5, - left: smallScreen(context) ? 30 : 40, - right: smallScreen(context) ? 30 : 40, + left: smallScreen(context) ? 24 : 32, + right: smallScreen(context) ? 24 : 32, ), child: Text( !_seedMode @@ -462,8 +462,8 @@ class _ImportExternalAccountSheetState // Header for the "Account Index" Container( margin: EdgeInsets.only( - left: smallScreen(context) ? 30 : 40, - right: smallScreen(context) ? 30 : 40, + left: smallScreen(context) ? 24 : 32, + right: smallScreen(context) ? 24 : 32, top: 12), alignment: Alignment.centerLeft, child: AutoSizeText( @@ -482,8 +482,8 @@ class _ImportExternalAccountSheetState // Explanation text for index Container( margin: EdgeInsets.only( - left: smallScreen(context) ? 30 : 40, - right: smallScreen(context) ? 30 : 40, + left: smallScreen(context) ? 24 : 32, + right: smallScreen(context) ? 24 : 32, top: 6.0), alignment: Alignment.centerLeft, child: Text( @@ -498,8 +498,8 @@ class _ImportExternalAccountSheetState _indexInputFocusNode.unfocus(); }, child: AppTextField( - leftMargin: smallScreen(context) ? 30 : 40, - rightMargin: smallScreen(context) ? 30 : 40, + leftMargin: smallScreen(context) ? 24 : 32, + rightMargin: smallScreen(context) ? 24 : 32, topMargin: 16, hintText: defaultIndex.toString(), keyboardType: TextInputType.numberWithOptions(