Skip to content

Commit

Permalink
hide keys tab for electrum wallets
Browse files Browse the repository at this point in the history
  • Loading branch information
Serhii-Borodenko committed Jan 20, 2025
1 parent 6da66c1 commit 579f2c3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
22 changes: 13 additions & 9 deletions lib/src/screens/wallet_keys/wallet_keys_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,19 @@ class WalletKeysPageBody extends StatefulWidget {
class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
with SingleTickerProviderStateMixin {
late TabController _tabController;
late bool showKeyTab;
late bool showLegacySeedTab;

@override
void initState() {
super.initState();
_tabController = TabController(
length: widget.walletKeysViewModel.legacySeedSplit.isNotEmpty ? 3 : 2,
vsync: this,
);

showKeyTab = widget.walletKeysViewModel.items.isNotEmpty;
showLegacySeedTab = widget.walletKeysViewModel.legacySeedSplit.isNotEmpty;

final totalTabs = 1 + (showKeyTab ? 1 : 0) + (showLegacySeedTab ? 1 : 0);

_tabController = TabController(length: totalTabs, vsync: this);
}

@override
Expand All @@ -82,8 +87,6 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>

@override
Widget build(BuildContext context) {
final isLegacySeedExist = widget.walletKeysViewModel.legacySeedSplit.isNotEmpty;

return Container(
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
child: Column(
Expand Down Expand Up @@ -114,8 +117,8 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
padding: EdgeInsets.zero,
tabs: [
Tab(text: S.of(context).widgets_seed),
Tab(text: S.of(context).keys),
if (isLegacySeedExist) Tab(text: S.of(context).legacy),
if (showKeyTab) Tab(text: S.of(context).keys),
if (showLegacySeedTab) Tab(text: S.of(context).legacy),
],
),
const SizedBox(height: 20),
Expand All @@ -127,11 +130,12 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
padding: const EdgeInsets.only(right: 4),
child: _buildSeedTab(context),
),
if (showKeyTab)
Padding(
padding: const EdgeInsets.only(right: 4),
child: _buildKeysTab(context),
),
if (isLegacySeedExist) _buildLegacySeedTab(context),
if (showLegacySeedTab) _buildLegacySeedTab(context),
],
),
),
Expand Down
28 changes: 14 additions & 14 deletions lib/view_model/wallet_keys_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,20 @@ abstract class WalletKeysViewModelBase with Store {
]);
}

if (_wallet.type == WalletType.bitcoin ||
_wallet.type == WalletType.litecoin ||
_wallet.type == WalletType.bitcoinCash) {
// final keys = bitcoin!.getWalletKeys(_appStore.wallet!);

items.addAll([
// if (keys['wif'] != null)
// StandartListItem(title: "WIF", value: keys['wif']!),
// if (keys['privateKey'] != null)
// StandartListItem(title: S.current.private_key, value: keys['privateKey']!),
// if (keys['publicKey'] != null)
// StandartListItem(title: S.current.public_key, value: keys['publicKey']!),
]);
}
// if (_wallet.type == WalletType.bitcoin ||
// _wallet.type == WalletType.litecoin ||
// _wallet.type == WalletType.bitcoinCash) {
// final keys = bitcoin!.getWalletKeys(_appStore.wallet!);
//
// items.addAll([
// if (keys['wif'] != null)
// StandartListItem(title: "WIF", value: keys['wif']!),
// if (keys['privateKey'] != null)
// StandartListItem(title: S.current.private_key, value: keys['privateKey']!),
// if (keys['publicKey'] != null)
// StandartListItem(title: S.current.public_key, value: keys['publicKey']!),
// ]);
// }

if (isEVMCompatibleChain(_wallet.type) ||
_wallet.type == WalletType.solana ||
Expand Down

0 comments on commit 579f2c3

Please sign in to comment.