mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-21 06:18:42 +02:00
CW-676 Add Linux scripts to build monero_c for linux platform (#1527)
* Revert "Revert btc address types" This reverts commit a49e57e3 * Re-add Bitcoin Address types Fix conflicts with main * fix: label issues, clear spent utxo * chore: deps * fix: build * fix: missing types * feat: new electrs API & changes, fixes for last block scanning * Update Monero * not sure why it's failing * Enable Exolix Improve service updates indicator New versions * Add exolix Api token to limits api * Ignore reporting network issues * Change default bitcoin node * Merge main and update linux version * Update app version [skip ci] * New versions * Fix conflicts and update linux version * minor fix * feat: Scan Silent Payments homepage toggle * chore: build configure * feat: generic fixes, testnet UI improvements, useSSL on bitcoin nodes * fix: invalid Object in sendData * feat: improve addresses page & address book displays * feat: silent payments labeled addresses disclaimer * fix: missing i18n * chore: print * feat: single block scan, rescan by date working for btc mainnet * feat: new cake features page replace market page, move sp scan toggle, auto switch node pop up alert * feat: delete silent addresses * fix: red dot in non ssl nodes * fix: inconsistent connection states, fix tx history * fix: tx & balance displays, cpfp sending * feat: new rust lib * chore: node path * fix: check node based on network * fix: missing txcount from addresses * style: padding in feature page cards * fix: restore not getting all wallet addresses by type * fix: auto switch node broken * fix: silent payment txs not being restored * update linux version * feat: change scanning to subscription model, sync improvements * fix: scan re-subscription * fix: default nodes * fix: improve scanning by date, fix single block scan * refactor: common function for input tx selection * various fixes for build issues * initial monero.dart implementation * ... * multiple wallets new lib minor fixes * other fixes from monero.dart and monero_c * fix: nodes & build * update build scripts fix polyseed * remove unnecessary code * Add windows app, build scripts and build guide for it. * Minor fix in generated monero configs * Merge and fix main * fix: send all with multiple outs * add missing monero_c command * add android build script * update version * Merge and fix main * undo android ndk removal * Fix modified exception_handler.dart * Temporarily remove haven * fix build issues * fix pr script * Fixes for build monero.dart (monero_c) for windows. * monero build script * wip: ios build script * refactor: unchanged file * Added build guides for iOS and macOS. Replaced nproc call on macOS. Added macOS configuration for configure_cake_wallet.sh script. * Update monero.dart and monero_c versions. * Add missed windows build scripts * Update the application configuration for windows build script. * Update cw_monero pubspec lock file for monero.dart * Update pr_test_build.yml * chore: upgrade * chore: merge changes * refactor: unchanged files [skip ci] * Fix conflicts with main * fix for multiple wallets * update app version [skip ci] * Add tron to windows application configuration. * Add macOS option for description message in configure_cake_wallet.sh * fix missing encryption utils in hardware wallet functions [skip ci] * fix conflicts * Include missed monero dll for windows. * reformatting [skip ci] * fix conflicts with main * Disable haven configuration for iOS as default. Add ability to configure cakewallet for iOS with for configuration script. Remove cw_shared configuration for cw_monero. * fix: scan fixes, add date, allow sending while scanning * add missing nano secrets file [skip ci] * ios library * don't pull prebuilds android * Add auto generation of manifest file for android project even for iOS, macOS, Windows. * remove tron * feat: sync fixes, sp settings * feat: fix resyncing * store crash fix * make init async so it won't lag disable print starts * fix monero_c build issues * libstdc++ * merge main and update version * Fix MacOS saving wallet file issue Fix Secure Storage issue (somehow) * update pubspec.lock * fix build script * Use dylib as iOS framework. Use custom path for loading of iOS framework for monero.dart. Add script for generate iOS framework for monero wallet. * fix: date from height logic, status disconnected & chain tip get * fix: params * feat: electrum migration if using cake electrum * fix nodes update versions * re-enable tron * update sp_scanner to work on iOS [skip ci] * bump monero_c hash * bump monero_c commit * bump moneroc version * bump monero_c commit * Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to . * fix: wrong socket for old electrum nodes * update version * Fix unchecked wallet type call * get App Dir correctly in default_settings_migration.dart * handle previous issue with fetching linux documents directory [skip ci] * backup fix * fix NTFS issues * Add Tron Update Linux version * Close the wallet when the wallet gets changed * fix: double balance * feat: node domain * fix: menu name * bump monero_c commit * fix: update tip on set scanning * fix: connection switching back and forth * feat: check if node is electrs, and supports sp * chore: fix build * minor enhancements * fixes and enhancements * solve conflicts with main * Only stop wallet on rename and delete * fix: status toggle * minor enhancement * Monero.com fixes * bump monero_c commit * update sp_scanner to include windows and linux * merge main * Update macOS build guide. Change brew dependencies for build unbound locally. * fix: Tron file write, build scripts * - merge linux with Monero Dart - Temporarily disable Monero * fix other issues with linux * linux ci fix build script * Update pr_test_build_linux.yml install required packages * add linux desktop dependencies * don't use apk in linux build releases * don't copy the file to test-apk * fix linux runtime issues * remove libc++_shared.so * fix issues with linux * prepare both android and linux (because otherwise it will fail) * ci script updates * run apt update * bump image to ubuntu 22.04 note: remember to put it down later * bump python version * remove some dependencies * remove unused import * add missing dependencies * fix dependencies * some fixes * remove print [skip ci] * Add back RunnerBase.entitlements minor fixes [skip ci] * fix memory leak / infinite recurrsion when opening xmr wallet * url_launcher_linux: 3.1.1 # https://github.com/flutter/flutter/issues/153083 * fix conflicts with main * handle walletKeysFile with encryptionUtils * update app version [skip ci] * add wownero [skip ci] --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com> Co-authored-by: Rafael Saes <git@rafael.saes.dev> Co-authored-by: M <m@cakewallet.com> Co-authored-by: Konstantin Ullrich <konstantinullrich12@gmail.com>
This commit is contained in:
co-authored by
OmarHatem
Rafael Saes
M
Konstantin Ullrich
parent
3b635218a5
commit
1ce60d62b3
@@ -12,6 +12,12 @@ import 'package:cake_wallet/core/execution_state.dart';
|
||||
|
||||
typedef OnAuthenticationFinished = void Function(bool, AuthPageState);
|
||||
|
||||
abstract class AuthPageState<T extends StatefulWidget> extends State<T> {
|
||||
void changeProcessText(String text);
|
||||
void hideProgressText();
|
||||
Future<void> close({String? route, dynamic arguments});
|
||||
}
|
||||
|
||||
class AuthPage extends StatefulWidget {
|
||||
AuthPage(this.authViewModel,
|
||||
{required this.onAuthenticationFinished,
|
||||
@@ -22,10 +28,10 @@ class AuthPage extends StatefulWidget {
|
||||
final bool closable;
|
||||
|
||||
@override
|
||||
AuthPageState createState() => AuthPageState();
|
||||
AuthPageState createState() => AuthPagePinCodeStateImpl();
|
||||
}
|
||||
|
||||
class AuthPageState extends State<AuthPage> {
|
||||
class AuthPagePinCodeStateImpl extends AuthPageState<AuthPage> {
|
||||
final _key = GlobalKey<ScaffoldState>();
|
||||
final _pinCodeKey = GlobalKey<PinCodeState>();
|
||||
final _backArrowImageDarkTheme =
|
||||
@@ -55,8 +61,6 @@ class AuthPageState extends State<AuthPage> {
|
||||
}
|
||||
|
||||
if (state is FailureState) {
|
||||
print('X');
|
||||
print(state.error);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
_pinCodeKey.currentState?.clear();
|
||||
dismissFlushBar(_authBar);
|
||||
@@ -95,17 +99,20 @@ class AuthPageState extends State<AuthPage> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void changeProcessText(String text) {
|
||||
dismissFlushBar(_authBar);
|
||||
_progressBar = createBar<void>(text, duration: null)
|
||||
..show(_key.currentContext!);
|
||||
}
|
||||
|
||||
@override
|
||||
void hideProgressText() {
|
||||
dismissFlushBar(_progressBar);
|
||||
_progressBar = null;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close({String? route, dynamic arguments}) async {
|
||||
if (_key.currentContext == null) {
|
||||
throw Exception('Key context is null. Should be not happened');
|
||||
|
||||
@@ -2,6 +2,9 @@ import 'package:auto_size_text/auto_size_text.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/balance_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/sync_indicator_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class DesktopActionButton extends StatelessWidget {
|
||||
@@ -24,45 +27,48 @@ class DesktopActionButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 25),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset(
|
||||
image,
|
||||
height: 30,
|
||||
width: 30,
|
||||
color: isEnabled
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
AutoSizeText(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 0, 8, 8),
|
||||
child: GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 25),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(15.0),
|
||||
color: Theme.of(context).extension<SyncIndicatorTheme>()!.syncedBackgroundColor,
|
||||
),
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Image.asset(
|
||||
image,
|
||||
height: 30,
|
||||
width: 30,
|
||||
color: isEnabled
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: null,
|
||||
height: 1,
|
||||
: Theme.of(context).extension<BalancePageTheme>()!.labelTextColor,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
const SizedBox(width: 10),
|
||||
AutoSizeText(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontFamily: 'Lato',
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isEnabled
|
||||
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
|
||||
: null,
|
||||
height: 1,
|
||||
),
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -4,9 +4,12 @@ import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/entities/desktop_dropdown_item.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/dropdown_item_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/themes/extensions/menu_theme.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_list_item.dart';
|
||||
@@ -176,12 +179,25 @@ class _DesktopWalletSelectionDropDownState extends State<DesktopWalletSelectionD
|
||||
}
|
||||
|
||||
Future<void> _loadWallet(WalletListItem wallet) async {
|
||||
widget._authService.authenticateAction(
|
||||
context,
|
||||
onAuthSuccess: (isAuthenticatedSuccessfully) async {
|
||||
if (!isAuthenticatedSuccessfully) {
|
||||
return;
|
||||
}
|
||||
if (SettingsStoreBase.walletPasswordDirectInput) {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.walletUnlockLoadable,
|
||||
arguments: WalletUnlockArguments(
|
||||
callback: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close();
|
||||
setState(() {});
|
||||
}
|
||||
}, walletName: wallet.name,
|
||||
walletType: wallet.type));
|
||||
return;
|
||||
}
|
||||
|
||||
widget._authService.authenticateAction(context,
|
||||
onAuthSuccess: (isAuthenticatedSuccessfully) async {
|
||||
if (!isAuthenticatedSuccessfully) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (context.mounted) {
|
||||
|
||||
@@ -68,14 +68,19 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||
_WalletNameFormState(this._walletNewVM)
|
||||
: _formKey = GlobalKey<FormState>(),
|
||||
_languageSelectorKey = GlobalKey<SeedLanguageSelectorState>(),
|
||||
_controller = TextEditingController();
|
||||
_nameController = TextEditingController(),
|
||||
_passwordController = _walletNewVM.hasWalletPassword ? TextEditingController() : null,
|
||||
_repeatedPasswordController =
|
||||
_walletNewVM.hasWalletPassword ? TextEditingController() : null;
|
||||
|
||||
static const aspectRatioImage = 1.22;
|
||||
|
||||
final GlobalKey<FormState> _formKey;
|
||||
final GlobalKey<SeedLanguageSelectorState> _languageSelectorKey;
|
||||
final WalletNewVM _walletNewVM;
|
||||
final TextEditingController _controller;
|
||||
final TextEditingController _nameController;
|
||||
final TextEditingController? _passwordController;
|
||||
final TextEditingController? _repeatedPasswordController;
|
||||
ReactionDisposer? _stateReaction;
|
||||
|
||||
@override
|
||||
@@ -130,12 +135,11 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||
padding: EdgeInsets.only(top: 24),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Stack(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Column(
|
||||
children: [
|
||||
TextFormField(
|
||||
onChanged: (value) => _walletNewVM.name = value,
|
||||
controller: _controller,
|
||||
controller: _nameController,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
@@ -169,10 +173,10 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
|
||||
setState(() {
|
||||
_controller.text = rName;
|
||||
_nameController.text = rName;
|
||||
_walletNewVM.name = rName;
|
||||
_controller.selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: _controller.text.length));
|
||||
_nameController.selection = TextSelection.fromPosition(
|
||||
TextPosition(offset: _nameController.text.length));
|
||||
});
|
||||
},
|
||||
icon: Container(
|
||||
@@ -195,6 +199,80 @@ class _WalletNameFormState extends State<WalletNameForm> {
|
||||
),
|
||||
validator: WalletNameValidator(),
|
||||
),
|
||||
if (_walletNewVM.hasWalletPassword) ...[
|
||||
TextFormField(
|
||||
onChanged: (value) => _walletNewVM.walletPassword = value,
|
||||
controller: _passwordController,
|
||||
textAlign: TextAlign.center,
|
||||
obscureText: true,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||
),
|
||||
hintText: S.of(context).password,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.underlineColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.underlineColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
onChanged: (value) => _walletNewVM.repeatedWalletPassword = value,
|
||||
controller: _repeatedPasswordController,
|
||||
textAlign: TextAlign.center,
|
||||
obscureText: true,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color:
|
||||
Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||
),
|
||||
hintText: S.of(context).repeat_wallet_password,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.underlineColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context)
|
||||
.extension<NewWalletTheme>()!
|
||||
.underlineColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -16,6 +16,9 @@ class WalletRestoreFromKeysFrom extends StatefulWidget {
|
||||
required this.onPrivateKeyChange,
|
||||
required this.displayPrivateKeyField,
|
||||
required this.onHeightOrDateEntered,
|
||||
required this.displayWalletPassword,
|
||||
required this.onRepeatedPasswordChange,
|
||||
this.onPasswordChange,
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@@ -23,13 +26,17 @@ class WalletRestoreFromKeysFrom extends StatefulWidget {
|
||||
final WalletRestoreViewModel walletRestoreViewModel;
|
||||
final void Function(String)? onPrivateKeyChange;
|
||||
final bool displayPrivateKeyField;
|
||||
final bool displayWalletPassword;
|
||||
final void Function(String)? onPasswordChange;
|
||||
final void Function(String)? onRepeatedPasswordChange;
|
||||
|
||||
@override
|
||||
WalletRestoreFromKeysFromState createState() => WalletRestoreFromKeysFromState();
|
||||
WalletRestoreFromKeysFromState createState() =>
|
||||
WalletRestoreFromKeysFromState(displayWalletPassword: displayWalletPassword);
|
||||
}
|
||||
|
||||
class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
||||
WalletRestoreFromKeysFromState()
|
||||
WalletRestoreFromKeysFromState({required bool displayWalletPassword})
|
||||
: formKey = GlobalKey<FormState>(),
|
||||
blockchainHeightKey = GlobalKey<BlockchainHeightState>(),
|
||||
nameController = TextEditingController(),
|
||||
@@ -37,7 +44,9 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
||||
viewKeyController = TextEditingController(),
|
||||
spendKeyController = TextEditingController(),
|
||||
privateKeyController = TextEditingController(),
|
||||
nameTextEditingController = TextEditingController();
|
||||
nameTextEditingController = TextEditingController(),
|
||||
passwordTextEditingController = displayWalletPassword ? TextEditingController() : null,
|
||||
repeatedPasswordTextEditingController = displayWalletPassword ? TextEditingController() : null;
|
||||
|
||||
final GlobalKey<FormState> formKey;
|
||||
final GlobalKey<BlockchainHeightState> blockchainHeightKey;
|
||||
@@ -47,9 +56,22 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
||||
final TextEditingController spendKeyController;
|
||||
final TextEditingController nameTextEditingController;
|
||||
final TextEditingController privateKeyController;
|
||||
final TextEditingController? passwordTextEditingController;
|
||||
final TextEditingController? repeatedPasswordTextEditingController;
|
||||
void Function()? passwordListener;
|
||||
void Function()? repeatedPasswordListener;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
if (passwordTextEditingController != null) {
|
||||
passwordListener = () => widget.onPasswordChange?.call(passwordTextEditingController!.text);
|
||||
passwordTextEditingController?.addListener(passwordListener!);
|
||||
}
|
||||
|
||||
if (repeatedPasswordTextEditingController != null) {
|
||||
repeatedPasswordListener = () => widget.onRepeatedPasswordChange?.call(repeatedPasswordTextEditingController!.text);
|
||||
repeatedPasswordTextEditingController?.addListener(repeatedPasswordListener!);
|
||||
}
|
||||
super.initState();
|
||||
|
||||
privateKeyController.addListener(() {
|
||||
@@ -67,6 +89,14 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
||||
viewKeyController.dispose();
|
||||
privateKeyController.dispose();
|
||||
spendKeyController.dispose();
|
||||
passwordTextEditingController?.dispose();
|
||||
if (passwordListener != null) {
|
||||
passwordTextEditingController?.removeListener(passwordListener!);
|
||||
}
|
||||
|
||||
if (repeatedPasswordListener != null) {
|
||||
repeatedPasswordTextEditingController?.removeListener(repeatedPasswordListener!);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -114,6 +144,19 @@ class WalletRestoreFromKeysFromState extends State<WalletRestoreFromKeysFrom> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.displayWalletPassword)
|
||||
...[Container(
|
||||
padding: EdgeInsets.only(top: 20.0),
|
||||
child: BaseTextFormField(
|
||||
controller: passwordTextEditingController,
|
||||
hintText: S.of(context).password,
|
||||
obscureText: true)),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 20.0),
|
||||
child: BaseTextFormField(
|
||||
controller: repeatedPasswordTextEditingController,
|
||||
hintText: S.of(context).repeat_wallet_password,
|
||||
obscureText: true))],
|
||||
Container(height: 20),
|
||||
_restoreFromKeysFormFields(),
|
||||
],
|
||||
|
||||
@@ -22,34 +22,43 @@ class WalletRestoreFromSeedForm extends StatefulWidget {
|
||||
required this.displayBlockHeightSelector,
|
||||
required this.displayPassphrase,
|
||||
required this.type,
|
||||
required this.displayWalletPassword,
|
||||
required this.seedTypeViewModel,
|
||||
this.blockHeightFocusNode,
|
||||
this.onHeightOrDateEntered,
|
||||
this.onSeedChange,
|
||||
this.onLanguageChange})
|
||||
this.onLanguageChange,
|
||||
this.onPasswordChange,
|
||||
this.onRepeatedPasswordChange})
|
||||
: super(key: key);
|
||||
|
||||
final WalletType type;
|
||||
final bool displayLanguageSelector;
|
||||
final bool displayBlockHeightSelector;
|
||||
final bool displayWalletPassword;
|
||||
final bool displayPassphrase;
|
||||
final SeedTypeViewModel seedTypeViewModel;
|
||||
final FocusNode? blockHeightFocusNode;
|
||||
final Function(bool)? onHeightOrDateEntered;
|
||||
final void Function(String)? onSeedChange;
|
||||
final void Function(String)? onLanguageChange;
|
||||
final void Function(String)? onPasswordChange;
|
||||
final void Function(String)? onRepeatedPasswordChange;
|
||||
|
||||
@override
|
||||
WalletRestoreFromSeedFormState createState() => WalletRestoreFromSeedFormState('English');
|
||||
WalletRestoreFromSeedFormState createState() =>
|
||||
WalletRestoreFromSeedFormState('English', displayWalletPassword: displayWalletPassword);
|
||||
}
|
||||
|
||||
class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
||||
WalletRestoreFromSeedFormState(this.language)
|
||||
WalletRestoreFromSeedFormState(this.language, {required bool displayWalletPassword})
|
||||
: seedWidgetStateKey = GlobalKey<SeedWidgetState>(),
|
||||
blockchainHeightKey = GlobalKey<BlockchainHeightState>(),
|
||||
formKey = GlobalKey<FormState>(),
|
||||
languageController = TextEditingController(),
|
||||
nameTextEditingController = TextEditingController(),
|
||||
passwordTextEditingController = displayWalletPassword ? TextEditingController() : null,
|
||||
repeatedPasswordTextEditingController = displayWalletPassword ? TextEditingController() : null,
|
||||
passphraseController = TextEditingController(),
|
||||
seedTypeController = TextEditingController();
|
||||
|
||||
@@ -57,16 +66,30 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
||||
final GlobalKey<BlockchainHeightState> blockchainHeightKey;
|
||||
final TextEditingController languageController;
|
||||
final TextEditingController nameTextEditingController;
|
||||
final TextEditingController? passwordTextEditingController;
|
||||
final TextEditingController? repeatedPasswordTextEditingController;
|
||||
final TextEditingController seedTypeController;
|
||||
final TextEditingController passphraseController;
|
||||
final GlobalKey<FormState> formKey;
|
||||
late ReactionDisposer moneroSeedTypeReaction;
|
||||
String language;
|
||||
void Function()? passwordListener;
|
||||
void Function()? repeatedPasswordListener;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_setSeedType(widget.seedTypeViewModel.moneroSeedType);
|
||||
_setLanguageLabel(language);
|
||||
|
||||
if (passwordTextEditingController != null) {
|
||||
passwordListener = () => widget.onPasswordChange?.call(passwordTextEditingController!.text);
|
||||
passwordTextEditingController?.addListener(passwordListener!);
|
||||
}
|
||||
|
||||
if (repeatedPasswordTextEditingController != null) {
|
||||
repeatedPasswordListener = () => widget.onRepeatedPasswordChange?.call(repeatedPasswordTextEditingController!.text);
|
||||
repeatedPasswordTextEditingController?.addListener(repeatedPasswordListener!);
|
||||
}
|
||||
moneroSeedTypeReaction =
|
||||
reaction((_) => widget.seedTypeViewModel.moneroSeedType, (SeedType item) {
|
||||
_setSeedType(item);
|
||||
@@ -78,8 +101,16 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
moneroSeedTypeReaction();
|
||||
|
||||
if (passwordListener != null) {
|
||||
passwordTextEditingController?.removeListener(passwordListener!);
|
||||
}
|
||||
|
||||
if (repeatedPasswordListener != null) {
|
||||
repeatedPasswordTextEditingController?.removeListener(repeatedPasswordListener!);
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void onSeedChange(String seed) {
|
||||
@@ -177,6 +208,16 @@ class WalletRestoreFromSeedFormState extends State<WalletRestoreFromSeedForm> {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (widget.displayWalletPassword)
|
||||
...[BaseTextFormField(
|
||||
controller: passwordTextEditingController,
|
||||
hintText: S.of(context).password,
|
||||
obscureText: true),
|
||||
BaseTextFormField(
|
||||
controller: repeatedPasswordTextEditingController,
|
||||
hintText: S.of(context).repeat_wallet_password,
|
||||
obscureText: true)],
|
||||
if (widget.displayLanguageSelector)
|
||||
if (!seedTypeController.value.text.contains("14") && widget.displayLanguageSelector)
|
||||
GestureDetector(
|
||||
onTap: () async {
|
||||
|
||||
@@ -53,7 +53,10 @@ class WalletRestorePage extends BasePage {
|
||||
onLanguageChange: (String language) {
|
||||
final isPolyseed = language.startsWith("POLYSEED_");
|
||||
_validateOnChange(isPolyseed: isPolyseed);
|
||||
}));
|
||||
},
|
||||
displayWalletPassword: walletRestoreViewModel.hasWalletPassword,
|
||||
onPasswordChange: (String password) => walletRestoreViewModel.walletPassword = password,
|
||||
onRepeatedPasswordChange: (String repeatedPassword) => walletRestoreViewModel.repeatedWalletPassword = repeatedPassword));
|
||||
break;
|
||||
case WalletRestoreMode.keys:
|
||||
_pages.add(WalletRestoreFromKeysFrom(
|
||||
@@ -66,6 +69,9 @@ class WalletRestorePage extends BasePage {
|
||||
}
|
||||
},
|
||||
displayPrivateKeyField: walletRestoreViewModel.hasRestoreFromPrivateKey,
|
||||
displayWalletPassword: walletRestoreViewModel.hasWalletPassword,
|
||||
onPasswordChange: (String password) => walletRestoreViewModel.walletPassword = password,
|
||||
onRepeatedPasswordChange: (String repeatedPassword) => walletRestoreViewModel.repeatedWalletPassword = repeatedPassword,
|
||||
onHeightOrDateEntered: (value) => walletRestoreViewModel.isButtonEnabled = value));
|
||||
break;
|
||||
default:
|
||||
@@ -127,6 +133,8 @@ class WalletRestorePage extends BasePage {
|
||||
|
||||
reaction((_) => walletRestoreViewModel.mode, (WalletRestoreMode mode) {
|
||||
walletRestoreViewModel.isButtonEnabled = false;
|
||||
walletRestoreViewModel.walletPassword = null;
|
||||
walletRestoreViewModel.repeatedWalletPassword = null;
|
||||
|
||||
walletRestoreFromSeedFormKey
|
||||
.currentState!.blockchainHeightKey.currentState!.restoreHeightController.text = '';
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/core/totp_request_details.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:cake_wallet/src/screens/settings/widgets/settings_cell_with_arro
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_picker_cell.dart';
|
||||
import 'package:cake_wallet/src/screens/settings/widgets/settings_switcher_cell.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/view_model/settings/security_settings_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
@@ -41,15 +42,16 @@ class SecurityBackupPage extends BasePage {
|
||||
_securitySettingsViewModel.shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
||||
),
|
||||
),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.create_backup,
|
||||
handler: (_) => _authService.authenticateAction(
|
||||
context,
|
||||
route: Routes.backup,
|
||||
conditionToDetermineIfToUse2FA: _securitySettingsViewModel
|
||||
.shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
||||
if (!SettingsStoreBase.walletPasswordDirectInput)
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.create_backup,
|
||||
handler: (_) => _authService.authenticateAction(
|
||||
context,
|
||||
route: Routes.backup,
|
||||
conditionToDetermineIfToUse2FA: _securitySettingsViewModel
|
||||
.shouldRequireTOTP2FAForAllSecurityAndBackupSettings,
|
||||
),
|
||||
),
|
||||
),
|
||||
SettingsCellWithArrow(
|
||||
title: S.current.settings_change_pin,
|
||||
handler: (_) => _authService.authenticateAction(
|
||||
@@ -119,6 +121,5 @@ class SecurityBackupPage extends BasePage {
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ import 'package:cake_wallet/core/wallet_name_validator.dart';
|
||||
import 'package:cake_wallet/palette.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/routes.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_list/wallet_edit_view_model.dart';
|
||||
@@ -94,9 +100,38 @@ class WalletEditPage extends BasePage {
|
||||
);
|
||||
} else {
|
||||
try {
|
||||
await walletEditViewModel.changeName(editingWallet);
|
||||
Navigator.of(context).pop();
|
||||
walletEditViewModel.resetState();
|
||||
bool confirmed = false;
|
||||
|
||||
if (SettingsStoreBase
|
||||
.walletPasswordDirectInput) {
|
||||
await Navigator.of(context).pushNamed(
|
||||
Routes.walletUnlockLoadable,
|
||||
arguments: WalletUnlockArguments(
|
||||
authPasswordHandler:
|
||||
(String password) async {
|
||||
await walletEditViewModel
|
||||
.changeName(editingWallet,
|
||||
password: password);
|
||||
},
|
||||
callback: (bool
|
||||
isAuthenticatedSuccessfully,
|
||||
AuthPageState auth) async {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close();
|
||||
confirmed = true;
|
||||
}
|
||||
},
|
||||
walletName: editingWallet.name,
|
||||
walletType: editingWallet.type));
|
||||
} else {
|
||||
await walletEditViewModel.changeName(editingWallet);
|
||||
confirmed = true;
|
||||
}
|
||||
|
||||
if (confirmed) {
|
||||
Navigator.of(context).pop();
|
||||
walletEditViewModel.resetState();
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
}
|
||||
@@ -120,11 +155,11 @@ class WalletEditPage extends BasePage {
|
||||
|
||||
Future<void> _removeWallet(BuildContext context) async {
|
||||
authService.authenticateAction(context, onAuthSuccess: (isAuthenticatedSuccessfully) async {
|
||||
if (!isAuthenticatedSuccessfully) {
|
||||
return;
|
||||
}
|
||||
if (!isAuthenticatedSuccessfully) {
|
||||
return;
|
||||
}
|
||||
|
||||
_onSuccessfulAuth(context);
|
||||
_onSuccessfulAuth(context);
|
||||
},
|
||||
conditionToDetermineIfToUse2FA: false,
|
||||
);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import 'package:cake_wallet/entities/wallet_list_order_types.dart';
|
||||
import 'package:cake_wallet/src/screens/dashboard/widgets/filter_list_widget.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_list/filtered_list.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/core/auth_service.dart';
|
||||
import 'package:cake_wallet/themes/extensions/filter_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/receive_page_theme.dart';
|
||||
@@ -336,6 +339,20 @@ class WalletListBodyState extends State<WalletListBody> {
|
||||
}
|
||||
|
||||
Future<void> _loadWallet(WalletListItem wallet) async {
|
||||
if (SettingsStoreBase.walletPasswordDirectInput) {
|
||||
Navigator.of(context).pushNamed(
|
||||
Routes.walletUnlockLoadable,
|
||||
arguments: WalletUnlockArguments(
|
||||
callback: (bool isAuthenticatedSuccessfully, AuthPageState auth) async {
|
||||
if (isAuthenticatedSuccessfully) {
|
||||
auth.close();
|
||||
setState(() {});
|
||||
}
|
||||
}, walletName: wallet.name,
|
||||
walletType: wallet.type));
|
||||
return;
|
||||
}
|
||||
|
||||
await widget.authService.authenticateAction(
|
||||
context,
|
||||
onAuthSuccess: (isAuthenticatedSuccessfully) async {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cw_core/wallet_type.dart';
|
||||
|
||||
typedef AuthPasswordHandler = Future<void> Function(String);
|
||||
|
||||
class WalletUnlockArguments {
|
||||
WalletUnlockArguments(
|
||||
{required this.callback,
|
||||
this.walletName,
|
||||
this.walletType,
|
||||
this.authPasswordHandler});
|
||||
|
||||
final OnAuthenticationFinished callback;
|
||||
final AuthPasswordHandler? authPasswordHandler;
|
||||
final String? walletName;
|
||||
final WalletType? walletType;
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
import 'package:another_flushbar/flushbar.dart';
|
||||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/generated/i18n.dart';
|
||||
import 'package:cake_wallet/src/screens/auth/auth_page.dart';
|
||||
import 'package:cake_wallet/src/screens/wallet_unlock/wallet_unlock_arguments.dart';
|
||||
import 'package:cake_wallet/src/widgets/primary_button.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/themes/extensions/new_wallet_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:cake_wallet/utils/show_bar.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cake_wallet/view_model/wallet_unlock_view_model.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
|
||||
class WalletUnlockPage extends StatefulWidget {
|
||||
WalletUnlockPage(
|
||||
this.walletUnlockViewModel, this.onAuthenticationFinished, this.authPasswordHandler,
|
||||
{required this.closable});
|
||||
|
||||
final WalletUnlockViewModel walletUnlockViewModel;
|
||||
final OnAuthenticationFinished onAuthenticationFinished;
|
||||
final AuthPasswordHandler? authPasswordHandler;
|
||||
final bool closable;
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => WalletUnlockPageState();
|
||||
}
|
||||
|
||||
class WalletUnlockPageState extends AuthPageState<WalletUnlockPage> {
|
||||
WalletUnlockPageState() : _passwordController = TextEditingController();
|
||||
|
||||
final TextEditingController _passwordController;
|
||||
final _key = GlobalKey<ScaffoldState>();
|
||||
final _backArrowImageDarkTheme = Image.asset('assets/images/close_button.png');
|
||||
ReactionDisposer? _reaction;
|
||||
Flushbar<void>? _authBar;
|
||||
Flushbar<void>? _progressBar;
|
||||
void Function()? _passwordControllerListener;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_reaction ??= reaction((_) => widget.walletUnlockViewModel.state, (ExecutionState state) {
|
||||
if (state is ExecutedSuccessfullyState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
widget.onAuthenticationFinished(true, this);
|
||||
});
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
if (state is IsExecutingState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// null duration to make it indefinite until its disposed
|
||||
_authBar = createBar<void>(S.of(context).authentication, duration: null)..show(context);
|
||||
});
|
||||
}
|
||||
|
||||
if (state is FailureState) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
dismissFlushBar(_authBar);
|
||||
showBar<void>(context, S.of(context).failed_authentication(state.error));
|
||||
|
||||
widget.onAuthenticationFinished(false, this);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
_passwordControllerListener =
|
||||
() => widget.walletUnlockViewModel.setPassword(_passwordController.text);
|
||||
|
||||
if (_passwordControllerListener != null) {
|
||||
_passwordController.addListener(_passwordControllerListener!);
|
||||
}
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_reaction?.reaction.dispose();
|
||||
|
||||
if (_passwordControllerListener != null) {
|
||||
_passwordController.removeListener(_passwordControllerListener!);
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void changeProcessText(String text) {
|
||||
dismissFlushBar(_authBar);
|
||||
_progressBar = createBar<void>(text, duration: null)..show(_key.currentContext!);
|
||||
}
|
||||
|
||||
@override
|
||||
void hideProgressText() {
|
||||
dismissFlushBar(_progressBar);
|
||||
_progressBar = null;
|
||||
}
|
||||
|
||||
void dismissFlushBar(Flushbar<dynamic>? bar) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
await bar?.dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close({String? route, arguments}) async {
|
||||
if (_key.currentContext == null) {
|
||||
throw Exception('Key context is null. Should be not happened');
|
||||
}
|
||||
|
||||
/// not the best scenario, but WidgetsBinding is not behaving correctly on Android
|
||||
await Future<void>.delayed(Duration(milliseconds: 50));
|
||||
await _authBar?.dismiss();
|
||||
await Future<void>.delayed(Duration(milliseconds: 50));
|
||||
await _progressBar?.dismiss();
|
||||
await Future<void>.delayed(Duration(milliseconds: 50));
|
||||
if (route != null) {
|
||||
Navigator.of(_key.currentContext!).pushReplacementNamed(route, arguments: arguments);
|
||||
} else {
|
||||
Navigator.of(_key.currentContext!).pop();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
key: _key,
|
||||
appBar: CupertinoNavigationBar(
|
||||
leading: widget.closable
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
child: SizedBox(
|
||||
height: 37,
|
||||
width: 37,
|
||||
child: InkWell(
|
||||
onTap: () => Navigator.of(context).pop(),
|
||||
child: _backArrowImageDarkTheme,
|
||||
),
|
||||
))
|
||||
: Container(),
|
||||
backgroundColor: Theme.of(context).colorScheme.background,
|
||||
border: null),
|
||||
resizeToAvoidBottomInset: false,
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
widget.walletUnlockViewModel.walletName,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24),
|
||||
Form(
|
||||
child: TextFormField(
|
||||
onChanged: (value) => null,
|
||||
controller: _passwordController,
|
||||
textAlign: TextAlign.center,
|
||||
obscureText: true,
|
||||
style: TextStyle(
|
||||
fontSize: 20.0,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 18.0,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Theme.of(context).extension<NewWalletTheme>()!.hintTextColor,
|
||||
),
|
||||
hintText: S.of(context).enter_wallet_password,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).extension<NewWalletTheme>()!.underlineColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Theme.of(context).extension<NewWalletTheme>()!.underlineColor,
|
||||
width: 1.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(bottom: 24),
|
||||
child: Observer(
|
||||
builder: (_) => LoadingPrimaryButton(
|
||||
onPressed: () async {
|
||||
if (widget.authPasswordHandler != null) {
|
||||
try {
|
||||
await widget
|
||||
.authPasswordHandler!(widget.walletUnlockViewModel.password);
|
||||
widget.walletUnlockViewModel.success();
|
||||
} catch (e) {
|
||||
widget.walletUnlockViewModel.failure(e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
widget.walletUnlockViewModel.unlock();
|
||||
},
|
||||
text: S.of(context).unlock,
|
||||
color: Colors.green,
|
||||
textColor: Colors.white,
|
||||
isLoading: widget.walletUnlockViewModel.state is IsExecutingState,
|
||||
isDisabled: widget.walletUnlockViewModel.state is IsExecutingState),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
|
||||
import 'package:cake_wallet/utils/responsive_layout_util.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -19,7 +19,10 @@ class AddressTextField extends StatelessWidget {
|
||||
{required this.controller,
|
||||
this.isActive = true,
|
||||
this.placeholder,
|
||||
this.options = const [AddressTextFieldOption.qrCode, AddressTextFieldOption.addressBook],
|
||||
this.options = const [
|
||||
AddressTextFieldOption.qrCode,
|
||||
AddressTextFieldOption.addressBook
|
||||
],
|
||||
this.onURIScanned,
|
||||
this.focusNode,
|
||||
this.isBorderExist = true,
|
||||
|
||||
Reference in New Issue
Block a user