mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-12-01 12:04:21 +01:00
show Zano keys properly in the keys tab (#2004)
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:cake_wallet/entities/qr_view_data.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
@@ -18,7 +16,6 @@ import 'package:cake_wallet/view_model/wallet_keys_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
class WalletKeysPage extends BasePage {
|
||||
@@ -35,14 +32,14 @@ class WalletKeysPage extends BasePage {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 14, right: 14, bottom: 8),
|
||||
child: WarningBox(
|
||||
key: const ValueKey('wallet_keys_page_share_warning_text_key'),
|
||||
content: S.of(context).do_not_share_warning_text.toUpperCase(),
|
||||
currentTheme: currentTheme,
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 14, right: 14, bottom: 8),
|
||||
child: WarningBox(
|
||||
key: const ValueKey('wallet_keys_page_share_warning_text_key'),
|
||||
content: S.of(context).do_not_share_warning_text.toUpperCase(),
|
||||
currentTheme: currentTheme,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: WalletKeysPageBody(
|
||||
walletKeysViewModel: walletKeysViewModel,
|
||||
@@ -102,36 +99,36 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 22, right: 22, top: 0),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
isScrollable: true,
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
isScrollable: true,
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color?.withOpacity(0.5),
|
||||
),
|
||||
labelColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
indicatorColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
indicatorPadding: EdgeInsets.zero,
|
||||
labelPadding: const EdgeInsets.only(right: 24),
|
||||
tabAlignment: TabAlignment.start,
|
||||
dividerColor: Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
tabs: [
|
||||
Tab(text: S.of(context).widgets_seed),
|
||||
if (showKeyTab) Tab(text: S.of(context).keys),
|
||||
if (showLegacySeedTab) Tab(text: S.of(context).legacy),
|
||||
],
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
fontSize: 18,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).appBarTheme.titleTextStyle!.color?.withOpacity(0.5),
|
||||
),
|
||||
labelColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
indicatorColor: Theme.of(context).appBarTheme.titleTextStyle!.color,
|
||||
indicatorPadding: EdgeInsets.zero,
|
||||
labelPadding: const EdgeInsets.only(right: 24),
|
||||
tabAlignment: TabAlignment.start,
|
||||
dividerColor: Colors.transparent,
|
||||
padding: EdgeInsets.zero,
|
||||
tabs: [
|
||||
Tab(text: S.of(context).widgets_seed),
|
||||
if (showKeyTab) Tab(text: S.of(context).keys),
|
||||
if (showLegacySeedTab) Tab(text: S.of(context).legacy),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
Expanded(
|
||||
@@ -139,14 +136,14 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
controller: _tabController,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 22, right: 22,),
|
||||
padding: const EdgeInsets.only(left: 22, right: 22),
|
||||
child: _buildSeedTab(context, false),
|
||||
),
|
||||
if (showKeyTab)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 22, right: 22),
|
||||
child: _buildKeysTab(context),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 22, right: 22),
|
||||
child: _buildKeysTab(context),
|
||||
),
|
||||
if (showLegacySeedTab)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 22, right: 22),
|
||||
@@ -155,7 +152,6 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -268,7 +264,6 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget? _buildPassphraseBox() {
|
||||
if (widget.walletKeysViewModel.passphrase.isEmpty) return null;
|
||||
@@ -297,9 +292,9 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
children: [
|
||||
Observer(builder: (BuildContext context) {
|
||||
return Text(
|
||||
(widget.walletKeysViewModel.obscurePassphrase) ?
|
||||
"*****" :
|
||||
widget.walletKeysViewModel.passphrase,
|
||||
(widget.walletKeysViewModel.obscurePassphrase)
|
||||
? "*****"
|
||||
: widget.walletKeysViewModel.passphrase,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -308,16 +303,18 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
);
|
||||
}),
|
||||
Observer(builder: (BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
widget.walletKeysViewModel.obscurePassphrase = !widget.walletKeysViewModel.obscurePassphrase;
|
||||
},
|
||||
child: Icon(
|
||||
widget.walletKeysViewModel.obscurePassphrase ? Icons.visibility_off : Icons.visibility,
|
||||
size: 16,
|
||||
color: Theme.of(context).textTheme.bodyLarge?.color?.withOpacity(0.7),
|
||||
)
|
||||
);
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
widget.walletKeysViewModel.obscurePassphrase =
|
||||
!widget.walletKeysViewModel.obscurePassphrase;
|
||||
},
|
||||
child: Icon(
|
||||
widget.walletKeysViewModel.obscurePassphrase
|
||||
? Icons.visibility_off
|
||||
: Icons.visibility,
|
||||
size: 16,
|
||||
color: Theme.of(context).textTheme.bodyLarge?.color?.withOpacity(0.7),
|
||||
));
|
||||
}),
|
||||
],
|
||||
),
|
||||
@@ -327,7 +324,6 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _buildBottomActionPanel({
|
||||
required String titleForClipboard,
|
||||
required String dataToCopy,
|
||||
@@ -337,37 +333,37 @@ class _WalletKeysPageBodyState extends State<WalletKeysPageBody>
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(right: 8.0, top: 8.0),
|
||||
child: PrimaryButton(
|
||||
key: const ValueKey('wallet_keys_page_copy_seeds_button_key'),
|
||||
onPressed: () => _onCopy(titleForClipboard, dataToCopy, context),
|
||||
text: S.of(context).copy,
|
||||
color: Theme.of(context).cardColor,
|
||||
textColor: widget.currentTheme.type == ThemeType.dark
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(right: 8.0, top: 8.0),
|
||||
child: PrimaryButton(
|
||||
key: const ValueKey('wallet_keys_page_copy_seeds_button_key'),
|
||||
onPressed: () => _onCopy(titleForClipboard, dataToCopy, context),
|
||||
text: S.of(context).copy,
|
||||
color: Theme.of(context).cardColor,
|
||||
textColor: widget.currentTheme.type == ThemeType.dark
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
||||
child: PrimaryButton(
|
||||
key: const ValueKey('wallet_keys_page_show_qr_seeds_button_key'),
|
||||
onPressed: onShowQR,
|
||||
text: S.current.show + ' QR',
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
|
||||
child: PrimaryButton(
|
||||
key: const ValueKey('wallet_keys_page_show_qr_seeds_button_key'),
|
||||
onPressed: onShowQR,
|
||||
text: S.current.show + ' QR',
|
||||
color: Theme.of(context).primaryColor,
|
||||
textColor: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user