mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-05-03 19:32:40 +00:00
Merge remote-tracking branch 'origin/staging' into appConfig
This commit is contained in:
commit
bb1dc22af1
14 changed files with 842 additions and 579 deletions
lib
models/isar
pages
add_wallet_views
frost_ms/restore
new_wallet_recovery_phrase_view
settings_views/wallet_settings_view/wallet_settings_wallet_settings
delete_wallet_recovery_phrase_view.dartdelete_wallet_warning_view.dartwallet_settings_wallet_settings_view.dart
wallet_view
themes
widgets
|
@ -13,11 +13,11 @@ import 'dart:io';
|
|||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/themes/color_theme.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/extensions/impl/box_shadow.dart';
|
||||
import 'package:stackwallet/utilities/extensions/impl/gradient.dart';
|
||||
import 'package:stackwallet/utilities/extensions/impl/string.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/stack_file_system.dart';
|
||||
|
||||
part 'stack_theme.g.dart';
|
||||
|
@ -1857,13 +1857,16 @@ class StackTheme {
|
|||
|
||||
final Map<Coin, Color> result = {};
|
||||
|
||||
for (final coin in Coin.values) {
|
||||
for (final coin in Coin.values.map((e) => e.mainNetVersion)) {
|
||||
if (map[coin.name] is String) {
|
||||
result[coin] = Color(
|
||||
(map[coin.name] as String).toBigIntFromHex.toInt(),
|
||||
);
|
||||
} else {
|
||||
result[coin] = kCoinThemeColorDefaults.forCoin(coin);
|
||||
Logging.instance.log(
|
||||
"Color not found in theme for $coin",
|
||||
level: LogLevel.Error,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -268,89 +268,6 @@ class _RestoreFrostMsWalletViewState
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
child: TextField(
|
||||
key: const Key("frMyNameTextFieldKey"),
|
||||
controller: keysFieldController,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
_keysEmpty = keysFieldController.text.isEmpty;
|
||||
});
|
||||
},
|
||||
focusNode: keysFocusNode,
|
||||
readOnly: false,
|
||||
autocorrect: false,
|
||||
enableSuggestions: false,
|
||||
style: STextStyles.field(context),
|
||||
decoration: standardInputDecoration(
|
||||
"Keys",
|
||||
keysFocusNode,
|
||||
context,
|
||||
).copyWith(
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
top: 6,
|
||||
bottom: 8,
|
||||
right: 5,
|
||||
),
|
||||
suffixIcon: Padding(
|
||||
padding: _keysEmpty
|
||||
? const EdgeInsets.only(right: 8)
|
||||
: const EdgeInsets.only(right: 0),
|
||||
child: UnconstrainedBox(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
!_keysEmpty
|
||||
? TextFieldIconButton(
|
||||
semanticsLabel:
|
||||
"Clear Button. Clears The Keys Field.",
|
||||
key: const Key("frMyNameClearButtonKey"),
|
||||
onTap: () {
|
||||
keysFieldController.text = "";
|
||||
|
||||
setState(() {
|
||||
_keysEmpty = true;
|
||||
});
|
||||
},
|
||||
child: const XIcon(),
|
||||
)
|
||||
: TextFieldIconButton(
|
||||
semanticsLabel:
|
||||
"Paste Button. Pastes From Clipboard To Keys Field.",
|
||||
key: const Key("frKeysPasteButtonKey"),
|
||||
onTap: () async {
|
||||
final ClipboardData? data =
|
||||
await Clipboard.getData(
|
||||
Clipboard.kTextPlain);
|
||||
if (data?.text != null &&
|
||||
data!.text!.isNotEmpty) {
|
||||
keysFieldController.text =
|
||||
data.text!.trim();
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_keysEmpty =
|
||||
keysFieldController.text.isEmpty;
|
||||
});
|
||||
},
|
||||
child: _keysEmpty
|
||||
? const ClipboardIcon()
|
||||
: const XIcon(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
|
@ -411,7 +328,8 @@ class _RestoreFrostMsWalletViewState
|
|||
onTap: () async {
|
||||
final ClipboardData? data =
|
||||
await Clipboard.getData(
|
||||
Clipboard.kTextPlain);
|
||||
Clipboard.kTextPlain,
|
||||
);
|
||||
if (data?.text != null &&
|
||||
data!.text!.isNotEmpty) {
|
||||
configFieldController.text =
|
||||
|
@ -437,7 +355,8 @@ class _RestoreFrostMsWalletViewState
|
|||
if (FocusScope.of(context).hasFocus) {
|
||||
FocusScope.of(context).unfocus();
|
||||
await Future<void>.delayed(
|
||||
const Duration(milliseconds: 75));
|
||||
const Duration(milliseconds: 75),
|
||||
);
|
||||
}
|
||||
|
||||
final qrResult = await BarcodeScanner.scan();
|
||||
|
@ -457,7 +376,91 @@ class _RestoreFrostMsWalletViewState
|
|||
}
|
||||
},
|
||||
child: const QrCodeIcon(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
child: TextField(
|
||||
key: const Key("frMyNameTextFieldKey"),
|
||||
controller: keysFieldController,
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
_keysEmpty = keysFieldController.text.isEmpty;
|
||||
});
|
||||
},
|
||||
focusNode: keysFocusNode,
|
||||
readOnly: false,
|
||||
autocorrect: false,
|
||||
enableSuggestions: false,
|
||||
style: STextStyles.field(context),
|
||||
decoration: standardInputDecoration(
|
||||
"Keys",
|
||||
keysFocusNode,
|
||||
context,
|
||||
).copyWith(
|
||||
contentPadding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
top: 6,
|
||||
bottom: 8,
|
||||
right: 5,
|
||||
),
|
||||
suffixIcon: Padding(
|
||||
padding: _keysEmpty
|
||||
? const EdgeInsets.only(right: 8)
|
||||
: const EdgeInsets.only(right: 0),
|
||||
child: UnconstrainedBox(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
!_keysEmpty
|
||||
? TextFieldIconButton(
|
||||
semanticsLabel:
|
||||
"Clear Button. Clears The Keys Field.",
|
||||
key: const Key("frMyNameClearButtonKey"),
|
||||
onTap: () {
|
||||
keysFieldController.text = "";
|
||||
|
||||
setState(() {
|
||||
_keysEmpty = true;
|
||||
});
|
||||
},
|
||||
child: const XIcon(),
|
||||
)
|
||||
: TextFieldIconButton(
|
||||
semanticsLabel:
|
||||
"Paste Button. Pastes From Clipboard To Keys Field.",
|
||||
key: const Key("frKeysPasteButtonKey"),
|
||||
onTap: () async {
|
||||
final ClipboardData? data =
|
||||
await Clipboard.getData(
|
||||
Clipboard.kTextPlain,
|
||||
);
|
||||
if (data?.text != null &&
|
||||
data!.text!.isNotEmpty) {
|
||||
keysFieldController.text =
|
||||
data.text!.trim();
|
||||
}
|
||||
|
||||
setState(() {
|
||||
_keysEmpty =
|
||||
keysFieldController.text.isEmpty;
|
||||
});
|
||||
},
|
||||
child: _keysEmpty
|
||||
? const ClipboardIcon()
|
||||
: const XIcon(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
|
@ -31,6 +31,7 @@ import 'package:stackwallet/utilities/text_styles.dart';
|
|||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet.dart';
|
||||
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||
|
@ -180,6 +181,22 @@ class _NewWalletRecoveryPhraseViewState
|
|||
child: Padding(
|
||||
padding:
|
||||
isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16),
|
||||
child: ConditionalParent(
|
||||
condition: Util.isDesktop,
|
||||
builder: (child) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
|
@ -215,7 +232,9 @@ class _NewWalletRecoveryPhraseViewState
|
|||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: isDesktop
|
||||
? Theme.of(context).extension<StackColors>()!.background
|
||||
? Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.background
|
||||
: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius),
|
||||
|
@ -330,6 +349,7 @@ class _NewWalletRecoveryPhraseViewState
|
|||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import 'package:flutter_svg/svg.dart';
|
|||
import 'package:stackwallet/notifications/show_flush_bar.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart';
|
||||
import 'package:stackwallet/pages/home_view/home_view.dart';
|
||||
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_details_view.dart';
|
||||
import 'package:stackwallet/providers/global/secure_store_provider.dart';
|
||||
import 'package:stackwallet/providers/global/wallets_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
|
@ -24,23 +25,35 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/clipboard_interface.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/simple_copy_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/detail_item.dart';
|
||||
import 'package:stackwallet/widgets/rounded_white_container.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class DeleteWalletRecoveryPhraseView extends ConsumerStatefulWidget {
|
||||
const DeleteWalletRecoveryPhraseView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
required this.mnemonic,
|
||||
this.frostWalletData,
|
||||
this.clipboardInterface = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const routeName = "/deleteWalletRecoveryPhrase";
|
||||
|
||||
final String walletId;
|
||||
final List<String> mnemonic;
|
||||
final ({
|
||||
String myName,
|
||||
String config,
|
||||
String keys,
|
||||
({String config, String keys})? prevGen,
|
||||
})? frostWalletData;
|
||||
|
||||
final ClipboardInterface clipboardInterface;
|
||||
|
||||
|
@ -54,6 +67,62 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
late List<String> _mnemonic;
|
||||
late ClipboardInterface _clipboardInterface;
|
||||
|
||||
bool _lock = false;
|
||||
|
||||
void _continuePressed() {
|
||||
if (_lock) {
|
||||
return;
|
||||
}
|
||||
_lock = true;
|
||||
try {
|
||||
showDialog<dynamic>(
|
||||
barrierDismissible: true,
|
||||
context: context,
|
||||
builder: (_) => StackDialog(
|
||||
title: "Thanks! Your wallet will be deleted.",
|
||||
leftButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonStyle(context),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: STextStyles.button(context).copyWith(
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonStyle(context),
|
||||
onPressed: () async {
|
||||
await ref.read(pWallets).deleteWallet(
|
||||
ref.read(pWalletInfo(widget.walletId)),
|
||||
ref.read(secureStoreProvider),
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(HomeView.routeName),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Ok",
|
||||
style: STextStyles.button(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
_lock = false;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_mnemonic = widget.mnemonic;
|
||||
|
@ -65,6 +134,9 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
Widget build(BuildContext context) {
|
||||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final bool frost = widget.frostWalletData != null;
|
||||
final prevGen = widget.frostWalletData?.prevGen != null;
|
||||
|
||||
return Background(
|
||||
child: Scaffold(
|
||||
backgroundColor: Theme.of(context).extension<StackColors>()!.background,
|
||||
|
@ -93,7 +165,7 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
onPressed: () async {
|
||||
await _clipboardInterface
|
||||
.setData(ClipboardData(text: _mnemonic.join(" ")));
|
||||
if (mounted) {
|
||||
if (context.mounted) {
|
||||
unawaited(
|
||||
showFloatingFlushBar(
|
||||
type: FlushBarType.info,
|
||||
|
@ -111,7 +183,138 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: frost
|
||||
? LayoutBuilder(
|
||||
builder: (builderContext, constraints) {
|
||||
return SingleChildScrollView(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"Please write down your backup data. Keep it safe and "
|
||||
"never share it with anyone. "
|
||||
"Your backup data is the only way you can access your "
|
||||
"funds if you forget your PIN, lose your phone, etc."
|
||||
"\n\n"
|
||||
"Stack Wallet does not keep nor is able to restore "
|
||||
"your backup data. "
|
||||
"Only you have access to your wallet.",
|
||||
style: STextStyles.label(context),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
// DetailItem(
|
||||
// title: "My name",
|
||||
// detail: frostWalletData!.myName,
|
||||
// button: Util.isDesktop
|
||||
// ? IconCopyButton(
|
||||
// data: frostWalletData!.myName,
|
||||
// )
|
||||
// : SimpleCopyButton(
|
||||
// data: frostWalletData!.myName,
|
||||
// ),
|
||||
// ),
|
||||
// const SizedBox(
|
||||
// height: 16,
|
||||
// ),
|
||||
DetailItem(
|
||||
title: "Multisig config",
|
||||
detail: widget.frostWalletData!.config,
|
||||
button: Util.isDesktop
|
||||
? IconCopyButton(
|
||||
data: widget.frostWalletData!.config,
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: widget.frostWalletData!.config,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
DetailItem(
|
||||
title: "Keys",
|
||||
detail: widget.frostWalletData!.keys,
|
||||
button: Util.isDesktop
|
||||
? IconCopyButton(
|
||||
data: widget.frostWalletData!.keys,
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: widget.frostWalletData!.keys,
|
||||
),
|
||||
),
|
||||
if (prevGen)
|
||||
const SizedBox(
|
||||
height: 24,
|
||||
),
|
||||
if (prevGen)
|
||||
RoundedWhiteContainer(
|
||||
child: Text(
|
||||
"Previous generation info",
|
||||
style: STextStyles.label(context),
|
||||
),
|
||||
),
|
||||
if (prevGen)
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
if (prevGen)
|
||||
DetailItem(
|
||||
title: "Previous multisig config",
|
||||
detail:
|
||||
widget.frostWalletData!.prevGen!.config,
|
||||
button: Util.isDesktop
|
||||
? IconCopyButton(
|
||||
data: widget
|
||||
.frostWalletData!.prevGen!.config,
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: widget
|
||||
.frostWalletData!.prevGen!.config,
|
||||
),
|
||||
),
|
||||
if (prevGen)
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
if (prevGen)
|
||||
DetailItem(
|
||||
title: "Previous keys",
|
||||
detail: widget.frostWalletData!.prevGen!.keys,
|
||||
button: Util.isDesktop
|
||||
? IconCopyButton(
|
||||
data: widget
|
||||
.frostWalletData!.prevGen!.keys,
|
||||
)
|
||||
: SimpleCopyButton(
|
||||
data: widget
|
||||
.frostWalletData!.prevGen!.keys,
|
||||
),
|
||||
),
|
||||
|
||||
const Spacer(),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
PrimaryButton(
|
||||
label: "Continue",
|
||||
onPressed: _continuePressed,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
)
|
||||
: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const SizedBox(
|
||||
|
@ -137,9 +340,11 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.popupBG,
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius),
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
@ -148,7 +353,8 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
style: STextStyles.label(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -170,50 +376,7 @@ class _DeleteWalletRecoveryPhraseViewState
|
|||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonStyle(context),
|
||||
onPressed: () {
|
||||
showDialog<dynamic>(
|
||||
barrierDismissible: true,
|
||||
context: context,
|
||||
builder: (_) => StackDialog(
|
||||
title: "Thanks! Your wallet will be deleted.",
|
||||
leftButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonStyle(context),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: STextStyles.button(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
),
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getPrimaryEnabledButtonStyle(context),
|
||||
onPressed: () async {
|
||||
await ref.read(pWallets).deleteWallet(
|
||||
ref.read(pWalletInfo(widget.walletId)),
|
||||
ref.read(secureStoreProvider),
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
Navigator.of(context).popUntil(
|
||||
ModalRoute.withName(HomeView.routeName));
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
"Ok",
|
||||
style: STextStyles.button(context),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
onPressed: _continuePressed,
|
||||
child: Text(
|
||||
"Continue",
|
||||
style: STextStyles.button(context),
|
||||
|
|
|
@ -14,6 +14,7 @@ import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_set
|
|||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/wallets/wallet/impl/bitcoin_frost_wallet.dart';
|
||||
import 'package:stackwallet/wallets/wallet/wallet_mixin_interfaces/mnemonic_interface.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
@ -21,9 +22,9 @@ import 'package:stackwallet/widgets/rounded_container.dart';
|
|||
|
||||
class DeleteWalletWarningView extends ConsumerWidget {
|
||||
const DeleteWalletWarningView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/deleteWalletWarning";
|
||||
|
||||
|
@ -100,14 +101,50 @@ class DeleteWalletWarningView extends ConsumerWidget {
|
|||
.getPrimaryEnabledButtonStyle(context),
|
||||
onPressed: () async {
|
||||
final wallet = ref.read(pWallets).getWallet(walletId);
|
||||
final mnemonic =
|
||||
await (wallet as MnemonicInterface).getMnemonicAsWords();
|
||||
|
||||
// TODO: [prio=med] take wallets that don't have a mnemonic into account
|
||||
|
||||
List<String>? mnemonic;
|
||||
({
|
||||
String myName,
|
||||
String config,
|
||||
String keys,
|
||||
({String config, String keys})? prevGen,
|
||||
})? frostWalletData;
|
||||
|
||||
if (wallet is BitcoinFrostWallet) {
|
||||
final futures = [
|
||||
wallet.getSerializedKeys(),
|
||||
wallet.getMultisigConfig(),
|
||||
wallet.getSerializedKeysPrevGen(),
|
||||
wallet.getMultisigConfigPrevGen(),
|
||||
];
|
||||
|
||||
final results = await Future.wait(futures);
|
||||
|
||||
if (results.length == 4) {
|
||||
frostWalletData = (
|
||||
myName: wallet.frostInfo.myName,
|
||||
config: results[1]!,
|
||||
keys: results[0]!,
|
||||
prevGen: results[2] == null || results[3] == null
|
||||
? null
|
||||
: (
|
||||
config: results[3]!,
|
||||
keys: results[2]!,
|
||||
),
|
||||
);
|
||||
}
|
||||
} else if (wallet is MnemonicInterface) {
|
||||
mnemonic = await wallet.getMnemonicAsWords();
|
||||
}
|
||||
if (context.mounted) {
|
||||
await Navigator.of(context).pushNamed(
|
||||
DeleteWalletRecoveryPhraseView.routeName,
|
||||
arguments: (
|
||||
walletId: walletId,
|
||||
mnemonicWords: mnemonic,
|
||||
mnemonicWords: mnemonic ?? [],
|
||||
frostWalletData: frostWalletData,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -124,7 +124,8 @@ class WalletSettingsWalletSettingsView extends ConsumerWidget {
|
|||
style: STextStyles.button(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
.accentColorDark,
|
||||
),
|
||||
),
|
||||
),
|
||||
rightButton: TextButton(
|
||||
|
@ -150,7 +151,8 @@ class WalletSettingsWalletSettingsView extends ConsumerWidget {
|
|||
"Delete wallet",
|
||||
),
|
||||
settings: const RouteSettings(
|
||||
name: "/deleteWalletLockscreen"),
|
||||
name: "/deleteWalletLockscreen",
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
@ -15,7 +15,7 @@ import 'package:stackwallet/widgets/coin_card.dart';
|
|||
|
||||
class WalletSummary extends StatelessWidget {
|
||||
const WalletSummary({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
required this.initialSyncStatus,
|
||||
this.aspectRatio = 2.0,
|
||||
|
@ -23,7 +23,7 @@ class WalletSummary extends StatelessWidget {
|
|||
this.minWidth = 200.0,
|
||||
this.maxHeight = 250.0,
|
||||
this.maxWidth = 400.0,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
final String walletId;
|
||||
final WalletSyncStatus initialSyncStatus;
|
||||
|
|
|
@ -63,18 +63,21 @@ class WalletSummaryInfo extends ConsumerWidget {
|
|||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final externalCalls = ref.watch(
|
||||
prefsChangeNotifierProvider.select((value) => value.externalCalls));
|
||||
prefsChangeNotifierProvider.select((value) => value.externalCalls),
|
||||
);
|
||||
final coin = ref.watch(pWalletCoin(walletId));
|
||||
final balance = ref.watch(pWalletBalance(walletId));
|
||||
|
||||
final locale = ref.watch(
|
||||
localeServiceChangeNotifierProvider.select((value) => value.locale));
|
||||
localeServiceChangeNotifierProvider.select((value) => value.locale),
|
||||
);
|
||||
|
||||
final baseCurrency = ref
|
||||
.watch(prefsChangeNotifierProvider.select((value) => value.currency));
|
||||
|
||||
final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider
|
||||
.select((value) => value.getPrice(coin)));
|
||||
final priceTuple = ref.watch(
|
||||
priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin)),
|
||||
);
|
||||
|
||||
final _showAvailable =
|
||||
ref.watch(walletBalanceToggleStateProvider.state).state ==
|
||||
|
@ -206,7 +209,7 @@ class WalletSummaryInfo extends ConsumerWidget {
|
|||
initialSyncStatus: initialSyncStatus,
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
@ -99,11 +99,11 @@ import 'package:tuple/tuple.dart';
|
|||
/// [eventBus] should only be set during testing
|
||||
class WalletView extends ConsumerStatefulWidget {
|
||||
const WalletView({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.walletId,
|
||||
this.eventBus,
|
||||
this.clipboardInterface = const ClipboardWrapper(),
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
static const String routeName = "/wallet";
|
||||
static const double navBarHeight = 65.0;
|
||||
|
|
|
@ -1745,6 +1745,27 @@ class RouteGenerator {
|
|||
name: settings.name,
|
||||
),
|
||||
);
|
||||
} else if (args is ({
|
||||
String walletId,
|
||||
List<String> mnemonicWords,
|
||||
({
|
||||
String myName,
|
||||
String config,
|
||||
String keys,
|
||||
({String config, String keys})? prevGen,
|
||||
})? frostWalletData,
|
||||
})) {
|
||||
return getRoute(
|
||||
shouldUseMaterialRoute: useMaterialPageRoute,
|
||||
builder: (_) => DeleteWalletRecoveryPhraseView(
|
||||
mnemonic: args.mnemonicWords,
|
||||
walletId: args.walletId,
|
||||
frostWalletData: args.frostWalletData,
|
||||
),
|
||||
settings: RouteSettings(
|
||||
name: settings.name,
|
||||
),
|
||||
);
|
||||
}
|
||||
return _routeError("${settings.name} invalid args: ${args.toString()}");
|
||||
|
||||
|
|
|
@ -8,10 +8,12 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/models/isar/stack_theme.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/themes/theme_service.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
||||
final applicationThemesDirectoryPathProvider = StateProvider((ref) => "");
|
||||
|
||||
|
@ -38,3 +40,11 @@ final themeAssetsProvider = StateProvider<IThemeAssets>(
|
|||
),
|
||||
),
|
||||
);
|
||||
|
||||
final pCoinColor = StateProvider.family<Color, Coin>(
|
||||
(ref, coin) =>
|
||||
ref.watch(
|
||||
themeProvider.select((value) => value.coinColors[coin.mainNetVersion]),
|
||||
) ??
|
||||
Colors.deepOrangeAccent,
|
||||
);
|
||||
|
|
|
@ -29,7 +29,7 @@ final pThemeService = Provider<ThemeService>((ref) {
|
|||
});
|
||||
|
||||
class ThemeService {
|
||||
static const _currentDefaultThemeVersion = 9;
|
||||
static const _currentDefaultThemeVersion = 10;
|
||||
ThemeService._();
|
||||
static ThemeService? _instance;
|
||||
static ThemeService get instance => _instance ??= ThemeService._();
|
||||
|
|
|
@ -14,7 +14,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/themes/coin_card_provider.dart';
|
||||
import 'package:stackwallet/themes/stack_colors.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||
|
@ -68,9 +68,7 @@ class CoinCard extends ConsumerWidget {
|
|||
width: width,
|
||||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.colorForCoin(coin),
|
||||
color: ref.watch(pCoinColor(coin)),
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
|
|
|
@ -153,12 +153,15 @@ class _FrostStepQrDialogState extends State<FrostStepQrDialog> {
|
|||
child: QrImageView(
|
||||
data: widget.data,
|
||||
padding: EdgeInsets.zero,
|
||||
dataModuleStyle: QrDataModuleStyle(
|
||||
dataModuleShape: QrDataModuleShape.square,
|
||||
color: Theme.of(context)
|
||||
foregroundColor: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark,
|
||||
),
|
||||
// dataModuleStyle: QrDataModuleStyle(
|
||||
// dataModuleShape: QrDataModuleShape.square,
|
||||
// color: Theme.of(context)
|
||||
// .extension<StackColors>()!
|
||||
// .accentColorDark,
|
||||
// ),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue