diff --git a/lib/src/screens/wallet_keys/wallet_keys_page.dart b/lib/src/screens/wallet_keys/wallet_keys_page.dart index 1847d63632..86645612d2 100644 --- a/lib/src/screens/wallet_keys/wallet_keys_page.dart +++ b/lib/src/screens/wallet_keys/wallet_keys_page.dart @@ -64,14 +64,19 @@ class WalletKeysPageBody extends StatefulWidget { class _WalletKeysPageBodyState extends State 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 @@ -82,8 +87,6 @@ class _WalletKeysPageBodyState extends State @override Widget build(BuildContext context) { - final isLegacySeedExist = widget.walletKeysViewModel.legacySeedSplit.isNotEmpty; - return Container( padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8), child: Column( @@ -114,8 +117,8 @@ class _WalletKeysPageBodyState extends State 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), @@ -127,11 +130,12 @@ class _WalletKeysPageBodyState extends State 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), ], ), ), diff --git a/lib/view_model/wallet_keys_view_model.dart b/lib/view_model/wallet_keys_view_model.dart index e326029f33..ec6f274843 100644 --- a/lib/view_model/wallet_keys_view_model.dart +++ b/lib/view_model/wallet_keys_view_model.dart @@ -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 ||