diff --git a/assets/svg/address-book2.svg b/assets/svg/address-book2.svg
new file mode 100644
index 000000000..18de31c55
--- /dev/null
+++ b/assets/svg/address-book2.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/svg/chevron-right.svg b/assets/svg/chevron-right.svg
new file mode 100644
index 000000000..c8efcde44
--- /dev/null
+++ b/assets/svg/chevron-right.svg
@@ -0,0 +1,3 @@
+
diff --git a/assets/svg/dark/bell-new.svg b/assets/svg/dark/bell-new.svg
new file mode 100644
index 000000000..f976e0986
--- /dev/null
+++ b/assets/svg/dark/bell-new.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/svg/dark/buy-coins-icon.svg b/assets/svg/dark/buy-coins-icon.svg
new file mode 100644
index 000000000..9170c4190
--- /dev/null
+++ b/assets/svg/dark/buy-coins-icon.svg
@@ -0,0 +1,18 @@
+
diff --git a/assets/svg/dark/exchange-2.svg b/assets/svg/dark/exchange-2.svg
new file mode 100644
index 000000000..ee04dcebe
--- /dev/null
+++ b/assets/svg/dark/exchange-2.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/svg/dark/stack-icon1.svg b/assets/svg/dark/stack-icon1.svg
new file mode 100644
index 000000000..4fb16176a
--- /dev/null
+++ b/assets/svg/dark/stack-icon1.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/svg/dark/tx-exchange-icon-failed.svg b/assets/svg/dark/tx-exchange-icon-failed.svg
new file mode 100644
index 000000000..64acda4e9
--- /dev/null
+++ b/assets/svg/dark/tx-exchange-icon-failed.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/svg/dark/tx-exchange-icon-pending.svg b/assets/svg/dark/tx-exchange-icon-pending.svg
new file mode 100644
index 000000000..f9cdeb7c2
--- /dev/null
+++ b/assets/svg/dark/tx-exchange-icon-pending.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/svg/dark/tx-exchange-icon.svg b/assets/svg/dark/tx-exchange-icon.svg
new file mode 100644
index 000000000..36b2cf7cc
--- /dev/null
+++ b/assets/svg/dark/tx-exchange-icon.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/svg/dark/tx-icon-receive-failed.svg b/assets/svg/dark/tx-icon-receive-failed.svg
new file mode 100644
index 000000000..cb1d500b1
--- /dev/null
+++ b/assets/svg/dark/tx-icon-receive-failed.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/svg/dark/tx-icon-receive-pending.svg b/assets/svg/dark/tx-icon-receive-pending.svg
new file mode 100644
index 000000000..efb8350b3
--- /dev/null
+++ b/assets/svg/dark/tx-icon-receive-pending.svg
@@ -0,0 +1,12 @@
+
diff --git a/assets/svg/dark/tx-icon-receive.svg b/assets/svg/dark/tx-icon-receive.svg
new file mode 100644
index 000000000..15be19d52
--- /dev/null
+++ b/assets/svg/dark/tx-icon-receive.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/svg/dark/tx-icon-send-failed.svg b/assets/svg/dark/tx-icon-send-failed.svg
new file mode 100644
index 000000000..2be637ef3
--- /dev/null
+++ b/assets/svg/dark/tx-icon-send-failed.svg
@@ -0,0 +1,14 @@
+
diff --git a/assets/svg/dark/tx-icon-send-pending.svg b/assets/svg/dark/tx-icon-send-pending.svg
new file mode 100644
index 000000000..50cca5a9e
--- /dev/null
+++ b/assets/svg/dark/tx-icon-send-pending.svg
@@ -0,0 +1,13 @@
+
diff --git a/assets/svg/dark/tx-icon-send.svg b/assets/svg/dark/tx-icon-send.svg
new file mode 100644
index 000000000..0e64ee37e
--- /dev/null
+++ b/assets/svg/dark/tx-icon-send.svg
@@ -0,0 +1,11 @@
+
diff --git a/assets/svg/exchange-3.svg b/assets/svg/exchange-3.svg
new file mode 100644
index 000000000..4a3c92524
--- /dev/null
+++ b/assets/svg/exchange-3.svg
@@ -0,0 +1,4 @@
+
diff --git a/assets/svg/bell-new.svg b/assets/svg/light/bell-new.svg
similarity index 100%
rename from assets/svg/bell-new.svg
rename to assets/svg/light/bell-new.svg
diff --git a/assets/svg/buy-coins-icon.svg b/assets/svg/light/buy-coins-icon.svg
similarity index 100%
rename from assets/svg/buy-coins-icon.svg
rename to assets/svg/light/buy-coins-icon.svg
diff --git a/assets/svg/exchange-2.svg b/assets/svg/light/exchange-2.svg
similarity index 100%
rename from assets/svg/exchange-2.svg
rename to assets/svg/light/exchange-2.svg
diff --git a/assets/svg/light/stack-icon1.svg b/assets/svg/light/stack-icon1.svg
new file mode 100644
index 000000000..f316012d7
--- /dev/null
+++ b/assets/svg/light/stack-icon1.svg
@@ -0,0 +1,5 @@
+
diff --git a/assets/svg/tx-exchange-icon-failed.svg b/assets/svg/light/tx-exchange-icon-failed.svg
similarity index 100%
rename from assets/svg/tx-exchange-icon-failed.svg
rename to assets/svg/light/tx-exchange-icon-failed.svg
diff --git a/assets/svg/tx-exchange-icon-pending.svg b/assets/svg/light/tx-exchange-icon-pending.svg
similarity index 100%
rename from assets/svg/tx-exchange-icon-pending.svg
rename to assets/svg/light/tx-exchange-icon-pending.svg
diff --git a/assets/svg/tx-exchange-icon.svg b/assets/svg/light/tx-exchange-icon.svg
similarity index 100%
rename from assets/svg/tx-exchange-icon.svg
rename to assets/svg/light/tx-exchange-icon.svg
diff --git a/assets/svg/tx-icon-receive-failed.svg b/assets/svg/light/tx-icon-receive-failed.svg
similarity index 100%
rename from assets/svg/tx-icon-receive-failed.svg
rename to assets/svg/light/tx-icon-receive-failed.svg
diff --git a/assets/svg/tx-icon-receive-pending.svg b/assets/svg/light/tx-icon-receive-pending.svg
similarity index 100%
rename from assets/svg/tx-icon-receive-pending.svg
rename to assets/svg/light/tx-icon-receive-pending.svg
diff --git a/assets/svg/tx-icon-receive.svg b/assets/svg/light/tx-icon-receive.svg
similarity index 100%
rename from assets/svg/tx-icon-receive.svg
rename to assets/svg/light/tx-icon-receive.svg
diff --git a/assets/svg/tx-icon-send-failed.svg b/assets/svg/light/tx-icon-send-failed.svg
similarity index 100%
rename from assets/svg/tx-icon-send-failed.svg
rename to assets/svg/light/tx-icon-send-failed.svg
diff --git a/assets/svg/tx-icon-send-pending.svg b/assets/svg/light/tx-icon-send-pending.svg
similarity index 100%
rename from assets/svg/tx-icon-send-pending.svg
rename to assets/svg/light/tx-icon-send-pending.svg
diff --git a/assets/svg/tx-icon-send.svg b/assets/svg/light/tx-icon-send.svg
similarity index 100%
rename from assets/svg/tx-icon-send.svg
rename to assets/svg/light/tx-icon-send.svg
diff --git a/assets/svg/message-question-1.svg b/assets/svg/message-question-1.svg
new file mode 100644
index 000000000..17e066651
--- /dev/null
+++ b/assets/svg/message-question-1.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/svg/minimize.svg b/assets/svg/minimize.svg
new file mode 100644
index 000000000..94292fed4
--- /dev/null
+++ b/assets/svg/minimize.svg
@@ -0,0 +1,10 @@
+
diff --git a/assets/svg/stack-icon1.svg b/assets/svg/stack-icon1.svg
deleted file mode 100644
index bf5f8fae7..000000000
--- a/assets/svg/stack-icon1.svg
+++ /dev/null
@@ -1,12 +0,0 @@
-
diff --git a/assets/svg/wallet-fa.svg b/assets/svg/wallet-fa.svg
new file mode 100644
index 000000000..a91170596
--- /dev/null
+++ b/assets/svg/wallet-fa.svg
@@ -0,0 +1,4 @@
+
diff --git a/lib/hive/db.dart b/lib/hive/db.dart
index 3aae3096a..c8e148923 100644
--- a/lib/hive/db.dart
+++ b/lib/hive/db.dart
@@ -9,7 +9,6 @@ import 'package:stackwallet/models/notification_model.dart';
import 'package:stackwallet/models/trade_wallet_lookup.dart';
import 'package:stackwallet/services/wallets_service.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
-
import 'package:stackwallet/utilities/logger.dart';
class DB {
@@ -30,6 +29,7 @@ class DB {
static const String boxNameWalletsToDeleteOnStart = "walletsToDeleteOnStart";
static const String boxNamePriceCache = "priceAPIPrice24hCache";
static const String boxNameDBInfo = "dbInfo";
+ static const String boxNameTheme = "theme";
String boxNameTxCache({required Coin coin}) => "${coin.name}_txCache";
String boxNameSetCache({required Coin coin}) =>
diff --git a/lib/main.dart b/lib/main.dart
index 5aeb89508..54d4b2332 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -29,6 +29,7 @@ import 'package:stackwallet/pages/loading_view.dart';
import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
import 'package:stackwallet/pages/pinpad_views/lock_screen_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/stack_backup_views/restore_from_encrypted_string_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/desktop_home_view.dart';
import 'package:stackwallet/providers/exchange/available_currencies_state_provider.dart';
import 'package:stackwallet/providers/exchange/available_floating_rate_pairs_state_provider.dart';
import 'package:stackwallet/providers/exchange/change_now_provider.dart';
@@ -49,13 +50,16 @@ import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/services/notifications_service.dart';
import 'package:stackwallet/services/trade_service.dart';
import 'package:stackwallet/services/wallets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/db_version_migration.dart';
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/prefs.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/color_theme.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.dart';
+import 'package:window_size/window_size.dart';
final openedFromSWBFileStringStateProvider =
StateProvider((ref) => null);
@@ -65,6 +69,13 @@ final openedFromSWBFileStringStateProvider =
// miscellaneous box for later use
void main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
+
+ if (Util.isDesktop) {
+ setWindowTitle('Stack Wallet');
+ setWindowMinSize(const Size(1200, 900));
+ setWindowMaxSize(Size.infinite);
+ }
+
Directory appDirectory = (await getApplicationDocumentsDirectory());
if (Platform.isIOS) {
appDirectory = (await getLibraryDirectory());
@@ -130,6 +141,19 @@ void main() async {
monero.onStartup();
+ await Hive.openBox(DB.boxNameTheme);
+ final colorScheme = DB.instance
+ .get(boxName: DB.boxNameTheme, key: "colorScheme") as String?;
+
+ switch (colorScheme) {
+ case "dark":
+ StackTheme.instance.setTheme(ThemeType.dark);
+ break;
+ case "light":
+ default:
+ StackTheme.instance.setTheme(ThemeType.light);
+ }
+
// SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
// overlays: [SystemUiOverlay.bottom]);
await NotificationApi.init();
@@ -497,11 +521,16 @@ class _MaterialAppWithThemeState extends ConsumerState
title: 'Stack Wallet',
onGenerateRoute: RouteGenerator.generateRoute,
theme: ThemeData(
- highlightColor: CFColors.splashLight,
+ highlightColor: StackTheme.instance.color.highlight,
brightness: Brightness.light,
fontFamily: GoogleFonts.inter().fontFamily,
+ unselectedWidgetColor:
+ StackTheme.instance.color.radioButtonBorderDisabled,
textTheme: GoogleFonts.interTextTheme().copyWith(
button: STextStyles.button,
+ subtitle1: STextStyles.field.copyWith(
+ color: StackTheme.instance.color.textDark,
+ ),
),
radioTheme: const RadioThemeData(
splashRadius: 0,
@@ -509,18 +538,20 @@ class _MaterialAppWithThemeState extends ConsumerState
),
// splashFactory: NoSplash.splashFactory,
splashColor: Colors.transparent,
- buttonTheme: const ButtonThemeData(
- splashColor: CFColors.splashMed,
+ buttonTheme: ButtonThemeData(
+ splashColor: StackTheme.instance.color.splash,
),
textButtonTheme: TextButtonThemeData(
style: ButtonStyle(
// splashFactory: NoSplash.splashFactory,
- overlayColor: MaterialStateProperty.all(CFColors.splashMed),
+ overlayColor:
+ MaterialStateProperty.all(StackTheme.instance.color.splash),
minimumSize: MaterialStateProperty.all(const Size(46, 46)),
textStyle: MaterialStateProperty.all(STextStyles.button),
- foregroundColor: MaterialStateProperty.all(CFColors.white),
- backgroundColor:
- MaterialStateProperty.all(CFColors.buttonGray),
+ foregroundColor: MaterialStateProperty.all(
+ StackTheme.instance.color.buttonTextSecondary),
+ backgroundColor: MaterialStateProperty.all(
+ StackTheme.instance.color.buttonBackSecondary),
shape: MaterialStateProperty.all(
RoundedRectangleBorder(
// 1000 to be relatively sure it keeps its pill shape
@@ -529,8 +560,9 @@ class _MaterialAppWithThemeState extends ConsumerState
),
),
),
- primaryColor: CFColors.stackAccent,
- primarySwatch: CFColors.createMaterialColor(CFColors.stackAccent),
+ primaryColor: StackTheme.instance.color.accentColorDark,
+ primarySwatch:
+ Util.createMaterialColor(StackTheme.instance.color.accentColorDark),
checkboxTheme: CheckboxThemeData(
splashRadius: 0,
shape: RoundedRectangleBorder(
@@ -540,28 +572,28 @@ class _MaterialAppWithThemeState extends ConsumerState
checkColor: MaterialStateColor.resolveWith(
(state) {
if (state.contains(MaterialState.selected)) {
- return CFColors.white;
+ return StackTheme.instance.color.checkboxIconChecked;
}
- return CFColors.link2;
+ return StackTheme.instance.color.checkboxBGChecked;
},
),
fillColor: MaterialStateColor.resolveWith(
(states) {
if (states.contains(MaterialState.selected)) {
- return CFColors.link2;
+ return StackTheme.instance.color.checkboxBGChecked;
}
- return CFColors.disabledButton;
+ return StackTheme.instance.color.checkboxBorderEmpty;
},
),
),
- appBarTheme: const AppBarTheme(
+ appBarTheme: AppBarTheme(
centerTitle: false,
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
elevation: 0,
),
inputDecorationTheme: InputDecorationTheme(
- focusColor: CFColors.fieldGray,
- fillColor: CFColors.fieldGray,
+ focusColor: StackTheme.instance.color.textFieldDefaultBG,
+ fillColor: StackTheme.instance.color.textFieldDefaultBG,
filled: true,
contentPadding: const EdgeInsets.symmetric(
vertical: 6,
@@ -569,11 +601,16 @@ class _MaterialAppWithThemeState extends ConsumerState
),
labelStyle: STextStyles.fieldLabel,
hintStyle: STextStyles.fieldLabel,
- enabledBorder: _buildOutlineInputBorder(CFColors.fieldGray),
- focusedBorder: _buildOutlineInputBorder(CFColors.fieldGray),
- errorBorder: _buildOutlineInputBorder(CFColors.fieldGray),
- disabledBorder: _buildOutlineInputBorder(CFColors.fieldGray),
- focusedErrorBorder: _buildOutlineInputBorder(CFColors.fieldGray),
+ enabledBorder: _buildOutlineInputBorder(
+ StackTheme.instance.color.textFieldDefaultBG),
+ focusedBorder: _buildOutlineInputBorder(
+ StackTheme.instance.color.textFieldDefaultBG),
+ errorBorder: _buildOutlineInputBorder(
+ StackTheme.instance.color.textFieldDefaultBG),
+ disabledBorder: _buildOutlineInputBorder(
+ StackTheme.instance.color.textFieldDefaultBG),
+ focusedErrorBorder: _buildOutlineInputBorder(
+ StackTheme.instance.color.textFieldDefaultBG),
),
),
home: FutureBuilder(
@@ -595,6 +632,14 @@ class _MaterialAppWithThemeState extends ConsumerState
ref.read(prefsChangeNotifierProvider).startupWalletId;
}
+ // TODO proper desktop auth view
+ if (Util.isDesktop) {
+ Future.delayed(Duration.zero).then((value) =>
+ Navigator.of(context).pushNamedAndRemoveUntil(
+ DesktopHomeView.routeName, (route) => false));
+ return Container();
+ }
+
return LockscreenView(
isInitialAppLogin: true,
routeOnSuccess: HomeView.routeName,
diff --git a/lib/notifications/notification_card.dart b/lib/notifications/notification_card.dart
index 2047169db..4c1bdf91c 100644
--- a/lib/notifications/notification_card.dart
+++ b/lib/notifications/notification_card.dart
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/notification_model.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -42,7 +42,7 @@ class NotificationCard extends StatelessWidget {
),
child: SvgPicture.asset(
notification.iconAssetName,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
width: 24,
height: 24,
),
@@ -83,7 +83,7 @@ class NotificationCard extends StatelessWidget {
if (notification.read)
Positioned.fill(
child: RoundedContainer(
- color: CFColors.almostWhite.withOpacity(0.5),
+ color: StackTheme.instance.color.background.withOpacity(0.5),
),
),
],
diff --git a/lib/notifications/show_flush_bar.dart b/lib/notifications/show_flush_bar.dart
index b250302bd..569cf8ea9 100644
--- a/lib/notifications/show_flush_bar.dart
+++ b/lib/notifications/show_flush_bar.dart
@@ -2,9 +2,9 @@ import 'package:another_flushbar/flushbar.dart';
import 'package:another_flushbar/flushbar_route.dart' as flushRoute;
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
Future showFloatingFlushBar({
required FlushBarType type,
@@ -19,16 +19,16 @@ Future showFloatingFlushBar({
Color fg;
switch (type) {
case FlushBarType.success:
- fg = CFColors.notificationGreenForeground;
- bg = CFColors.notificationGreenBackground;
+ fg = StackTheme.instance.color.snackBarTextSuccess;
+ bg = StackTheme.instance.color.snackBarBackSuccess;
break;
case FlushBarType.info:
- fg = CFColors.notificationBlueForeground;
- bg = CFColors.notificationBlueBackground;
+ fg = StackTheme.instance.color.snackBarTextInfo;
+ bg = StackTheme.instance.color.snackBarBackInfo;
break;
case FlushBarType.warning:
- fg = CFColors.notificationRedForeground;
- bg = CFColors.notificationRedBackground;
+ fg = StackTheme.instance.color.snackBarTextError;
+ bg = StackTheme.instance.color.snackBarBackError;
break;
}
final bar = Flushbar(
@@ -53,6 +53,7 @@ Future showFloatingFlushBar({
Constants.size.circularBorderRadius,
),
margin: const EdgeInsets.all(20),
+ maxWidth: 550,
);
final _route = flushRoute.showFlushbar(
diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart
index 45180c842..ac8eae5eb 100644
--- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart
+++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart
@@ -1,85 +1,220 @@
import 'package:flutter/material.dart';
-import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_text.dart';
+import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart';
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart';
-import 'package:stackwallet/providers/global/prefs_provider.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart';
+import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/exit_to_my_stack_button.dart';
+import 'package:stackwallet/utilities/assets.dart';
+import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.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';
+import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
+import 'package:stackwallet/widgets/rounded_white_container.dart';
+import 'package:stackwallet/widgets/stack_text_field.dart';
+import 'package:stackwallet/widgets/textfield_icon_button.dart';
-class AddWalletView extends StatelessWidget {
+class AddWalletView extends StatefulWidget {
const AddWalletView({Key? key}) : super(key: key);
static const routeName = "/addWallet";
@override
- Widget build(BuildContext context) {
- List coins = [...Coin.values];
- coins.remove(Coin.firoTestNet);
- return Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () {
- Navigator.of(context).pop();
- },
- ),
- ),
- body: Container(
- color: CFColors.almostWhite,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Text(
- "Add wallet",
- textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
- ),
- const SizedBox(
- height: 16,
- ),
- Text(
- "Select wallet currency",
- textAlign: TextAlign.center,
- style: STextStyles.subtitle,
- ),
- const SizedBox(
- height: 16,
- ),
- Expanded(
- child: Consumer(
- builder: (_, ref, __) {
- bool showTestNet = ref.watch(
- prefsChangeNotifierProvider
- .select((value) => value.showTestNetCoins),
- );
+ State createState() => _AddWalletViewState();
+}
- return ListView.builder(
- itemCount: showTestNet
- ? coins.length
- : coins.length - (kTestNetCoinCount),
- itemBuilder: (ctx, index) {
- return Padding(
- padding: const EdgeInsets.all(4),
- child: CoinSelectItem(
- coin: coins[index],
+class _AddWalletViewState extends State {
+ late final TextEditingController _searchFieldController;
+ late final FocusNode _searchFocusNode;
+
+ String _searchTerm = "";
+
+ final List coins = [...Coin.values];
+
+ @override
+ void initState() {
+ _searchFieldController = TextEditingController();
+ _searchFocusNode = FocusNode();
+ coins.remove(Coin.firoTestNet);
+ super.initState();
+ }
+
+ @override
+ void dispose() {
+ _searchFieldController.dispose();
+ _searchFocusNode.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ debugPrint("BUILD: $runtimeType");
+
+ if (Util.isDesktop) {
+ return DesktopScaffold(
+ appBar: const DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(),
+ trailing: ExitToMyStackButton(),
+ ),
+ body: Column(
+ children: [
+ const AddWalletText(
+ isDesktop: true,
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ Expanded(
+ child: SizedBox(
+ width: 480,
+ child: RoundedWhiteContainer(
+ radiusMultiplier: 2,
+ padding: const EdgeInsets.only(
+ left: 16,
+ top: 16,
+ right: 16,
+ bottom: 0,
+ ),
+ child: Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(4.0),
+ child: ClipRRect(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
),
- );
- },
- );
- },
+ child: TextField(
+ controller: _searchFieldController,
+ focusNode: _searchFocusNode,
+ onChanged: (value) {
+ setState(() {
+ _searchTerm = value;
+ });
+ },
+ style: STextStyles.desktopTextMedium.copyWith(
+ height: 2,
+ ),
+ decoration: standardInputDecoration(
+ "Search",
+ _searchFocusNode,
+ ).copyWith(
+ contentPadding: const EdgeInsets.symmetric(
+ vertical: 10,
+ ),
+ prefixIcon: Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ // vertical: 20,
+ ),
+ child: SvgPicture.asset(
+ Assets.svg.search,
+ width: 24,
+ height: 24,
+ color: StackTheme.instance.color
+ .textFieldDefaultSearchIconLeft,
+ ),
+ ),
+ suffixIcon: _searchFieldController.text.isNotEmpty
+ ? Padding(
+ padding: const EdgeInsets.only(right: 10),
+ child: UnconstrainedBox(
+ child: Row(
+ children: [
+ TextFieldIconButton(
+ child: const XIcon(
+ width: 24,
+ height: 24,
+ ),
+ onTap: () async {
+ setState(() {
+ _searchFieldController.text =
+ "";
+ _searchTerm = "";
+ });
+ },
+ ),
+ ],
+ ),
+ ),
+ )
+ : null,
+ ),
+ ),
+ ),
+ ),
+ Expanded(
+ child: SearchableCoinList(
+ coins: coins,
+ isDesktop: true,
+ searchTerm: _searchTerm,
+ ),
+ ),
+ ],
+ ),
),
),
- const SizedBox(
- height: 16,
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ const SizedBox(
+ height: 70,
+ width: 480,
+ child: AddWalletNextButton(
+ isDesktop: true,
),
- const AddWalletNextButton(),
- ],
+ ),
+ const SizedBox(
+ height: 32,
+ ),
+ ],
+ ),
+ );
+ } else {
+ return Scaffold(
+ appBar: AppBar(
+ leading: AppBarBackButton(
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
),
),
- ),
- );
+ body: Container(
+ color: StackTheme.instance.color.background,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ const AddWalletText(
+ isDesktop: false,
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ Expanded(
+ child: MobileCoinList(
+ coins: coins,
+ isDesktop: false,
+ ),
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ const AddWalletNextButton(
+ isDesktop: false,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
}
}
diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_text.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_text.dart
new file mode 100644
index 000000000..fb9f74135
--- /dev/null
+++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_text.dart
@@ -0,0 +1,31 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+
+class AddWalletText extends StatelessWidget {
+ const AddWalletText({Key? key, required this.isDesktop}) : super(key: key);
+
+ final bool isDesktop;
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Text(
+ "Add wallet",
+ textAlign: TextAlign.center,
+ style: isDesktop ? STextStyles.desktopH2 : STextStyles.pageTitleH1,
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ Text(
+ "Select wallet currency",
+ textAlign: TextAlign.center,
+ style:
+ isDesktop ? STextStyles.desktopSubtitleH2 : STextStyles.subtitle,
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart
index 8ab1a4ffe..0f9e8bf0a 100644
--- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart
+++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart
@@ -3,10 +3,11 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.dart';
class CoinSelectItem extends ConsumerWidget {
const CoinSelectItem({
@@ -20,40 +21,69 @@ class CoinSelectItem extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
debugPrint("BUILD: CoinSelectItem for ${coin.name}");
final selectedCoin = ref.watch(addWalletSelectedCoinStateProvider);
+
+ final isDesktop = Util.isDesktop;
+
return Container(
decoration: BoxDecoration(
// color: selectedCoin == coin ? CFColors.selection : CFColors.white,
- color: selectedCoin == coin ? CFColors.selected2 : CFColors.white,
+ color: selectedCoin == coin
+ ? StackTheme.instance.color.textFieldActiveBG
+ : StackTheme.instance.color.popupBG,
borderRadius:
BorderRadius.circular(Constants.size.circularBorderRadius),
),
child: MaterialButton(
- // splashColor: CFColors.splashLight,
+ // splashColor: StackTheme.instance.color.highlight,
key: Key("coinSelectItemButtonKey_${coin.name}"),
- padding: const EdgeInsets.all(12),
+ padding: isDesktop
+ ? const EdgeInsets.only(left: 24)
+ : const EdgeInsets.all(12),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(Constants.size.circularBorderRadius),
),
- child: Row(
- children: [
- SvgPicture.asset(
- Assets.svg.iconFor(coin: coin),
- width: 26,
- height: 26,
- ),
- const SizedBox(
- width: 10,
- ),
- Text(
- coin.prettyName,
- style: STextStyles.subtitle.copyWith(
- fontWeight: FontWeight.w600,
- fontSize: 14,
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ ),
+ child: Row(
+ children: [
+ SvgPicture.asset(
+ Assets.svg.iconFor(coin: coin),
+ width: 26,
+ height: 26,
),
- ),
- ],
+ SizedBox(
+ width: isDesktop ? 12 : 10,
+ ),
+ Text(
+ coin.prettyName,
+ style: isDesktop
+ ? STextStyles.desktopTextMedium
+ : STextStyles.subtitle.copyWith(
+ fontWeight: FontWeight.w600,
+ fontSize: 14,
+ ),
+ ),
+ if (isDesktop && selectedCoin == coin) const Spacer(),
+ if (isDesktop && selectedCoin == coin)
+ Padding(
+ padding: const EdgeInsets.only(
+ right: 18,
+ ),
+ child: SizedBox(
+ width: 24,
+ height: 24,
+ child: SvgPicture.asset(
+ Assets.svg.check,
+ color: StackTheme.instance.color.accentColorDark,
+ ),
+ ),
+ ),
+ ],
+ ),
),
onPressed: () =>
ref.read(addWalletSelectedCoinStateProvider.state).state = coin,
diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart
new file mode 100644
index 000000000..1f36f3b65
--- /dev/null
+++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart
@@ -0,0 +1,40 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart';
+import 'package:stackwallet/providers/global/prefs_provider.dart';
+import 'package:stackwallet/utilities/enums/coin_enum.dart';
+
+class MobileCoinList extends StatelessWidget {
+ const MobileCoinList({
+ Key? key,
+ required this.coins,
+ required this.isDesktop,
+ }) : super(key: key);
+
+ final List coins;
+ final bool isDesktop;
+
+ @override
+ Widget build(BuildContext context) {
+ return Consumer(
+ builder: (_, ref, __) {
+ bool showTestNet = ref.watch(
+ prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
+ );
+
+ return ListView.builder(
+ itemCount:
+ showTestNet ? coins.length : coins.length - (kTestNetCoinCount),
+ itemBuilder: (ctx, index) {
+ return Padding(
+ padding: const EdgeInsets.all(4),
+ child: CoinSelectItem(
+ coin: coins[index],
+ ),
+ );
+ },
+ );
+ },
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart
index 61a0ef7b1..7f79c2da4 100644
--- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart
+++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart
@@ -2,19 +2,27 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart';
import 'package:stackwallet/providers/providers.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
class AddWalletNextButton extends ConsumerWidget {
- const AddWalletNextButton({Key? key}) : super(key: key);
+ const AddWalletNextButton({
+ Key? key,
+ required this.isDesktop,
+ }) : super(key: key);
+
+ final bool isDesktop;
@override
Widget build(BuildContext context, WidgetRef ref) {
debugPrint("BUILD: NextButton");
final selectedCoin =
ref.watch(addWalletSelectedCoinStateProvider.state).state;
+
+ final enabled = selectedCoin != null;
+
return TextButton(
- onPressed: selectedCoin == null
+ onPressed: !enabled
? null
: () {
final selectedCoin =
@@ -25,22 +33,16 @@ class AddWalletNextButton extends ConsumerWidget {
arguments: selectedCoin,
);
},
- style: selectedCoin == null
- ? Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent.withOpacity(
- 0.25,
- ),
- ),
- )
- : Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: enabled
+ ? StackTheme.instance.getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance.getPrimaryDisabledButtonColor(context),
child: Text(
"Next",
- style: STextStyles.button,
+ style: isDesktop
+ ? enabled
+ ? STextStyles.desktopButtonEnabled
+ : STextStyles.desktopButtonDisabled
+ : STextStyles.button,
),
);
}
diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart
new file mode 100644
index 000000000..fb443b915
--- /dev/null
+++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart
@@ -0,0 +1,57 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart';
+import 'package:stackwallet/providers/global/prefs_provider.dart';
+import 'package:stackwallet/utilities/enums/coin_enum.dart';
+
+class SearchableCoinList extends ConsumerWidget {
+ const SearchableCoinList({
+ Key? key,
+ required this.coins,
+ required this.isDesktop,
+ required this.searchTerm,
+ }) : super(key: key);
+
+ final List coins;
+ final bool isDesktop;
+ final String searchTerm;
+
+ List filterCoins(String text, bool showTestNetCoins) {
+ final _coins = [...coins];
+ if (text.isNotEmpty) {
+ final lowercaseTerm = text.toLowerCase();
+ _coins.retainWhere((e) =>
+ e.ticker.toLowerCase().contains(lowercaseTerm) ||
+ e.prettyName.toLowerCase().contains(lowercaseTerm) ||
+ e.name.toLowerCase().contains(lowercaseTerm));
+ }
+ if (!showTestNetCoins) {
+ _coins.removeWhere((e) => e.name.endsWith("TestNet"));
+ }
+ // remove firo testnet regardless
+ _coins.remove(Coin.firoTestNet);
+
+ return _coins;
+ }
+
+ @override
+ Widget build(BuildContext context, WidgetRef ref) {
+ bool showTestNet = ref.watch(
+ prefsChangeNotifierProvider.select((value) => value.showTestNetCoins),
+ );
+
+ final _coins = filterCoins(searchTerm, showTestNet);
+
+ return ListView.builder(
+ itemCount: _coins.length,
+ itemBuilder: (ctx, index) {
+ return Padding(
+ padding: const EdgeInsets.all(4),
+ child: CoinSelectItem(
+ coin: _coins[index],
+ ),
+ );
+ },
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart
index 50c91a514..3a3919e44 100644
--- a/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart
+++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart
@@ -1,12 +1,15 @@
import 'package:flutter/material.dart';
-import 'package:stackwallet/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart';
-import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
-import 'package:stackwallet/utilities/enums/add_wallet_type_enum.dart';
+import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart';
+import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart';
+import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart';
+import 'package:stackwallet/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart';
+import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/exit_to_my_stack_button.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
-import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
-import 'package:tuple/tuple.dart';
+import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
+import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
class CreateOrRestoreWalletView extends StatelessWidget {
const CreateOrRestoreWalletView({
@@ -22,97 +25,100 @@ class CreateOrRestoreWalletView extends StatelessWidget {
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
- return Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () {
- Navigator.of(context).pop();
- },
+ final isDesktop = Util.isDesktop;
+
+ if (isDesktop) {
+ return DesktopScaffold(
+ appBar: const DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(),
+ trailing: ExitToMyStackButton(),
),
- ),
- body: Container(
- color: CFColors.almostWhite,
- child: Padding(
- padding: const EdgeInsets.all(16),
+ body: SizedBox(
+ width: 480,
child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Padding(
- padding: const EdgeInsets.all(31),
- child: Image(
- image: AssetImage(
- Assets.png.imageFor(coin: coin),
- ),
- width: MediaQuery.of(context).size.width / 3,
- ),
- ),
- const Spacer(
- flex: 2,
- ),
- Text(
- "Add ${coin.prettyName} wallet",
- textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
+ CreateRestoreWalletTitle(
+ coin: coin,
+ isDesktop: isDesktop,
),
const SizedBox(
- height: 8,
+ height: 16,
),
- Text(
- "Create a new wallet or restore an existing wallet from seed.",
- textAlign: TextAlign.center,
- style: STextStyles.subtitle),
- const Spacer(
- flex: 5,
- ),
- TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
- onPressed: () {
- Navigator.of(context).pushNamed(
- NameYourWalletView.routeName,
- arguments: Tuple2(
- AddWalletType.New,
- coin,
- ),
- );
- },
- child: Text(
- "Create new wallet",
- style: STextStyles.button,
+ SizedBox(
+ width: 324,
+ child: CreateRestoreWalletSubTitle(
+ isDesktop: isDesktop,
),
),
const SizedBox(
- height: 12,
+ height: 32,
),
- TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent.withOpacity(0.25),
- ),
- ),
- onPressed: () {
- Navigator.of(context).pushNamed(
- NameYourWalletView.routeName,
- arguments: Tuple2(
- AddWalletType.Restore,
- coin,
- ),
- );
- },
- child: Text(
- "Restore wallet",
- style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
- ),
- ),
+ CoinImage(
+ coin: coin,
+ isDesktop: isDesktop,
+ ),
+ const SizedBox(
+ height: 32,
+ ),
+ CreateWalletButtonGroup(
+ coin: coin,
+ isDesktop: isDesktop,
),
],
),
),
- ),
- );
+ );
+ } else {
+ return Scaffold(
+ appBar: AppBar(
+ leading: AppBarBackButton(
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
+ ),
+ ),
+ body: Container(
+ color: StackTheme.instance.color.background,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(31),
+ child: CoinImage(
+ coin: coin,
+ isDesktop: isDesktop,
+ ),
+ ),
+ const Spacer(
+ flex: 2,
+ ),
+ CreateRestoreWalletTitle(
+ coin: coin,
+ isDesktop: isDesktop,
+ ),
+ const SizedBox(
+ height: 8,
+ ),
+ CreateRestoreWalletSubTitle(
+ isDesktop: isDesktop,
+ ),
+ const Spacer(
+ flex: 5,
+ ),
+ CreateWalletButtonGroup(
+ coin: coin,
+ isDesktop: isDesktop,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
}
}
diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart
new file mode 100644
index 000000000..c96cc14ad
--- /dev/null
+++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart
@@ -0,0 +1,24 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/utilities/assets.dart';
+import 'package:stackwallet/utilities/enums/coin_enum.dart';
+
+class CoinImage extends StatelessWidget {
+ const CoinImage({
+ Key? key,
+ required this.coin,
+ required this.isDesktop,
+ }) : super(key: key);
+
+ final Coin coin;
+ final bool isDesktop;
+
+ @override
+ Widget build(BuildContext context) {
+ return Image(
+ image: AssetImage(
+ Assets.png.imageFor(coin: coin),
+ ),
+ width: isDesktop ? 324 : MediaQuery.of(context).size.width / 3,
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart
new file mode 100644
index 000000000..75e7cec0c
--- /dev/null
+++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart
@@ -0,0 +1,20 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+
+class CreateRestoreWalletSubTitle extends StatelessWidget {
+ const CreateRestoreWalletSubTitle({
+ Key? key,
+ required this.isDesktop,
+ }) : super(key: key);
+
+ final bool isDesktop;
+
+ @override
+ Widget build(BuildContext context) {
+ return Text(
+ "Create a new wallet or restore an existing wallet from seed.",
+ textAlign: TextAlign.center,
+ style: isDesktop ? STextStyles.desktopSubtitleH2 : STextStyles.subtitle,
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart
new file mode 100644
index 000000000..3769d08eb
--- /dev/null
+++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart
@@ -0,0 +1,23 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/utilities/enums/coin_enum.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+
+class CreateRestoreWalletTitle extends StatelessWidget {
+ const CreateRestoreWalletTitle({
+ Key? key,
+ required this.coin,
+ required this.isDesktop,
+ }) : super(key: key);
+
+ final Coin coin;
+ final bool isDesktop;
+
+ @override
+ Widget build(BuildContext context) {
+ return Text(
+ "Add ${coin.prettyName} wallet",
+ textAlign: TextAlign.center,
+ style: isDesktop ? STextStyles.desktopH2 : STextStyles.pageTitleH1,
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart
new file mode 100644
index 000000000..f8efe8166
--- /dev/null
+++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart
@@ -0,0 +1,80 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart';
+import 'package:stackwallet/utilities/enums/add_wallet_type_enum.dart';
+import 'package:stackwallet/utilities/enums/coin_enum.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:tuple/tuple.dart';
+
+class CreateWalletButtonGroup extends StatelessWidget {
+ const CreateWalletButtonGroup({
+ Key? key,
+ required this.coin,
+ required this.isDesktop,
+ }) : super(key: key);
+
+ final Coin coin;
+ final bool isDesktop;
+
+ @override
+ Widget build(BuildContext context) {
+ return Column(
+ crossAxisAlignment:
+ isDesktop ? CrossAxisAlignment.center : CrossAxisAlignment.stretch,
+ children: [
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ minWidth: isDesktop ? 480 : 0,
+ ),
+ child: TextButton(
+ style: StackTheme.instance.getPrimaryEnabledButtonColor(context),
+ onPressed: () {
+ Navigator.of(context).pushNamed(
+ NameYourWalletView.routeName,
+ arguments: Tuple2(
+ AddWalletType.New,
+ coin,
+ ),
+ );
+ },
+ child: Text(
+ "Create new wallet",
+ style: isDesktop
+ ? STextStyles.desktopButtonEnabled
+ : STextStyles.button,
+ ),
+ ),
+ ),
+ SizedBox(
+ height: isDesktop ? 16 : 12,
+ ),
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ minWidth: isDesktop ? 480 : 0,
+ ),
+ child: TextButton(
+ style: StackTheme.instance.getSecondaryEnabledButtonColor(context),
+ onPressed: () {
+ Navigator.of(context).pushNamed(
+ NameYourWalletView.routeName,
+ arguments: Tuple2(
+ AddWalletType.Restore,
+ coin,
+ ),
+ );
+ },
+ child: Text(
+ "Restore wallet",
+ style: isDesktop
+ ? STextStyles.desktopButtonSecondaryEnabled
+ : STextStyles.button.copyWith(
+ color: StackTheme.instance.color.accentColorDark),
+ ),
+ ),
+ ),
+ ],
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart
index 5338c8461..e170f2fde 100644
--- a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart
+++ b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart
@@ -1,19 +1,26 @@
+import 'dart:async';
+
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart';
-import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/exit_to_my_stack_button.dart';
import 'package:stackwallet/providers/global/wallets_service_provider.dart';
import 'package:stackwallet/providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/add_wallet_type_enum.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/name_generator.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.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';
import 'package:stackwallet/widgets/icon_widgets/dice_icon.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -21,14 +28,6 @@ import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart';
import 'package:tuple/tuple.dart';
-// TODO replace with real list and move out of this file
-const kWalletNameWordList = [
- "Bubby",
- "Baby",
- "Bobby",
- "Booby",
-];
-
class NameYourWalletView extends ConsumerStatefulWidget {
const NameYourWalletView({
Key? key,
@@ -59,6 +58,8 @@ class _NameYourWalletViewState extends ConsumerState {
Set namesToExclude = {};
late final NameGenerator generator;
+ late final bool isDesktop;
+
Future _generateRandomWalletName() async {
final name = generator.generate(namesToExclude: namesToExclude);
namesToExclude.add(name);
@@ -67,6 +68,8 @@ class _NameYourWalletViewState extends ConsumerState {
@override
void initState() {
+ isDesktop = Util.isDesktop;
+
ref.read(walletsServiceChangeNotifierProvider).walletNames.then(
(value) => namesToExclude.addAll(
value.values.map((e) => e.name),
@@ -92,231 +95,261 @@ class _NameYourWalletViewState extends ConsumerState {
Widget build(BuildContext context) {
debugPrint(
"BUILD: NameYourWalletView with ${coin.name} ${addWalletType.name}");
- return Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () {
- if (textFieldFocusNode.hasFocus) {
- textFieldFocusNode.unfocus();
- Future.delayed(const Duration(milliseconds: 100))
- .then((value) => Navigator.of(context).pop());
- } else {
- if (mounted) {
- Navigator.of(context).pop();
- }
- }
- },
+
+ if (isDesktop) {
+ return DesktopScaffold(
+ appBar: const DesktopAppBar(
+ leading: AppBarBackButton(),
+ trailing: ExitToMyStackButton(),
+ isCompactHeight: false,
),
- ),
- body: Container(
- color: CFColors.almostWhite,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: LayoutBuilder(
- builder: (ctx, constraints) {
- return SingleChildScrollView(
- child: ConstrainedBox(
- constraints: BoxConstraints(minHeight: constraints.maxHeight),
- child: IntrinsicHeight(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
+ body: SizedBox(
+ width: 480,
+ child: _content(),
+ ),
+ );
+ } else {
+ return Scaffold(
+ appBar: AppBar(
+ leading: AppBarBackButton(
+ onPressed: () {
+ if (textFieldFocusNode.hasFocus) {
+ textFieldFocusNode.unfocus();
+ Future.delayed(const Duration(milliseconds: 100))
+ .then((value) => Navigator.of(context).pop());
+ } else {
+ if (mounted) {
+ Navigator.of(context).pop();
+ }
+ }
+ },
+ ),
+ ),
+ body: Container(
+ color: StackTheme.instance.color.background,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: LayoutBuilder(
+ builder: (ctx, constraints) {
+ return SingleChildScrollView(
+ child: ConstrainedBox(
+ constraints:
+ BoxConstraints(minHeight: constraints.maxHeight),
+ child: IntrinsicHeight(
+ child: _content(),
+ ),
+ ),
+ );
+ },
+ ),
+ ),
+ ),
+ );
+ }
+ }
+
+ Widget _content() => Column(
+ crossAxisAlignment:
+ isDesktop ? CrossAxisAlignment.center : CrossAxisAlignment.stretch,
+ children: [
+ if (!isDesktop)
+ const Spacer(
+ flex: 1,
+ ),
+ if (!isDesktop)
+ Image(
+ image: AssetImage(
+ Assets.png.imageFor(coin: coin),
+ ),
+ height: 100,
+ ),
+ SizedBox(
+ height: isDesktop ? 24 : 16,
+ ),
+ Text(
+ "Name your ${coin.prettyName} wallet",
+ textAlign: TextAlign.center,
+ style: isDesktop ? STextStyles.desktopH2 : STextStyles.pageTitleH1,
+ ),
+ SizedBox(
+ height: isDesktop ? 16 : 8,
+ ),
+ Text(
+ "Enter a label for your wallet (e.g. Savings)",
+ textAlign: TextAlign.center,
+ style: isDesktop
+ ? STextStyles.desktopSubtitleH2
+ : STextStyles.subtitle,
+ ),
+ SizedBox(
+ height: isDesktop ? 40 : 16,
+ ),
+ ClipRRect(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ child: TextField(
+ onChanged: (string) {
+ if (string.isEmpty) {
+ if (_nextEnabled) {
+ setState(() {
+ _nextEnabled = false;
+ _showDiceIcon = true;
+ });
+ }
+ } else {
+ if (!_nextEnabled) {
+ setState(() {
+ _nextEnabled = true;
+ _showDiceIcon = false;
+ });
+ }
+ }
+ },
+ focusNode: textFieldFocusNode,
+ controller: textEditingController,
+ style: isDesktop
+ ? STextStyles.desktopTextMedium.copyWith(
+ height: 2,
+ )
+ : STextStyles.field,
+ decoration: standardInputDecoration(
+ "Enter wallet name",
+ textFieldFocusNode,
+ ).copyWith(
+ suffixIcon: Padding(
+ padding: EdgeInsets.only(right: isDesktop ? 6 : 0),
+ child: UnconstrainedBox(
+ child: Row(
children: [
- const Spacer(
- flex: 1,
- ),
- Image(
- image: AssetImage(
- Assets.png.imageFor(coin: coin),
- ),
- height: 100,
- ),
- const SizedBox(
- height: 16,
- ),
- Text(
- "Name your ${coin.prettyName} wallet",
- textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
- ),
- const SizedBox(
- height: 8,
- ),
- Text(
- "Enter a label for your wallet (e.g. Savings)",
- textAlign: TextAlign.center,
- style: STextStyles.subtitle,
- ),
- const SizedBox(
- height: 16,
- ),
- ClipRRect(
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius,
- ),
- child: TextField(
- onChanged: (string) {
- if (string.isEmpty) {
- if (_nextEnabled) {
- setState(() {
- _nextEnabled = false;
- _showDiceIcon = true;
- });
- }
- } else {
- if (!_nextEnabled) {
- setState(() {
- _nextEnabled = true;
- _showDiceIcon = false;
- });
- }
- }
- },
- focusNode: textFieldFocusNode,
- controller: textEditingController,
- style: STextStyles.field,
- decoration: standardInputDecoration(
- "Enter wallet name",
- textFieldFocusNode,
- ).copyWith(
- suffixIcon: Padding(
- padding: const EdgeInsets.only(right: 0),
- child: UnconstrainedBox(
- child: Row(
- children: [
- TextFieldIconButton(
- key: const Key(
- "genRandomWalletNameButtonKey"),
- child: _showDiceIcon
- ? const DiceIcon()
- : const XIcon(),
- onTap: () async {
- if (_showDiceIcon) {
- textEditingController.text =
- await _generateRandomWalletName();
- setState(() {
- _nextEnabled = true;
- _showDiceIcon = false;
- });
- } else {
- textEditingController.text = "";
- setState(() {
- _nextEnabled = false;
- _showDiceIcon = true;
- });
- }
- },
- )
- ],
- ),
+ TextFieldIconButton(
+ key: const Key("genRandomWalletNameButtonKey"),
+ child: _showDiceIcon
+ ? DiceIcon(
+ width: isDesktop ? 20 : 17,
+ height: isDesktop ? 20 : 17,
+ )
+ : XIcon(
+ width: isDesktop ? 21 : 18,
+ height: isDesktop ? 21 : 18,
),
- ),
- ),
- ),
- ),
- const SizedBox(
- height: 8,
- ),
- RoundedWhiteContainer(
- child: Center(
- child: Text(
- "Roll the dice to pick a random name.",
- style: STextStyles.itemSubtitle,
- ),
- ),
- ),
- const Spacer(
- flex: 4,
- ),
- TextButton(
- onPressed: _nextEnabled
- ? () async {
- final walletsService = ref.read(
- walletsServiceChangeNotifierProvider);
- final name = textEditingController.text;
-
- if (await walletsService
- .checkForDuplicate(name)) {
- showFloatingFlushBar(
- type: FlushBarType.warning,
- message: "Wallet name already in use.",
- iconAsset: Assets.svg.circleAlert,
- context: context,
- );
- } else {
- // hide keyboard if has focus
- if (FocusScope.of(context).hasFocus) {
- FocusScope.of(context).unfocus();
- await Future.delayed(
- const Duration(milliseconds: 50));
- }
-
- if (mounted) {
- switch (widget.addWalletType) {
- case AddWalletType.New:
- Navigator.of(context).pushNamed(
- NewWalletRecoveryPhraseWarningView
- .routeName,
- arguments: Tuple2(
- name,
- coin,
- ),
- );
- break;
- case AddWalletType.Restore:
- ref
- .read(
- mnemonicWordCountStateProvider
- .state)
- .state = Constants
- .possibleLengthsForCoin(coin)
- .first;
- Navigator.of(context).pushNamed(
- RestoreOptionsView.routeName,
- arguments: Tuple2(
- name,
- coin,
- ),
- );
- break;
- }
- }
- }
- }
- : null,
- style: _nextEnabled
- ? Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ))
- : Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent.withOpacity(
- 0.25,
- ),
- ),
- ),
- child: Text(
- "Next",
- style: STextStyles.button,
- ),
- ),
+ onTap: () async {
+ if (_showDiceIcon) {
+ textEditingController.text =
+ await _generateRandomWalletName();
+ setState(() {
+ _nextEnabled = true;
+ _showDiceIcon = false;
+ });
+ } else {
+ textEditingController.text = "";
+ setState(() {
+ _nextEnabled = false;
+ _showDiceIcon = true;
+ });
+ }
+ },
+ )
],
),
),
),
- );
- },
+ ),
+ ),
),
- ),
- ),
- );
- }
+ SizedBox(
+ height: isDesktop ? 16 : 8,
+ ),
+ RoundedWhiteContainer(
+ child: Center(
+ child: Text(
+ "Roll the dice to pick a random name.",
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textSubtitle1,
+ )
+ : STextStyles.itemSubtitle,
+ ),
+ ),
+ ),
+ if (!isDesktop)
+ const Spacer(
+ flex: 4,
+ ),
+ if (isDesktop)
+ const SizedBox(
+ height: 32,
+ ),
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ minWidth: isDesktop ? 480 : 0,
+ minHeight: isDesktop ? 70 : 0,
+ ),
+ child: TextButton(
+ onPressed: _nextEnabled
+ ? () async {
+ final walletsService =
+ ref.read(walletsServiceChangeNotifierProvider);
+ final name = textEditingController.text;
+
+ if (await walletsService.checkForDuplicate(name)) {
+ unawaited(showFloatingFlushBar(
+ type: FlushBarType.warning,
+ message: "Wallet name already in use.",
+ iconAsset: Assets.svg.circleAlert,
+ context: context,
+ ));
+ } else {
+ // hide keyboard if has focus
+ if (FocusScope.of(context).hasFocus) {
+ FocusScope.of(context).unfocus();
+ await Future.delayed(
+ const Duration(milliseconds: 50));
+ }
+
+ if (mounted) {
+ switch (widget.addWalletType) {
+ case AddWalletType.New:
+ unawaited(Navigator.of(context).pushNamed(
+ NewWalletRecoveryPhraseWarningView.routeName,
+ arguments: Tuple2(
+ name,
+ coin,
+ ),
+ ));
+ break;
+ case AddWalletType.Restore:
+ ref
+ .read(mnemonicWordCountStateProvider.state)
+ .state = Constants.possibleLengthsForCoin(
+ coin)
+ .first;
+ unawaited(Navigator.of(context).pushNamed(
+ RestoreOptionsView.routeName,
+ arguments: Tuple2(
+ name,
+ coin,
+ ),
+ ));
+ break;
+ }
+ }
+ }
+ }
+ : null,
+ style: _nextEnabled
+ ? StackTheme.instance.getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance.getPrimaryDisabledButtonColor(context),
+ child: Text(
+ "Next",
+ style: isDesktop
+ ? _nextEnabled
+ ? STextStyles.desktopButtonEnabled
+ : STextStyles.desktopButtonDisabled
+ : STextStyles.button,
+ ),
+ ),
+ ),
+ ],
+ );
}
diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart
index 7f12e8b6d..aefade548 100644
--- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart
+++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart
@@ -1,3 +1,4 @@
+import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
@@ -8,15 +9,21 @@ 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/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart';
import 'package:stackwallet/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/desktop_home_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/exit_to_my_stack_button.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.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';
import 'package:tuple/tuple.dart';
class NewWalletRecoveryPhraseView extends ConsumerStatefulWidget {
@@ -46,12 +53,14 @@ class _NewWalletRecoveryPhraseViewState
late Manager _manager;
late List _mnemonic;
late ClipboardInterface _clipboardInterface;
+ late final bool isDesktop;
@override
void initState() {
_manager = widget.manager;
_mnemonic = widget.mnemonic;
_clipboardInterface = widget.clipboardInterface;
+ isDesktop = Util.isDesktop;
super.initState();
}
@@ -67,144 +76,230 @@ class _NewWalletRecoveryPhraseViewState
await _manager.exitCurrentWallet();
}
+ Future _copy() async {
+ final words = await _manager.mnemonic;
+ await _clipboardInterface.setData(ClipboardData(text: words.join(" ")));
+ unawaited(showFloatingFlushBar(
+ type: FlushBarType.info,
+ message: "Copied to clipboard",
+ iconAsset: Assets.svg.copy,
+ context: context,
+ ));
+ }
+
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
return WillPopScope(
- onWillPop: onWillPop,
- child: Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () async {
- await delete();
+ onWillPop: onWillPop,
+ child: MasterScaffold(
+ isDesktop: isDesktop,
+ appBar: isDesktop
+ ? DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(
+ onPressed: () async {
+ await delete();
- if (mounted) {
- Navigator.of(context).popUntil(
- ModalRoute.withName(
- NewWalletRecoveryPhraseWarningView.routeName,
+ if (mounted) {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(
+ NewWalletRecoveryPhraseWarningView.routeName,
+ ),
+ );
+ }
+ // Navigator.of(context).pop();
+ },
),
- );
- }
- // Navigator.of(context).pop();
- },
- ),
- actions: [
- Padding(
- padding: const EdgeInsets.all(10),
- child: AspectRatio(
- aspectRatio: 1,
- child: AppBarIconButton(
- color: CFColors.almostWhite,
- shadows: const [],
- icon: SvgPicture.asset(
- Assets.svg.copy,
- width: 24,
- height: 24,
+ trailing: ExitToMyStackButton(
+ onPressed: () async {
+ await delete();
+ if (mounted) {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(DesktopHomeView.routeName),
+ );
+ }
+ },
),
- onPressed: () async {
- final words = await _manager.mnemonic;
- await _clipboardInterface
- .setData(ClipboardData(text: words.join(" ")));
- showFloatingFlushBar(
- type: FlushBarType.info,
- message: "Copied to clipboard",
- iconAsset: Assets.svg.copy,
- context: context,
- );
- },
- ),
- ),
- ),
- ],
- ),
- body: Container(
- color: CFColors.almostWhite,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- const SizedBox(
- height: 4,
- ),
- Text(
- _manager.walletName,
- textAlign: TextAlign.center,
- style: STextStyles.label.copyWith(
- fontSize: 12,
- ),
- ),
- const SizedBox(
- height: 4,
- ),
- Text(
- "Recovery Phrase",
- textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
- ),
- const SizedBox(
- height: 16,
- ),
- Container(
- decoration: BoxDecoration(
- color: CFColors.white,
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius),
- ),
- child: Padding(
- padding: const EdgeInsets.all(12),
- child: Text(
- "Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
- style: STextStyles.label.copyWith(
- color: CFColors.stackAccent,
- ),
- ),
- ),
- ),
- const SizedBox(
- height: 8,
- ),
- Expanded(
- child: SingleChildScrollView(
- child: MnemonicTable(
- words: _mnemonic,
- ),
- ),
- ),
- const SizedBox(
- height: 16,
- ),
- TextButton(
- onPressed: () async {
- final int next = Random().nextInt(_mnemonic.length);
- ref
- .read(verifyMnemonicWordIndexStateProvider.state)
- .update((state) => next);
+ )
+ : AppBar(
+ leading: AppBarBackButton(
+ onPressed: () async {
+ await delete();
- ref
- .read(verifyMnemonicCorrectWordStateProvider.state)
- .update((state) => _mnemonic[next]);
-
- Navigator.of(context).pushNamed(
- VerifyRecoveryPhraseView.routeName,
- arguments: Tuple2(_manager, _mnemonic),
- );
- },
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent,
+ if (mounted) {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(
+ NewWalletRecoveryPhraseWarningView.routeName,
+ ),
+ );
+ }
+ },
+ ),
+ actions: [
+ Padding(
+ padding: const EdgeInsets.all(10),
+ child: AspectRatio(
+ aspectRatio: 1,
+ child: AppBarIconButton(
+ color: StackTheme.instance.color.background,
+ shadows: const [],
+ icon: SvgPicture.asset(
+ Assets.svg.copy,
+ width: 24,
+ height: 24,
+ color: StackTheme.instance.color.topNavIconPrimary,
+ ),
+ onPressed: () async {
+ await _copy();
+ },
),
),
- child: Text(
- "I saved my recovery phrase",
- style: STextStyles.button,
- ),
+ ),
+ ],
),
- ],
+ body: Container(
+ color: StackTheme.instance.color.background,
+ width: isDesktop ? 600 : null,
+ child: Padding(
+ padding: isDesktop
+ ? const EdgeInsets.all(0)
+ : const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (!isDesktop)
+ const SizedBox(
+ height: 4,
+ ),
+ if (!isDesktop)
+ Text(
+ _manager.walletName,
+ textAlign: TextAlign.center,
+ style: STextStyles.label.copyWith(
+ fontSize: 12,
+ ),
+ ),
+ SizedBox(
+ height: isDesktop ? 24 : 4,
+ ),
+ Text(
+ "Recovery Phrase",
+ textAlign: TextAlign.center,
+ style: isDesktop
+ ? STextStyles.desktopH2
+ : STextStyles.pageTitleH1,
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ Container(
+ decoration: BoxDecoration(
+ color: isDesktop
+ ? StackTheme.instance.color.background
+ : StackTheme.instance.color.popupBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius),
+ ),
+ child: Padding(
+ padding: isDesktop
+ ? const EdgeInsets.all(0)
+ : const EdgeInsets.all(12),
+ child: Text(
+ "Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
+ textAlign: TextAlign.center,
+ style: isDesktop
+ ? STextStyles.desktopSubtitleH2
+ : STextStyles.label.copyWith(
+ color:
+ StackTheme.instance.color.accentColorDark),
+ ),
+ ),
+ ),
+ SizedBox(
+ height: isDesktop ? 21 : 8,
+ ),
+ if (!isDesktop)
+ Expanded(
+ child: SingleChildScrollView(
+ child: MnemonicTable(
+ words: _mnemonic,
+ isDesktop: isDesktop,
+ ),
+ ),
+ ),
+ if (isDesktop)
+ MnemonicTable(
+ words: _mnemonic,
+ isDesktop: isDesktop,
+ ),
+ SizedBox(
+ height: isDesktop ? 24 : 16,
+ ),
+ if (isDesktop)
+ SizedBox(
+ height: 70,
+ child: TextButton(
+ onPressed: () async {
+ await _copy();
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ SvgPicture.asset(
+ Assets.svg.copy,
+ width: 20,
+ height: 20,
+ ),
+ const SizedBox(
+ width: 10,
+ ),
+ Text(
+ "Copy to clipboard",
+ style: STextStyles.desktopButtonSecondaryEnabled,
+ )
+ ],
+ ),
+ ),
+ ),
+ if (isDesktop)
+ const SizedBox(
+ height: 16,
+ ),
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ ),
+ child: TextButton(
+ onPressed: () async {
+ final int next = Random().nextInt(_mnemonic.length);
+ ref
+ .read(verifyMnemonicWordIndexStateProvider.state)
+ .update((state) => next);
+
+ ref
+ .read(verifyMnemonicCorrectWordStateProvider.state)
+ .update((state) => _mnemonic[next]);
+
+ unawaited(Navigator.of(context).pushNamed(
+ VerifyRecoveryPhraseView.routeName,
+ arguments: Tuple2(_manager, _mnemonic),
+ ));
+ },
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
+ child: Text(
+ "I saved my recovery phrase",
+ style: isDesktop
+ ? STextStyles.desktopButtonEnabled
+ : STextStyles.button,
+ ),
+ ),
+ ),
+ ],
+ ),
),
),
- ),
- ),
- );
+ ));
}
}
diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart
index 9b33f5248..946f54d4a 100644
--- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart
+++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart
@@ -1,19 +1,20 @@
-import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart';
class MnemonicTable extends StatelessWidget {
const MnemonicTable({
Key? key,
required this.words,
+ required this.isDesktop,
}) : super(key: key);
final List words;
-
- static const wordsPerRow = 3;
+ final bool isDesktop;
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
+ final wordsPerRow = isDesktop ? 4 : 3;
final int rows = words.length ~/ wordsPerRow;
@@ -26,51 +27,54 @@ class MnemonicTable extends StatelessWidget {
children: [
for (int i = 1; i <= rows; i++)
Padding(
- padding: const EdgeInsets.symmetric(vertical: 5),
+ padding: EdgeInsets.symmetric(vertical: isDesktop ? 8 : 5),
child: Row(
children: [
for (int j = 1; j <= wordsPerRow; j++) ...[
if (j > 1)
- const SizedBox(
- width: 6,
+ SizedBox(
+ width: isDesktop ? 10 : 6,
),
Expanded(
child: MnemonicTableItem(
number: ++index,
word: words[index - 1],
+ isDesktop: isDesktop,
),
),
],
],
),
),
- Padding(
- padding: const EdgeInsets.symmetric(vertical: 5),
- child: Row(
- children: [
- for (int i = index; i < words.length; i++) ...[
- if (i > index)
+ if (index != words.length)
+ Padding(
+ padding: EdgeInsets.symmetric(vertical: isDesktop ? 8 : 5),
+ child: Row(
+ children: [
+ for (int i = index; i < words.length; i++) ...[
+ if (i > index)
+ SizedBox(
+ width: isDesktop ? 10 : 6,
+ ),
+ Expanded(
+ child: MnemonicTableItem(
+ number: i + 1,
+ word: words[i],
+ isDesktop: isDesktop,
+ ),
+ ),
+ ],
+ for (int i = remainder; i < wordsPerRow; i++) ...[
const SizedBox(
width: 6,
),
- Expanded(
- child: MnemonicTableItem(
- number: i + 1,
- word: words[i],
+ Expanded(
+ child: Container(),
),
- ),
+ ],
],
- for (int i = remainder; i < wordsPerRow; i++) ...[
- const SizedBox(
- width: 6,
- ),
- Expanded(
- child: Container(),
- ),
- ],
- ],
+ ),
),
- ),
],
);
}
diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart
index dfc8897f8..21e7d2547 100644
--- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart
+++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table_item.dart
@@ -1,49 +1,53 @@
import 'package:flutter/material.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
-import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/widgets/rounded_white_container.dart';
class MnemonicTableItem extends StatelessWidget {
const MnemonicTableItem({
Key? key,
required this.number,
required this.word,
+ required this.isDesktop,
}) : super(key: key);
final int number;
final String word;
+ final bool isDesktop;
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
- return Container(
- decoration: BoxDecoration(
- color: CFColors.white,
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius,
- ),
- ),
- child: Padding(
- padding: const EdgeInsets.all(8),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Text(
- number.toString(),
- style: STextStyles.baseXS.copyWith(
- color: CFColors.gray3,
- fontSize: 10,
- ),
- ),
- const SizedBox(
- width: 8,
- ),
- Text(
- word,
- style: STextStyles.baseXS,
- ),
- ],
- ),
+ return RoundedWhiteContainer(
+ padding: isDesktop
+ ? const EdgeInsets.symmetric(horizontal: 12, vertical: 9)
+ : const EdgeInsets.all(8),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Text(
+ number.toString(),
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textSubtitle2,
+ )
+ : STextStyles.baseXS.copyWith(
+ color: StackTheme.instance.color.textSubtitle2,
+ fontSize: 10,
+ ),
+ ),
+ const SizedBox(
+ width: 8,
+ ),
+ Text(
+ word,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textDark,
+ )
+ : STextStyles.baseXS,
+ ),
+ ],
),
);
}
diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart
index 4711ff2fd..b04af80c3 100644
--- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart
+++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart
@@ -1,18 +1,25 @@
+import 'dart:async';
+
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/exit_to_my_stack_button.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/coin_service.dart';
import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/services/transaction_notification_tracker.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/default_nodes.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.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';
import 'package:stackwallet/widgets/loading_indicator.dart';
+import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:tuple/tuple.dart';
class NewWalletRecoveryPhraseWarningView extends StatefulWidget {
@@ -36,11 +43,13 @@ class _NewWalletRecoveryPhraseWarningViewState
extends State {
late final Coin coin;
late final String walletName;
+ late final bool isDesktop;
@override
void initState() {
coin = widget.coin;
walletName = widget.walletName;
+ isDesktop = Util.isDesktop;
super.initState();
}
@@ -52,24 +61,28 @@ class _NewWalletRecoveryPhraseWarningViewState
? Constants.seedPhraseWordCountMonero
: Constants.seedPhraseWordCountBip39;
- return Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () {
- Navigator.of(context).pop();
- },
- ),
- ),
- body: Container(
- color: CFColors.almostWhite,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- const SizedBox(
- height: 4,
- ),
+ return MasterScaffold(
+ isDesktop: isDesktop,
+ appBar: isDesktop
+ ? const DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(),
+ trailing: ExitToMyStackButton(),
+ )
+ : AppBar(
+ leading: const AppBarBackButton(),
+ ),
+ body: Padding(
+ padding: EdgeInsets.all(isDesktop ? 0 : 16),
+ child: Column(
+ crossAxisAlignment: isDesktop
+ ? CrossAxisAlignment.center
+ : CrossAxisAlignment.stretch,
+ children: [
+ const SizedBox(
+ height: 4,
+ ),
+ if (!isDesktop)
Text(
walletName,
textAlign: TextAlign.center,
@@ -77,35 +90,42 @@ class _NewWalletRecoveryPhraseWarningViewState
fontSize: 12,
),
),
+ const SizedBox(
+ height: 4,
+ ),
+ Text(
+ "Recovery Phrase",
+ textAlign: TextAlign.center,
+ style:
+ isDesktop ? STextStyles.desktopH2 : STextStyles.pageTitleH1,
+ ),
+ SizedBox(
+ height: isDesktop ? 32 : 16,
+ ),
+ RoundedWhiteContainer(
+ padding: isDesktop
+ ? const EdgeInsets.all(32)
+ : const EdgeInsets.all(12),
+ width: isDesktop ? 480 : null,
+ child: Text(
+ "On the next screen you will see $_numberOfPhraseWords words that make up your recovery phrase.\n\nPlease write it down. Keep it safe and never share it with anyone. Your recovery phrase is the only way you can access your funds if you forget your PIN, lose your phone, etc.\n\nStack Wallet does not keep nor is able to restore your recover phrase. Only you have access to your wallet.",
+ style: isDesktop
+ ? STextStyles.desktopTextMediumRegular
+ : STextStyles.subtitle.copyWith(
+ fontSize: 12,
+ ),
+ ),
+ ),
+ if (!isDesktop) const Spacer(),
+ if (isDesktop)
const SizedBox(
- height: 4,
+ height: 32,
),
- Text(
- "Recovery Phrase",
- textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: isDesktop ? 480 : 0,
),
- const SizedBox(
- height: 16,
- ),
- Container(
- decoration: BoxDecoration(
- color: CFColors.white,
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius),
- ),
- child: Padding(
- padding: const EdgeInsets.all(12),
- child: Text(
- "On the next screen you will see $_numberOfPhraseWords words that make up your recovery phrase.\n\nPlease write it down. Keep it safe and never share it with anyone. Your recovery phrase is the only way you can access your funds if you forget your PIN, lose your phone, etc.\n\nStack Wallet does not keep nor is able to restore your recover phrase. Only you have access to your wallet.",
- style: STextStyles.subtitle.copyWith(
- fontSize: 12,
- ),
- ),
- ),
- ),
- const Spacer(),
- Consumer(
+ child: Consumer(
builder: (_, ref, __) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
@@ -119,6 +139,9 @@ class _NewWalletRecoveryPhraseWarningViewState
child: Container(
color: Colors.transparent,
child: Row(
+ crossAxisAlignment: isDesktop
+ ? CrossAxisAlignment.start
+ : CrossAxisAlignment.center,
children: [
Checkbox(
materialTapTargetSize:
@@ -131,138 +154,141 @@ class _NewWalletRecoveryPhraseWarningViewState
newValue!;
},
),
- const SizedBox(
- width: 4,
+ SizedBox(
+ width: isDesktop ? 14 : 4,
),
Flexible(
child: Text(
"I understand that if I lose my recovery phrase, I will not be able to access my funds.",
- style: STextStyles.baseXS,
+ style: isDesktop
+ ? STextStyles.desktopTextMedium
+ : STextStyles.baseXS,
),
),
],
),
),
),
- const SizedBox(
- height: 16,
+ SizedBox(
+ height: isDesktop ? 32 : 16,
),
- TextButton(
- onPressed: ref.read(checkBoxStateProvider.state).state
- ? () async {
- try {
- showDialog(
- context: context,
- barrierDismissible: false,
- useSafeArea: true,
- builder: (ctx) {
- return const Center(
- child: LoadingIndicator(
- width: 50,
- height: 50,
- ),
- );
- },
- );
-
- final walletsService = ref.read(
- walletsServiceChangeNotifierProvider);
-
- final walletId =
- await walletsService.addNewWallet(
- name: walletName,
- coin: coin,
- shouldNotifyListeners: false,
- );
-
- var node = ref
- .read(nodeServiceChangeNotifierProvider)
- .getPrimaryNodeFor(coin: coin);
-
- if (node == null) {
- node = DefaultNodes.getNodeFor(coin);
- ref
- .read(nodeServiceChangeNotifierProvider)
- .setPrimaryNodeFor(
- coin: coin,
- node: node,
+ ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ ),
+ child: TextButton(
+ onPressed: ref.read(checkBoxStateProvider.state).state
+ ? () async {
+ try {
+ unawaited(showDialog(
+ context: context,
+ barrierDismissible: false,
+ useSafeArea: true,
+ builder: (ctx) {
+ return const Center(
+ child: LoadingIndicator(
+ width: 50,
+ height: 50,
+ ),
);
- }
+ },
+ ));
- final txTracker =
- TransactionNotificationTracker(
- walletId: walletId!);
+ final walletsService = ref.read(
+ walletsServiceChangeNotifierProvider);
- final failovers = ref
- .read(nodeServiceChangeNotifierProvider)
- .failoverNodesFor(coin: widget.coin);
-
- final wallet = CoinServiceAPI.from(
- coin,
- walletId,
- walletName,
- node,
- txTracker,
- ref.read(prefsChangeNotifierProvider),
- failovers,
- );
-
- final manager = Manager(wallet);
-
- await manager.initializeNew();
-
- // pop progress dialog
- if (mounted) {
- Navigator.pop(context);
- }
- // set checkbox back to unchecked to annoy users to agree again :P
- ref.read(checkBoxStateProvider.state).state =
- false;
-
- if (mounted) {
- Navigator.of(context).pushNamed(
- NewWalletRecoveryPhraseView.routeName,
- arguments: Tuple2(
- manager,
- await manager.mnemonic,
- ),
+ final walletId =
+ await walletsService.addNewWallet(
+ name: walletName,
+ coin: coin,
+ shouldNotifyListeners: false,
);
+
+ var node = ref
+ .read(nodeServiceChangeNotifierProvider)
+ .getPrimaryNodeFor(coin: coin);
+
+ if (node == null) {
+ node = DefaultNodes.getNodeFor(coin);
+ await ref
+ .read(
+ nodeServiceChangeNotifierProvider)
+ .setPrimaryNodeFor(
+ coin: coin,
+ node: node,
+ );
+ }
+
+ final txTracker =
+ TransactionNotificationTracker(
+ walletId: walletId!);
+
+ final failovers = ref
+ .read(nodeServiceChangeNotifierProvider)
+ .failoverNodesFor(coin: widget.coin);
+
+ final wallet = CoinServiceAPI.from(
+ coin,
+ walletId,
+ walletName,
+ node,
+ txTracker,
+ ref.read(prefsChangeNotifierProvider),
+ failovers,
+ );
+
+ final manager = Manager(wallet);
+
+ await manager.initializeNew();
+
+ // pop progress dialog
+ if (mounted) {
+ Navigator.pop(context);
+ }
+ // set checkbox back to unchecked to annoy users to agree again :P
+ ref
+ .read(checkBoxStateProvider.state)
+ .state = false;
+
+ if (mounted) {
+ unawaited(Navigator.of(context).pushNamed(
+ NewWalletRecoveryPhraseView.routeName,
+ arguments: Tuple2(
+ manager,
+ await manager.mnemonic,
+ ),
+ ));
+ }
+ } catch (e, s) {
+ Logging.instance
+ .log("$e\n$s", level: LogLevel.Fatal);
+ // TODO: handle gracefully
+ // any network/socket exception here will break new wallet creation
+ rethrow;
}
- } catch (e, s) {
- Logging.instance
- .log("$e\n$s", level: LogLevel.Fatal);
- // TODO: handle gracefully
- // any network/socket exception here will break new wallet creation
- rethrow;
}
- }
- : null,
- style: ref.read(checkBoxStateProvider.state).state
- ? Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- )
- : Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent.withOpacity(
- 0.25,
- ),
- ),
- ),
- child: Text(
- "View recovery phrase",
- style: STextStyles.button,
+ : null,
+ style: ref.read(checkBoxStateProvider.state).state
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(context),
+ child: Text(
+ "View recovery phrase",
+ style: isDesktop
+ ? ref.read(checkBoxStateProvider.state).state
+ ? STextStyles.desktopButtonEnabled
+ : STextStyles.desktopButtonDisabled
+ : STextStyles.button,
+ ),
),
),
],
);
},
),
- ],
- ),
+ ),
+ ],
),
),
);
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart
index 6cf709ac1..ec3185c20 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/confirm_recovery_dialog.dart
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class ConfirmRecoveryDialog extends StatelessWidget {
@@ -20,11 +20,7 @@ class ConfirmRecoveryDialog extends StatelessWidget {
message:
"Restoring your wallet may take a while. Please do not exit this screen once the process is started.",
leftButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance.getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.itemSubtitle12,
@@ -34,11 +30,7 @@ class ConfirmRecoveryDialog extends StatelessWidget {
},
),
rightButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance.getPrimaryEnabledButtonColor(context),
child: Text(
"Restore",
style: STextStyles.button,
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view.dart
deleted file mode 100644
index d7f78041d..000000000
--- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view.dart
+++ /dev/null
@@ -1,409 +0,0 @@
-import 'package:flutter/material.dart';
-import 'package:flutter_riverpod/flutter_riverpod.dart';
-import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
-import 'package:flutter_svg/svg.dart';
-import 'package:google_fonts/google_fonts.dart';
-import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart';
-import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart';
-import 'package:stackwallet/providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
-import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
-import 'package:stackwallet/utilities/constants.dart';
-import 'package:stackwallet/utilities/enums/coin_enum.dart';
-import 'package:stackwallet/utilities/format.dart';
-import 'package:stackwallet/utilities/text_styles.dart';
-import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
-import 'package:stackwallet/widgets/rounded_white_container.dart';
-import 'package:tuple/tuple.dart';
-
-class RestoreOptionsView extends ConsumerStatefulWidget {
- const RestoreOptionsView({
- Key? key,
- required this.walletName,
- required this.coin,
- }) : super(key: key);
-
- static const routeName = "/restoreOptions";
-
- final String walletName;
- final Coin coin;
-
- @override
- ConsumerState createState() => _RestoreOptionsViewState();
-}
-
-class _RestoreOptionsViewState extends ConsumerState {
- late final String walletName;
- late final Coin coin;
-
- late TextEditingController _dateController;
- late TextEditingController _lengthController;
- late FocusNode textFieldFocusNode;
-
- final bool _nextEnabled = true;
- DateTime _restoreFromDate = DateTime.fromMillisecondsSinceEpoch(0);
-
- @override
- void initState() {
- walletName = widget.walletName;
- coin = widget.coin;
-
- _dateController = TextEditingController();
- _lengthController = TextEditingController();
- textFieldFocusNode = FocusNode();
-
- super.initState();
- }
-
- @override
- void dispose() {
- _dateController.dispose();
- _lengthController.dispose();
- textFieldFocusNode.dispose();
- super.dispose();
- }
-
- final _datePickerTextStyleBase = GoogleFonts.inter(
- color: CFColors.gray3,
- fontSize: 12,
- fontWeight: FontWeight.w400,
- letterSpacing: 0.5,
- );
- MaterialRoundedDatePickerStyle _buildDatePickerStyle() {
- return MaterialRoundedDatePickerStyle(
- paddingMonthHeader: const EdgeInsets.only(top: 11),
- colorArrowNext: CFColors.neutral60,
- colorArrowPrevious: CFColors.neutral60,
- textStyleButtonNegative: _datePickerTextStyleBase.copyWith(
- fontSize: 16, fontWeight: FontWeight.w600),
- textStyleButtonPositive: _datePickerTextStyleBase.copyWith(
- fontSize: 16, fontWeight: FontWeight.w600),
- textStyleCurrentDayOnCalendar: _datePickerTextStyleBase.copyWith(
- color: CFColors.stackAccent,
- ),
- textStyleDayHeader: _datePickerTextStyleBase.copyWith(
- color: CFColors.stackAccent,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- textStyleDayOnCalendar: _datePickerTextStyleBase,
- textStyleDayOnCalendarDisabled: _datePickerTextStyleBase.copyWith(
- color: CFColors.neutral80,
- ),
- textStyleDayOnCalendarSelected: _datePickerTextStyleBase.copyWith(
- color: CFColors.white,
- ),
- textStyleMonthYearHeader: _datePickerTextStyleBase.copyWith(
- color: CFColors.neutral60,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- textStyleYearButton: _datePickerTextStyleBase.copyWith(
- color: CFColors.white,
- fontSize: 16,
- fontWeight: FontWeight.w600,
- ),
- textStyleButtonAction: GoogleFonts.inter(),
- );
- }
-
- MaterialRoundedYearPickerStyle _buildYearPickerStyle() {
- return MaterialRoundedYearPickerStyle(
- textStyleYear: _datePickerTextStyleBase.copyWith(
- color: CFColors.gray3,
- fontWeight: FontWeight.w600,
- fontSize: 16,
- ),
- textStyleYearSelected: _datePickerTextStyleBase.copyWith(
- color: CFColors.stackAccent,
- fontWeight: FontWeight.w600,
- fontSize: 18,
- ),
- );
- }
-
- @override
- Widget build(BuildContext context) {
- debugPrint("BUILD: $runtimeType with ${coin.name} $walletName");
-
- return Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () {
- if (textFieldFocusNode.hasFocus) {
- textFieldFocusNode.unfocus();
- Future.delayed(const Duration(milliseconds: 100))
- .then((value) => Navigator.of(context).pop());
- } else {
- Navigator.of(context).pop();
- }
- },
- ),
- ),
- body: Container(
- color: CFColors.almostWhite,
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: LayoutBuilder(
- builder: (ctx, constraints) {
- return SingleChildScrollView(
- child: ConstrainedBox(
- constraints: BoxConstraints(minHeight: constraints.maxHeight),
- child: IntrinsicHeight(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- const Spacer(
- flex: 1,
- ),
- Image(
- image: AssetImage(
- Assets.png.imageFor(coin: coin),
- ),
- height: 100,
- ),
- const SizedBox(
- height: 16,
- ),
- Text(
- "Restore options",
- textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
- ),
- const SizedBox(
- height: 24,
- ),
- if (coin == Coin.monero || coin == Coin.epicCash)
- Text(
- "Choose start date",
- style: STextStyles.smallMed12,
- textAlign: TextAlign.left,
- ),
- if (coin == Coin.monero || coin == Coin.epicCash)
- const SizedBox(
- height: 8,
- ),
- if (coin == Coin.monero || coin == Coin.epicCash)
- Container(
- color: Colors.transparent,
- child: TextField(
- onTap: () async {
- final height =
- MediaQuery.of(context).size.height;
- // check and hide keyboard
- if (FocusScope.of(context).hasFocus) {
- FocusScope.of(context).unfocus();
- await Future.delayed(
- const Duration(milliseconds: 125));
- }
-
- final date = await showRoundedDatePicker(
- context: context,
- initialDate: DateTime.now(),
- height: height * 0.5,
- theme: ThemeData(
- primarySwatch: CFColors.createMaterialColor(
- CFColors.stackAccent),
- ),
- //TODO pick a better initial date
- // 2007 chosen as that is just before bitcoin launched
- firstDate: DateTime(2007),
- lastDate: DateTime.now(),
- borderRadius:
- Constants.size.circularBorderRadius * 2,
-
- textPositiveButton: "SELECT",
-
- styleDatePicker: _buildDatePickerStyle(),
- styleYearPicker: _buildYearPickerStyle(),
- );
- if (date != null) {
- _restoreFromDate = date;
- _dateController.text =
- Format.formatDate(date);
- }
- },
- controller: _dateController,
- style: STextStyles.field,
- decoration: InputDecoration(
- hintText: "Restore from...",
- suffixIcon: UnconstrainedBox(
- child: Row(
- children: [
- const SizedBox(
- width: 16,
- ),
- SvgPicture.asset(
- Assets.svg.calendar,
- color: CFColors.neutral50,
- width: 16,
- height: 16,
- ),
- const SizedBox(
- width: 12,
- ),
- ],
- ),
- ),
- ),
- key: const Key("restoreOptionsViewDatePickerKey"),
- readOnly: true,
- toolbarOptions: const ToolbarOptions(
- copy: true,
- cut: false,
- paste: false,
- selectAll: false,
- ),
- onChanged: (newValue) {},
- ),
- ),
- if (coin == Coin.monero || coin == Coin.epicCash)
- const SizedBox(
- height: 8,
- ),
- if (coin == Coin.monero || coin == Coin.epicCash)
- RoundedWhiteContainer(
- child: Center(
- child: Text(
- "Choose the date you made the wallet (approximate is fine)",
- style: STextStyles.smallMed12.copyWith(
- fontSize: 10,
- ),
- ),
- ),
- ),
- if (coin == Coin.monero || coin == Coin.epicCash)
- const SizedBox(
- height: 16,
- ),
- Text(
- "Choose recovery phrase length",
- style: STextStyles.smallMed12,
- textAlign: TextAlign.left,
- ),
- const SizedBox(
- height: 8,
- ),
- Stack(
- children: [
- TextField(
- controller: _lengthController,
- readOnly: true,
- textInputAction: TextInputAction.none,
- ),
- Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 12,
- ),
- child: RawMaterialButton(
- splashColor: CFColors.splashLight,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(
- Constants.size.circularBorderRadius,
- ),
- ),
- onPressed: () {
- showModalBottomSheet(
- backgroundColor: Colors.transparent,
- context: context,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(
- top: Radius.circular(20),
- ),
- ),
- builder: (_) {
- return MnemonicWordCountSelectSheet(
- lengthOptions:
- Constants.possibleLengthsForCoin(
- coin),
- );
- },
- );
- },
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: [
- Text(
- "${ref.watch(mnemonicWordCountStateProvider.state).state} words",
- style: STextStyles.itemSubtitle12,
- ),
- SvgPicture.asset(
- Assets.svg.chevronDown,
- width: 8,
- height: 4,
- color: CFColors.gray3,
- ),
- ],
- ),
- ),
- )
- ],
- ),
- const Spacer(
- flex: 3,
- ),
- TextButton(
- onPressed: _nextEnabled
- ? () async {
- // hide keyboard if has focus
- if (FocusScope.of(context).hasFocus) {
- FocusScope.of(context).unfocus();
- await Future.delayed(
- const Duration(milliseconds: 75));
- }
-
- if (mounted) {
- Navigator.of(context).pushNamed(
- RestoreWalletView.routeName,
- arguments: Tuple4(
- walletName,
- coin,
- ref
- .read(mnemonicWordCountStateProvider
- .state)
- .state,
- _restoreFromDate,
- ),
- );
- }
- }
- : null,
- style: _nextEnabled
- ? Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- )
- : Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent.withOpacity(
- 0.25,
- ),
- ),
- ),
- child: Text(
- "Next",
- style: STextStyles.button,
- ),
- ),
- ],
- ),
- ),
- ),
- );
- },
- ),
- ),
- ),
- );
- }
-}
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart
new file mode 100644
index 000000000..33ca78a46
--- /dev/null
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart
@@ -0,0 +1,389 @@
+import 'package:dropdown_button2/dropdown_button2.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:google_fonts/google_fonts.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart';
+import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart';
+import 'package:stackwallet/providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
+import 'package:stackwallet/utilities/assets.dart';
+import 'package:stackwallet/utilities/constants.dart';
+import 'package:stackwallet/utilities/enums/coin_enum.dart';
+import 'package:stackwallet/utilities/format.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.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';
+import 'package:stackwallet/widgets/rounded_white_container.dart';
+import 'package:tuple/tuple.dart';
+
+class RestoreOptionsView extends ConsumerStatefulWidget {
+ const RestoreOptionsView({
+ Key? key,
+ required this.walletName,
+ required this.coin,
+ }) : super(key: key);
+
+ static const routeName = "/restoreOptions";
+
+ final String walletName;
+ final Coin coin;
+
+ @override
+ ConsumerState createState() => _RestoreOptionsViewState();
+}
+
+class _RestoreOptionsViewState extends ConsumerState {
+ late final String walletName;
+ late final Coin coin;
+ late final bool isDesktop;
+
+ late TextEditingController _dateController;
+ late FocusNode textFieldFocusNode;
+
+ final bool _nextEnabled = true;
+ DateTime _restoreFromDate = DateTime.fromMillisecondsSinceEpoch(0);
+
+ @override
+ void initState() {
+ walletName = widget.walletName;
+ coin = widget.coin;
+ isDesktop = Util.isDesktop;
+
+ _dateController = TextEditingController();
+ textFieldFocusNode = FocusNode();
+
+ super.initState();
+ }
+
+ @override
+ void dispose() {
+ _dateController.dispose();
+ textFieldFocusNode.dispose();
+ super.dispose();
+ }
+
+ final _datePickerTextStyleBase = GoogleFonts.inter(
+ color: StackTheme.instance.color.textSubtitle2,
+ fontSize: 12,
+ fontWeight: FontWeight.w400,
+ letterSpacing: 0.5,
+ );
+ MaterialRoundedDatePickerStyle _buildDatePickerStyle() {
+ return MaterialRoundedDatePickerStyle(
+ paddingMonthHeader: const EdgeInsets.only(top: 11),
+ colorArrowNext: StackTheme.instance.color.textSubtitle1,
+ colorArrowPrevious: StackTheme.instance.color.textSubtitle1,
+ textStyleButtonNegative: _datePickerTextStyleBase.copyWith(
+ fontSize: 16, fontWeight: FontWeight.w600),
+ textStyleButtonPositive: _datePickerTextStyleBase.copyWith(
+ fontSize: 16, fontWeight: FontWeight.w600),
+ textStyleCurrentDayOnCalendar: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.accentColorDark,
+ ),
+ textStyleDayHeader: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.accentColorDark,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ textStyleDayOnCalendar: _datePickerTextStyleBase,
+ textStyleDayOnCalendarDisabled: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.textSubtitle3,
+ ),
+ textStyleDayOnCalendarSelected: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.popupBG,
+ ),
+ textStyleMonthYearHeader: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.textSubtitle1,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ textStyleYearButton: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.textWhite,
+ fontSize: 16,
+ fontWeight: FontWeight.w600,
+ ),
+ textStyleButtonAction: GoogleFonts.inter(),
+ );
+ }
+
+ MaterialRoundedYearPickerStyle _buildYearPickerStyle() {
+ return MaterialRoundedYearPickerStyle(
+ textStyleYear: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.textSubtitle2,
+ fontWeight: FontWeight.w600,
+ fontSize: 16,
+ ),
+ textStyleYearSelected: _datePickerTextStyleBase.copyWith(
+ color: StackTheme.instance.color.accentColorDark,
+ fontWeight: FontWeight.w600,
+ fontSize: 18,
+ ),
+ );
+ }
+
+ Future nextPressed() async {
+ if (!isDesktop) {
+ // hide keyboard if has focus
+ if (FocusScope.of(context).hasFocus) {
+ FocusScope.of(context).unfocus();
+ await Future.delayed(const Duration(milliseconds: 75));
+ }
+ }
+
+ if (mounted) {
+ await Navigator.of(context).pushNamed(
+ RestoreWalletView.routeName,
+ arguments: Tuple4(
+ walletName,
+ coin,
+ ref.read(mnemonicWordCountStateProvider.state).state,
+ _restoreFromDate,
+ ),
+ );
+ }
+ }
+
+ Future chooseDate() async {
+ final height = MediaQuery.of(context).size.height;
+ // check and hide keyboard
+ if (FocusScope.of(context).hasFocus) {
+ FocusScope.of(context).unfocus();
+ await Future.delayed(const Duration(milliseconds: 125));
+ }
+
+ final date = await showRoundedDatePicker(
+ context: context,
+ initialDate: DateTime.now(),
+ height: height * 0.5,
+ theme: ThemeData(
+ primarySwatch:
+ Util.createMaterialColor(StackTheme.instance.color.accentColorDark),
+ ),
+ //TODO pick a better initial date
+ // 2007 chosen as that is just before bitcoin launched
+ firstDate: DateTime(2007),
+ lastDate: DateTime.now(),
+ borderRadius: Constants.size.circularBorderRadius * 2,
+
+ textPositiveButton: "SELECT",
+
+ styleDatePicker: _buildDatePickerStyle(),
+ styleYearPicker: _buildYearPickerStyle(),
+ );
+ if (date != null) {
+ _restoreFromDate = date;
+ _dateController.text = Format.formatDate(date);
+ }
+ }
+
+ Future chooseMnemonicLength() async {
+ await showModalBottomSheet(
+ backgroundColor: Colors.transparent,
+ context: context,
+ shape: const RoundedRectangleBorder(
+ borderRadius: BorderRadius.vertical(
+ top: Radius.circular(20),
+ ),
+ ),
+ builder: (_) {
+ return MnemonicWordCountSelectSheet(
+ lengthOptions: Constants.possibleLengthsForCoin(coin),
+ );
+ },
+ );
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ debugPrint("BUILD: $runtimeType with ${coin.name} $walletName");
+
+ final lengths = Constants.possibleLengthsForCoin(coin).toList();
+
+ return DesktopScaffold(
+ appBar: isDesktop
+ ? const DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(),
+ )
+ : AppBar(
+ leading: AppBarBackButton(
+ onPressed: () {
+ if (textFieldFocusNode.hasFocus) {
+ textFieldFocusNode.unfocus();
+ Future.delayed(const Duration(milliseconds: 100))
+ .then((value) => Navigator.of(context).pop());
+ } else {
+ Navigator.of(context).pop();
+ }
+ },
+ ),
+ ),
+ body: RestoreOptionsPlatformLayout(
+ isDesktop: isDesktop,
+ child: ConstrainedBox(
+ constraints: BoxConstraints(
+ maxWidth: isDesktop ? 480 : double.infinity,
+ ),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (!isDesktop)
+ const Spacer(
+ flex: 1,
+ ),
+ if (!isDesktop)
+ Image(
+ image: AssetImage(
+ Assets.png.imageFor(coin: coin),
+ ),
+ height: 100,
+ ),
+ SizedBox(
+ height: isDesktop ? 24 : 16,
+ ),
+ Text(
+ "Restore options",
+ textAlign: TextAlign.center,
+ style:
+ isDesktop ? STextStyles.desktopH2 : STextStyles.pageTitleH1,
+ ),
+ SizedBox(
+ height: isDesktop ? 40 : 24,
+ ),
+ if (coin == Coin.monero || coin == Coin.epicCash)
+ Text(
+ "Choose start date",
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textDark3,
+ )
+ : STextStyles.smallMed12,
+ textAlign: TextAlign.left,
+ ),
+ if (coin == Coin.monero || coin == Coin.epicCash)
+ SizedBox(
+ height: isDesktop ? 16 : 8,
+ ),
+ if (coin == Coin.monero || coin == Coin.epicCash)
+
+ // if (!isDesktop)
+ RestoreFromDatePicker(
+ onTap: chooseDate,
+ ),
+
+ // if (isDesktop)
+ // // TODO desktop date picker
+ if (coin == Coin.monero || coin == Coin.epicCash)
+ const SizedBox(
+ height: 8,
+ ),
+ if (coin == Coin.monero || coin == Coin.epicCash)
+ RoundedWhiteContainer(
+ child: Center(
+ child: Text(
+ "Choose the date you made the wallet (approximate is fine)",
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textSubtitle1,
+ )
+ : STextStyles.smallMed12.copyWith(
+ fontSize: 10,
+ ),
+ ),
+ ),
+ ),
+ if (coin == Coin.monero || coin == Coin.epicCash)
+ SizedBox(
+ height: isDesktop ? 24 : 16,
+ ),
+ Text(
+ "Choose recovery phrase length",
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textDark3,
+ )
+ : STextStyles.smallMed12,
+ textAlign: TextAlign.left,
+ ),
+ SizedBox(
+ height: isDesktop ? 16 : 8,
+ ),
+ if (isDesktop)
+ DropdownButtonHideUnderline(
+ child: DropdownButton2(
+ value:
+ ref.watch(mnemonicWordCountStateProvider.state).state,
+ items: [
+ ...lengths.map(
+ (e) => DropdownMenuItem(
+ value: e,
+ child: Text(
+ "$e words",
+ style: STextStyles.desktopTextMedium,
+ ),
+ ),
+ ),
+ ],
+ onChanged: (value) {
+ if (value is int) {
+ ref.read(mnemonicWordCountStateProvider.state).state =
+ value;
+ }
+ },
+ isExpanded: true,
+ icon: SvgPicture.asset(
+ Assets.svg.chevronDown,
+ width: 12,
+ height: 6,
+ color: StackTheme
+ .instance.color.textFieldActiveSearchIconRight,
+ ),
+ buttonPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 8,
+ ),
+ buttonDecoration: BoxDecoration(
+ color: StackTheme.instance.color.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ dropdownDecoration: BoxDecoration(
+ color: StackTheme.instance.color.textFieldDefaultBG,
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ ),
+ ),
+ if (!isDesktop)
+ MobileMnemonicLengthSelector(
+ chooseMnemonicLength: chooseMnemonicLength,
+ ),
+ if (!isDesktop)
+ const Spacer(
+ flex: 3,
+ ),
+ if (isDesktop)
+ const SizedBox(
+ height: 32,
+ ),
+ RestoreOptionsNextButton(
+ isDesktop: isDesktop,
+ onPressed: _nextEnabled ? nextPressed : null,
+ ),
+ ],
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart
new file mode 100644
index 000000000..79fece250
--- /dev/null
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/mobile_mnemonic_length_selector.dart
@@ -0,0 +1,59 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_riverpod/flutter_riverpod.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:stackwallet/providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
+import 'package:stackwallet/utilities/assets.dart';
+import 'package:stackwallet/utilities/constants.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+
+class MobileMnemonicLengthSelector extends ConsumerWidget {
+ const MobileMnemonicLengthSelector({
+ Key? key,
+ required this.chooseMnemonicLength,
+ }) : super(key: key);
+
+ final VoidCallback chooseMnemonicLength;
+
+ @override
+ Widget build(BuildContext context, WidgetRef ref) {
+ return Stack(
+ children: [
+ const TextField(
+ // controller: _lengthController,
+ readOnly: true,
+ textInputAction: TextInputAction.none,
+ ),
+ Padding(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ ),
+ child: RawMaterialButton(
+ splashColor: StackTheme.instance.color.highlight,
+ shape: RoundedRectangleBorder(
+ borderRadius: BorderRadius.circular(
+ Constants.size.circularBorderRadius,
+ ),
+ ),
+ onPressed: chooseMnemonicLength,
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ "${ref.watch(mnemonicWordCountStateProvider.state).state} words",
+ style: STextStyles.itemSubtitle12,
+ ),
+ SvgPicture.asset(
+ Assets.svg.chevronDown,
+ width: 8,
+ height: 4,
+ color: StackTheme.instance.color.textSubtitle2,
+ ),
+ ],
+ ),
+ ),
+ )
+ ],
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart
new file mode 100644
index 000000000..e0ab01217
--- /dev/null
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_from_date_picker.dart
@@ -0,0 +1,76 @@
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+import 'package:stackwallet/utilities/assets.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+
+class RestoreFromDatePicker extends StatefulWidget {
+ const RestoreFromDatePicker({Key? key, required this.onTap})
+ : super(key: key);
+
+ final VoidCallback onTap;
+
+ @override
+ State createState() => _RestoreFromDatePickerState();
+}
+
+class _RestoreFromDatePickerState extends State {
+ late final TextEditingController _dateController;
+ late final VoidCallback onTap;
+
+ @override
+ void initState() {
+ onTap = widget.onTap;
+ _dateController = TextEditingController();
+
+ super.initState();
+ }
+
+ @override
+ void dispose() {
+ _dateController.dispose();
+ super.dispose();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Container(
+ color: Colors.transparent,
+ child: TextField(
+ onTap: onTap,
+ controller: _dateController,
+ style: STextStyles.field,
+ decoration: InputDecoration(
+ hintText: "Restore from...",
+ suffixIcon: UnconstrainedBox(
+ child: Row(
+ children: [
+ const SizedBox(
+ width: 16,
+ ),
+ SvgPicture.asset(
+ Assets.svg.calendar,
+ color: StackTheme.instance.color.textDark3,
+ width: 16,
+ height: 16,
+ ),
+ const SizedBox(
+ width: 12,
+ ),
+ ],
+ ),
+ ),
+ ),
+ key: const Key("restoreOptionsViewDatePickerKey"),
+ readOnly: true,
+ toolbarOptions: const ToolbarOptions(
+ copy: true,
+ cut: false,
+ paste: false,
+ selectAll: false,
+ ),
+ onChanged: (newValue) {},
+ ),
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart
new file mode 100644
index 000000000..c8810b430
--- /dev/null
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_next_button.dart
@@ -0,0 +1,33 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+
+class RestoreOptionsNextButton extends StatelessWidget {
+ const RestoreOptionsNextButton({
+ Key? key,
+ required this.isDesktop,
+ this.onPressed,
+ }) : super(key: key);
+
+ final bool isDesktop;
+ final VoidCallback? onPressed;
+
+ @override
+ Widget build(BuildContext context) {
+ return ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ ),
+ child: TextButton(
+ onPressed: onPressed,
+ style: onPressed != null
+ ? StackTheme.instance.getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance.getPrimaryDisabledButtonColor(context),
+ child: Text(
+ "Next",
+ style: STextStyles.button,
+ ),
+ ),
+ );
+ }
+}
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart
new file mode 100644
index 000000000..df5223c88
--- /dev/null
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/sub_widgets/restore_options_platform_layout.dart
@@ -0,0 +1,39 @@
+import 'package:flutter/material.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+
+class RestoreOptionsPlatformLayout extends StatelessWidget {
+ const RestoreOptionsPlatformLayout({
+ Key? key,
+ required this.isDesktop,
+ required this.child,
+ }) : super(key: key);
+
+ final bool isDesktop;
+ final Widget child;
+
+ @override
+ Widget build(BuildContext context) {
+ if (isDesktop) {
+ return child;
+ } else {
+ return Container(
+ color: StackTheme.instance.color.background,
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: LayoutBuilder(
+ builder: (ctx, constraints) {
+ return SingleChildScrollView(
+ child: ConstrainedBox(
+ constraints: BoxConstraints(minHeight: constraints.maxHeight),
+ child: IntrinsicHeight(
+ child: child,
+ ),
+ ),
+ );
+ },
+ ),
+ ),
+ );
+ }
+ }
+}
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart
index 4e4871bda..59ce94874 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_wallet_view.dart
@@ -16,6 +16,7 @@ import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/sub_widge
import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart';
import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart';
import 'package:stackwallet/pages/home_view/home_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/desktop_home_view.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/coin_service.dart';
import 'package:stackwallet/services/coins/manager.dart';
@@ -23,7 +24,6 @@ import 'package:stackwallet/services/transaction_notification_tracker.dart';
import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/custom_text_selection_controls.dart';
@@ -33,6 +33,8 @@ import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/enums/form_input_status_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
@@ -66,6 +68,7 @@ class RestoreWalletView extends ConsumerStatefulWidget {
class _RestoreWalletViewState extends ConsumerState {
final _formKey = GlobalKey();
late final int _seedWordCount;
+ late final bool isDesktop;
final HashSet _wordListHashSet = HashSet.from(bip39wordlist.WORDLIST);
final ScrollController controller = ScrollController();
@@ -85,13 +88,13 @@ class _RestoreWalletViewState extends ConsumerState {
final text = data!.text!.trim();
if (text.isEmpty || _controllers.isEmpty) {
- delegate.pasteText(SelectionChangedCause.toolbar);
+ unawaited(delegate.pasteText(SelectionChangedCause.toolbar));
return;
}
final words = text.split(" ");
if (words.isEmpty) {
- delegate.pasteText(SelectionChangedCause.toolbar);
+ unawaited(delegate.pasteText(SelectionChangedCause.toolbar));
return;
}
@@ -115,6 +118,7 @@ class _RestoreWalletViewState extends ConsumerState {
@override
void initState() {
_seedWordCount = widget.seedWordsLength;
+ isDesktop = Util.isDesktop;
textSelectionControls = Platform.isIOS
? CustomCupertinoTextSelectionControls(onPaste: onControlsPaste)
@@ -190,13 +194,13 @@ class _RestoreWalletViewState extends ConsumerState {
// TODO: do actual check to make sure it is a valid mnemonic for monero
if (bip39.validateMnemonic(mnemonic) == false &&
!(widget.coin == Coin.monero)) {
- showFloatingFlushBar(
+ unawaited(showFloatingFlushBar(
type: FlushBarType.warning,
message: "Invalid seed phrase!",
context: context,
- );
+ ));
} else {
- if (!Platform.isLinux) Wakelock.enable();
+ if (!Platform.isLinux) await Wakelock.enable();
final walletsService = ref.read(walletsServiceChangeNotifierProvider);
final walletId = await walletsService.addNewWallet(
@@ -206,7 +210,7 @@ class _RestoreWalletViewState extends ConsumerState {
);
bool isRestoring = true;
// show restoring in progress
- showDialog(
+ unawaited(showDialog(
context: context,
useSafeArea: false,
barrierDismissible: false,
@@ -225,7 +229,7 @@ class _RestoreWalletViewState extends ConsumerState {
},
);
},
- );
+ ));
var node = ref
.read(nodeServiceChangeNotifierProvider)
@@ -233,7 +237,7 @@ class _RestoreWalletViewState extends ConsumerState {
if (node == null) {
node = DefaultNodes.getNodeFor(widget.coin);
- ref.read(nodeServiceChangeNotifierProvider).setPrimaryNodeFor(
+ await ref.read(nodeServiceChangeNotifierProvider).setPrimaryNodeFor(
coin: widget.coin,
node: node,
);
@@ -282,26 +286,31 @@ class _RestoreWalletViewState extends ConsumerState {
.addWallet(walletId: manager.walletId, manager: manager);
if (mounted) {
- Navigator.of(context).pushNamedAndRemoveUntil(
- HomeView.routeName, (route) => false);
+ if (isDesktop) {
+ Navigator.of(context)
+ .popUntil(ModalRoute.withName(DesktopHomeView.routeName));
+ } else {
+ unawaited(Navigator.of(context).pushNamedAndRemoveUntil(
+ HomeView.routeName, (route) => false));
+ }
}
- showDialog(
+ await showDialog(
context: context,
useSafeArea: false,
barrierDismissible: true,
builder: (context) {
return const RestoreSucceededDialog();
},
- ).then(
- (_) {
- if (!Platform.isLinux) Wakelock.disable();
- // timer.cancel();
- },
);
+ if (!Platform.isLinux && !isDesktop) {
+ await Wakelock.disable();
+ }
}
} catch (e) {
- if (!Platform.isLinux) Wakelock.disable();
+ if (!Platform.isLinux && !isDesktop) {
+ await Wakelock.disable();
+ }
// if (e is HiveError &&
// e.message == "Box has already been closed.") {
@@ -316,7 +325,7 @@ class _RestoreWalletViewState extends ConsumerState {
Navigator.pop(context);
// show restoring wallet failed dialog
- showDialog(
+ await showDialog(
context: context,
useSafeArea: false,
barrierDismissible: true,
@@ -331,7 +340,9 @@ class _RestoreWalletViewState extends ConsumerState {
}
}
- if (!Platform.isLinux) Wakelock.disable();
+ if (!Platform.isLinux && !isDesktop) {
+ await Wakelock.disable();
+ }
}
}
}
@@ -343,27 +354,27 @@ class _RestoreWalletViewState extends ConsumerState {
Widget? suffixIcon;
switch (status) {
case FormInputStatus.empty:
- color = CFColors.fieldGray;
- prefixColor = CFColors.gray3;
+ color = StackTheme.instance.color.textFieldDefaultBG;
+ prefixColor = StackTheme.instance.color.textSubtitle2;
break;
case FormInputStatus.invalid:
- color = CFColors.notificationRedBackground;
- prefixColor = CFColors.notificationRedForeground;
+ color = StackTheme.instance.color.textFieldErrorBG;
+ prefixColor = StackTheme.instance.color.textFieldErrorSearchIconLeft;
suffixIcon = SvgPicture.asset(
Assets.svg.alertCircle,
width: 16,
height: 16,
- color: CFColors.notificationRedForeground,
+ color: StackTheme.instance.color.textFieldErrorSearchIconRight,
);
break;
case FormInputStatus.valid:
- color = CFColors.notificationGreenBackground;
- prefixColor = CFColors.notificationGreenForeground;
+ color = StackTheme.instance.color.textFieldSuccessBG;
+ prefixColor = StackTheme.instance.color.textFieldSuccessSearchIconLeft;
suffixIcon = SvgPicture.asset(
Assets.svg.checkCircle,
width: 16,
height: 16,
- color: CFColors.notificationGreenForeground,
+ color: StackTheme.instance.color.textFieldSuccessSearchIconRight,
);
break;
}
@@ -441,8 +452,71 @@ class _RestoreWalletViewState extends ConsumerState {
});
}
- controller.animateTo(controller.position.maxScrollExtent,
- duration: const Duration(milliseconds: 300), curve: Curves.decelerate);
+ if (!isDesktop) {
+ controller.animateTo(
+ controller.position.maxScrollExtent,
+ duration: const Duration(milliseconds: 300),
+ curve: Curves.decelerate,
+ );
+ }
+ }
+
+ Future scanMnemonicQr() async {
+ try {
+ final qrResult = await scanner.scan();
+
+ final results = AddressUtils.decodeQRSeedData(qrResult.rawContent);
+
+ Logging.instance.log("scan parsed: $results", level: LogLevel.Info);
+
+ if (results["mnemonic"] != null) {
+ final list = (results["mnemonic"] as List)
+ .map((value) => value as String)
+ .toList(growable: false);
+ if (list.isNotEmpty) {
+ _clearAndPopulateMnemonic(list);
+ Logging.instance.log("mnemonic populated", level: LogLevel.Info);
+ } else {
+ Logging.instance
+ .log("mnemonic failed to populate", level: LogLevel.Info);
+ }
+ }
+ } on PlatformException catch (e) {
+ // likely failed to get camera permissions
+ Logging.instance
+ .log("Restore wallet qr scan failed: $e", level: LogLevel.Warning);
+ }
+ }
+
+ Future pasteMnemonic() async {
+ debugPrint("restoreWalletPasteButton tapped");
+ final ClipboardData? data =
+ await widget.clipboard.getData(Clipboard.kTextPlain);
+
+ if (data?.text != null && data!.text!.isNotEmpty) {
+ final content = data.text!.trim();
+ final list = content.split(" ");
+ _clearAndPopulateMnemonic(list);
+ }
+ }
+
+ Future requestRestore() async {
+ // wait for keyboard to disappear
+ FocusScope.of(context).unfocus();
+ await Future.delayed(
+ const Duration(milliseconds: 100),
+ );
+
+ await showDialog(
+ context: context,
+ useSafeArea: false,
+ barrierDismissible: true,
+ builder: (context) {
+ return ConfirmRecoveryDialog(
+ onConfirm: attemptRestore,
+ );
+ },
+ );
}
@override
@@ -473,41 +547,13 @@ class _RestoreWalletViewState extends ConsumerState {
key: const Key("restoreWalletViewQrCodeButton"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
- icon: const QrCodeIcon(
+ color: StackTheme.instance.color.background,
+ icon: QrCodeIcon(
width: 20,
height: 20,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
),
- onPressed: () async {
- try {
- final qrResult = await scanner.scan();
-
- final results =
- AddressUtils.decodeQRSeedData(qrResult.rawContent);
-
- Logging.instance
- .log("scan parsed: $results", level: LogLevel.Info);
-
- if (results["mnemonic"] != null) {
- final list = (results["mnemonic"] as List)
- .map((value) => value as String)
- .toList(growable: false);
- if (list.isNotEmpty) {
- _clearAndPopulateMnemonic(list);
- Logging.instance
- .log("mnemonic populated", level: LogLevel.Info);
- } else {
- Logging.instance.log("mnemonic failed to populate",
- level: LogLevel.Info);
- }
- }
- } on PlatformException catch (e) {
- // likely failed to get camera permissions
- Logging.instance.log("Restore wallet qr scan failed: $e",
- level: LogLevel.Warning);
- }
- },
+ onPressed: scanMnemonicQr,
),
),
),
@@ -523,30 +569,20 @@ class _RestoreWalletViewState extends ConsumerState {
key: const Key("restoreWalletPasteButton"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
- icon: const ClipboardIcon(
+ color: StackTheme.instance.color.background,
+ icon: ClipboardIcon(
width: 20,
height: 20,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
),
- onPressed: () async {
- debugPrint("restoreWalletPasteButton tapped");
- final ClipboardData? data =
- await widget.clipboard.getData(Clipboard.kTextPlain);
-
- if (data?.text != null && data!.text!.isNotEmpty) {
- final content = data.text!.trim();
- final list = content.split(" ");
- _clearAndPopulateMnemonic(list);
- }
- },
+ onPressed: pasteMnemonic,
),
),
),
],
),
body: Container(
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
@@ -633,74 +669,22 @@ class _RestoreWalletViewState extends ConsumerState {
"Please check spelling",
textAlign: TextAlign.left,
style: STextStyles.label.copyWith(
- color: CFColors
- .notificationRedForeground,
+ color: StackTheme
+ .instance.color.textError,
),
),
),
)
],
),
- // if (widget.coin == Coin.monero ||
- // widget.coin == Coin.epicCash)
- // Padding(
- // padding: const EdgeInsets.only(
- // top: 8.0,
- // ),
- // child: ClipRRect(
- // borderRadius: BorderRadius.circular(
- // Constants.size.circularBorderRadius,
- // ),
- // child: TextField(
- // key: Key("restoreMnemonicFormField_height"),
- // inputFormatters: [
- // FilteringTextInputFormatter.allow(
- // RegExp("[0-9]*")),
- // ],
- // keyboardType:
- // TextInputType.numberWithOptions(),
- // controller: _heightController,
- // focusNode: _heightFocusNode,
- // style: STextStyles.field,
- // decoration: standardInputDecoration(
- // "Height",
- // _heightFocusNode,
- // ),
- // ),
- // ),
- // ),
Padding(
padding: const EdgeInsets.only(
top: 8.0,
),
child: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
- onPressed: () async {
- // wait for keyboard to disappear
- FocusScope.of(context).unfocus();
- await Future.delayed(
- const Duration(milliseconds: 100),
- );
-
- showDialog(
- context: context,
- useSafeArea: false,
- barrierDismissible: true,
- builder: (context) {
- return ConfirmRecoveryDialog(
- onConfirm: attemptRestore,
- );
- },
- );
- },
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
+ onPressed: requestRestore,
child: Text(
"Restore",
style: STextStyles.button,
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart
index 50ab388ff..b14140cd6 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/mnemonic_word_count_select_sheet.dart
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
class MnemonicWordCountSelectSheet extends ConsumerWidget {
const MnemonicWordCountSelectSheet({
@@ -22,9 +22,9 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
return false;
},
child: Container(
- decoration: const BoxDecoration(
- color: CFColors.white,
- borderRadius: BorderRadius.vertical(
+ decoration: BoxDecoration(
+ color: StackTheme.instance.color.popupBG,
+ borderRadius: const BorderRadius.vertical(
top: Radius.circular(20),
),
),
@@ -42,7 +42,7 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
Center(
child: Container(
decoration: BoxDecoration(
- color: CFColors.fieldGray,
+ color: StackTheme.instance.color.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
@@ -96,7 +96,8 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
width: 20,
height: 20,
child: Radio(
- activeColor: CFColors.link2,
+ activeColor: StackTheme
+ .instance.color.radioButtonIconEnabled,
value: lengthOptions[i],
groupValue: ref
.watch(mnemonicWordCountStateProvider
@@ -118,9 +119,7 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
),
Text(
"${lengthOptions[i]} words",
- style: STextStyles.titleBold12.copyWith(
- color: const Color(0xFF44464E),
- ),
+ style: STextStyles.titleBold12,
textAlign: TextAlign.left,
),
],
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart
index 866223cfe..3d349e7ba 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_failed_dialog.dart
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/providers.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class RestoreFailedDialog extends ConsumerStatefulWidget {
@@ -45,11 +45,7 @@ class _RestoreFailedDialogState extends ConsumerState {
title: "Restore failed",
message: errorMessage,
rightButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance.getSecondaryEnabledButtonColor(context),
child: Text(
"Ok",
style: STextStyles.itemSubtitle12,
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart
index 2cfdaba2a..35c48ef17 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restore_succeeded_dialog.dart
@@ -1,8 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class RestoreSucceededDialog extends StatelessWidget {
@@ -17,14 +18,10 @@ class RestoreSucceededDialog extends StatelessWidget {
Assets.svg.checkCircle,
width: 24,
height: 24,
- color: CFColors.stackGreen,
+ color: StackTheme.instance.color.accentColorGreen,
),
rightButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance.getSecondaryEnabledButtonColor(context),
child: Text(
"Ok",
style: STextStyles.itemSubtitle12,
diff --git a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart
index 59ad53c20..a3971196f 100644
--- a/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart
+++ b/lib/pages/add_wallet_views/restore_wallet_view/sub_widgets/restoring_dialog.dart
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class RestoringDialog extends StatefulWidget {
@@ -59,19 +59,13 @@ class _RestoringDialogState extends State
message: "This may take a while. Please do not exit this screen.",
icon: RotationTransition(
turns: _spinAnimation,
- child: SvgPicture.asset(
- Assets.svg.arrowRotate3,
- width: 24,
- height: 24,
- color: CFColors.stackAccent,
- ),
+ child: SvgPicture.asset(Assets.svg.arrowRotate3,
+ width: 24,
+ height: 24,
+ color: StackTheme.instance.color.accentColorDark),
),
rightButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance.getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.itemSubtitle12,
diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart
index 0046607c4..768ed05af 100644
--- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart
+++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart
@@ -6,9 +6,11 @@ class WordTable extends ConsumerWidget {
const WordTable({
Key? key,
required this.words,
+ required this.isDesktop,
}) : super(key: key);
final List words;
+ final bool isDesktop;
static const wordsPerRow = 3;
static const wordsToShow = 9;
@@ -24,18 +26,19 @@ class WordTable extends ConsumerWidget {
children: [
for (int i = 1; i <= rows; i++)
Padding(
- padding: const EdgeInsets.symmetric(vertical: 5),
+ padding: EdgeInsets.symmetric(vertical: isDesktop ? 8 : 5),
child: Row(
children: [
for (int j = 1; j <= wordsPerRow; j++) ...[
if (j > 1)
- const SizedBox(
- width: 6,
+ SizedBox(
+ width: isDesktop ? 10 : 6,
),
Expanded(
child: WordTableItem(
number: ++index,
word: words[index - 1],
+ isDesktop: isDesktop,
),
),
],
diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart
index 3d7d87d22..a9c86b525 100644
--- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart
+++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table_item.dart
@@ -1,19 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/providers.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
class WordTableItem extends ConsumerWidget {
const WordTableItem({
Key? key,
required this.number,
required this.word,
+ required this.isDesktop,
}) : super(key: key);
final int number;
final String word;
+ final bool isDesktop;
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -22,15 +24,22 @@ class WordTableItem extends ConsumerWidget {
ref.watch(verifyMnemonicSelectedWordStateProvider.state).state;
return Container(
decoration: BoxDecoration(
- color: selectedWord == word ? CFColors.selection : CFColors.white,
+ color: selectedWord == word
+ ? StackTheme.instance.color.snackBarBackInfo
+ : StackTheme.instance.color.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
),
child: MaterialButton(
- splashColor: CFColors.splashLight,
+ splashColor: StackTheme.instance.color.highlight,
key: Key("coinSelectItemButtonKey_$word"),
- padding: const EdgeInsets.all(12),
+ padding: isDesktop
+ ? const EdgeInsets.symmetric(
+ vertical: 18,
+ horizontal: 12,
+ )
+ : const EdgeInsets.all(12),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius:
@@ -45,7 +54,11 @@ class WordTableItem extends ConsumerWidget {
Text(
word,
textAlign: TextAlign.center,
- style: STextStyles.baseXS,
+ style: isDesktop
+ ? STextStyles.desktopTextExtraSmall.copyWith(
+ color: StackTheme.instance.color.textDark,
+ )
+ : STextStyles.baseXS,
),
],
),
diff --git a/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart b/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart
index 6e0c1dd2b..ee464bd3e 100644
--- a/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart
+++ b/lib/pages/add_wallet_views/verify_recovery_phrase_view/verify_recovery_phrase_view.dart
@@ -1,3 +1,4 @@
+import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
@@ -6,14 +7,20 @@ import 'package:stackwallet/notifications/show_flush_bar.dart';
import 'package:stackwallet/pages/add_wallet_views/new_wallet_recovery_phrase_view/new_wallet_recovery_phrase_view.dart';
import 'package:stackwallet/pages/add_wallet_views/verify_recovery_phrase_view/sub_widgets/word_table.dart';
import 'package:stackwallet/pages/home_view/home_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/desktop_home_view.dart';
+import 'package:stackwallet/pages_desktop_specific/home/my_stack_view/exit_to_my_stack_button.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
+import 'package:stackwallet/utilities/util.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';
import 'package:tuple/tuple.dart';
class VerifyRecoveryPhraseView extends ConsumerStatefulWidget {
@@ -39,11 +46,13 @@ class _VerifyRecoveryPhraseViewState
{
late Manager _manager;
late List _mnemonic;
+ late final bool isDesktop;
@override
void initState() {
_manager = widget.manager;
_mnemonic = widget.mnemonic;
+ isDesktop = Util.isDesktop;
// WidgetsBinding.instance?.addObserver(this);
super.initState();
}
@@ -75,6 +84,62 @@ class _VerifyRecoveryPhraseViewState
// }
// }
+ Future _continue(bool isMatch) async {
+ if (isMatch) {
+ await ref.read(walletsServiceChangeNotifierProvider).setMnemonicVerified(
+ walletId: _manager.walletId,
+ );
+
+ ref
+ .read(walletsChangeNotifierProvider.notifier)
+ .addWallet(walletId: _manager.walletId, manager: _manager);
+
+ if (mounted) {
+ if (isDesktop) {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(
+ DesktopHomeView.routeName,
+ ),
+ );
+ } else {
+ unawaited(
+ Navigator.of(context).pushNamedAndRemoveUntil(
+ HomeView.routeName,
+ (route) => false,
+ ),
+ );
+ }
+ }
+
+ unawaited(showFloatingFlushBar(
+ type: FlushBarType.success,
+ message: "Correct! Your wallet is set up.",
+ iconAsset: Assets.svg.check,
+ context: context,
+ ));
+ } else {
+ unawaited(showFloatingFlushBar(
+ type: FlushBarType.warning,
+ message: "Incorrect. Please try again.",
+ iconAsset: Assets.svg.circleX,
+ context: context,
+ ));
+
+ final int next = Random().nextInt(_mnemonic.length);
+ ref
+ .read(verifyMnemonicWordIndexStateProvider.state)
+ .update((state) => next);
+
+ ref
+ .read(verifyMnemonicCorrectWordStateProvider.state)
+ .update((state) => _mnemonic[next]);
+
+ ref
+ .read(verifyMnemonicSelectedWordStateProvider.state)
+ .update((state) => "");
+ }
+ }
+
Tuple2, String> randomize(
List mnemonic, int chosenIndex, int wordsToShow) {
final List remaining = [];
@@ -113,12 +178,12 @@ class _VerifyRecoveryPhraseViewState
return false;
}
- // Future delete() async {
- // await ref
- // .read(walletsServiceChangeNotifierProvider)
- // .deleteWallet(_manager.walletName, false);
- // await _manager.exitCurrentWallet();
- // }
+ Future delete() async {
+ await ref
+ .read(walletsServiceChangeNotifierProvider)
+ .deleteWallet(_manager.walletName, false);
+ await _manager.exitCurrentWallet();
+ }
@override
Widget build(BuildContext context) {
@@ -128,51 +193,78 @@ class _VerifyRecoveryPhraseViewState
return WillPopScope(
onWillPop: onWillPop,
- child: Scaffold(
- appBar: AppBar(
- leading: AppBarBackButton(
- onPressed: () async {
- // await delete();
- Navigator.of(context).popUntil(
- ModalRoute.withName(
- // NewWalletRecoveryPhraseWarningView.routeName,
- NewWalletRecoveryPhraseView.routeName,
+ child: MasterScaffold(
+ isDesktop: isDesktop,
+ appBar: isDesktop
+ ? DesktopAppBar(
+ isCompactHeight: false,
+ leading: AppBarBackButton(
+ onPressed: () async {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(
+ NewWalletRecoveryPhraseView.routeName,
+ ),
+ );
+ },
),
- );
- },
- ),
- ),
- body: Container(
- color: CFColors.almostWhite,
+ trailing: ExitToMyStackButton(
+ onPressed: () async {
+ await delete();
+ if (mounted) {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(DesktopHomeView.routeName),
+ );
+ }
+ },
+ ),
+ )
+ : AppBar(
+ leading: AppBarBackButton(
+ onPressed: () async {
+ Navigator.of(context).popUntil(
+ ModalRoute.withName(
+ NewWalletRecoveryPhraseView.routeName,
+ ),
+ );
+ },
+ ),
+ ),
+ body: SizedBox(
+ width: isDesktop ? 410 : null,
child: Padding(
- padding: const EdgeInsets.all(16),
+ padding:
+ isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- const SizedBox(
- height: 4,
+ SizedBox(
+ height: isDesktop ? 24 : 4,
),
Text(
"Verify recovery phrase",
textAlign: TextAlign.center,
- style: STextStyles.label.copyWith(
- fontSize: 12,
- ),
+ style: isDesktop
+ ? STextStyles.desktopH2
+ : STextStyles.label.copyWith(
+ fontSize: 12,
+ ),
),
- const SizedBox(
- height: 4,
+ SizedBox(
+ height: isDesktop ? 16 : 4,
),
Text(
- "Tap word number ",
+ isDesktop ? "Select word number" : "Tap word number ",
textAlign: TextAlign.center,
- style: STextStyles.pageTitleH1,
+ style: isDesktop
+ ? STextStyles.desktopSubtitleH1
+ : STextStyles.pageTitleH1,
),
- const SizedBox(
- height: 12,
+ SizedBox(
+ height: isDesktop ? 16 : 12,
),
Container(
decoration: BoxDecoration(
- color: CFColors.fieldGray,
+ color: StackTheme.instance.color.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius),
),
@@ -192,10 +284,19 @@ class _VerifyRecoveryPhraseViewState
),
),
),
+ if (isDesktop)
+ const SizedBox(
+ height: 40,
+ ),
WordTable(
words: randomize(_mnemonic, correctIndex, 9).item1,
+ isDesktop: isDesktop,
),
- const Spacer(),
+ if (!isDesktop) const Spacer(),
+ if (isDesktop)
+ const SizedBox(
+ height: 40,
+ ),
Row(
children: [
Expanded(
@@ -210,92 +311,33 @@ class _VerifyRecoveryPhraseViewState
verifyMnemonicCorrectWordStateProvider.state)
.state;
- return TextButton(
- onPressed: selectedWord.isNotEmpty
- ? () async {
- if (correctWord == selectedWord) {
- await ref
- .read(
- walletsServiceChangeNotifierProvider)
- .setMnemonicVerified(
- walletId: _manager.walletId,
- );
-
- ref
- .read(walletsChangeNotifierProvider
- .notifier)
- .addWallet(
- walletId: _manager.walletId,
- manager: _manager);
-
- if (mounted) {
- Navigator.of(context)
- .pushNamedAndRemoveUntil(
- HomeView.routeName,
- (route) => false);
- }
-
- showFloatingFlushBar(
- type: FlushBarType.success,
- message:
- "Correct! Your wallet is set up.",
- iconAsset: Assets.svg.check,
- context: context,
- );
- } else {
- showFloatingFlushBar(
- type: FlushBarType.warning,
- message: "Incorrect. Please try again.",
- iconAsset: Assets.svg.circleX,
- context: context,
- );
-
- final int next =
- Random().nextInt(_mnemonic.length);
- ref
- .read(
- verifyMnemonicWordIndexStateProvider
- .state)
- .update((state) => next);
-
- ref
- .read(
- verifyMnemonicCorrectWordStateProvider
- .state)
- .update((state) => _mnemonic[next]);
-
- ref
- .read(
- verifyMnemonicSelectedWordStateProvider
- .state)
- .update((state) => "");
+ return ConstrainedBox(
+ constraints: BoxConstraints(
+ minHeight: isDesktop ? 70 : 0,
+ ),
+ child: TextButton(
+ onPressed: selectedWord.isNotEmpty
+ ? () async {
+ await _continue(
+ correctWord == selectedWord);
}
- }
- : null,
- style: selectedWord.isNotEmpty
- ? Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
+ : null,
+ style: selectedWord.isNotEmpty
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(context),
+ child: isDesktop
+ ? Text(
+ "Verify",
+ style: selectedWord.isNotEmpty
+ ? STextStyles.desktopButtonEnabled
+ : STextStyles.desktopButtonDisabled,
)
- : Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent.withOpacity(
- 0.25,
- ),
- ),
+ : Text(
+ "Continue",
+ style: STextStyles.button,
),
- child: Text(
- "Continue",
- style: STextStyles.button,
),
);
},
diff --git a/lib/pages/address_book_views/address_book_view.dart b/lib/pages/address_book_views/address_book_view.dart
index 3266d5986..286971b97 100644
--- a/lib/pages/address_book_views/address_book_view.dart
+++ b/lib/pages/address_book_views/address_book_view.dart
@@ -9,10 +9,10 @@ import 'package:stackwallet/providers/global/address_book_service_provider.dart'
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/ui/address_book_providers/address_book_filter_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/address_book_card.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
@@ -102,7 +102,7 @@ class _AddressBookViewState extends ConsumerState {
addressBookServiceProvider.select((value) => value.addressBookEntries));
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
@@ -126,10 +126,10 @@ class _AddressBookViewState extends ConsumerState {
key: const Key("addressBookFilterViewButton"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
Assets.svg.filter,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
width: 20,
height: 20,
),
@@ -153,10 +153,10 @@ class _AddressBookViewState extends ConsumerState {
key: const Key("addressBookAddNewContactViewButton"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
Assets.svg.plus,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
width: 20,
height: 20,
),
diff --git a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart
index 9d0eede18..808a3bb48 100644
--- a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart
+++ b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart
@@ -11,10 +11,10 @@ import 'package:stackwallet/providers/ui/address_book_providers/contact_name_is_
import 'package:stackwallet/providers/ui/address_book_providers/valid_contact_state_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
-import 'package:stackwallet/utilities/cfcolors.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/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/emoji_select_sheet.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
@@ -93,7 +93,7 @@ class _AddAddressBookEntryViewState
debugPrint("BUILD: $runtimeType");
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -123,10 +123,12 @@ class _AddAddressBookEntryViewState
key: const Key("addAddressBookEntryFavoriteButtonKey"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
Assets.svg.star,
- color: _isFavorite ? CFColors.link2 : CFColors.buttonGray,
+ color: _isFavorite
+ ? StackTheme.instance.color.accentColorRed
+ : StackTheme.instance.color.buttonBackSecondary,
width: 20,
height: 20,
),
@@ -198,7 +200,8 @@ class _AddAddressBookEntryViewState
width: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
- color: CFColors.textFieldActive,
+ color: StackTheme
+ .instance.color.textFieldActiveBG,
),
child: Center(
child: _selectedEmoji == null
@@ -219,20 +222,22 @@ class _AddAddressBookEntryViewState
height: 14,
width: 14,
decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(14),
- color: CFColors.stackAccent,
- ),
+ borderRadius: BorderRadius.circular(14),
+ color: StackTheme
+ .instance.color.accentColorDark),
child: Center(
child: _selectedEmoji == null
? SvgPicture.asset(
Assets.svg.plus,
- color: CFColors.white,
+ color: StackTheme
+ .instance.color.textWhite,
width: 12,
height: 12,
)
: SvgPicture.asset(
Assets.svg.thickX,
- color: CFColors.white,
+ color: StackTheme
+ .instance.color.textWhite,
width: 8,
height: 8,
),
@@ -336,17 +341,13 @@ class _AddAddressBookEntryViewState
children: [
Expanded(
child: TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
- ),
+ color: StackTheme
+ .instance.color.accentColorDark),
),
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -380,13 +381,12 @@ class _AddAddressBookEntryViewState
validForms && nameExists;
return TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- shouldEnableSave
- ? CFColors.stackAccent
- : CFColors.disabledButton,
- )),
+ style: shouldEnableSave
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(
+ context),
onPressed: shouldEnableSave
? () async {
if (FocusScope.of(context).hasFocus) {
diff --git a/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart b/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart
index 50d03aef7..7c590878b 100644
--- a/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart
+++ b/lib/pages/address_book_views/subviews/add_new_contact_address_view.dart
@@ -9,9 +9,9 @@ import 'package:stackwallet/providers/ui/address_book_providers/address_entry_da
import 'package:stackwallet/providers/ui/address_book_providers/valid_contact_state_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
class AddNewContactAddressView extends ConsumerStatefulWidget {
@@ -56,7 +56,7 @@ class _AddNewContactAddressViewState
.select((value) => value.getContactById(contactId)));
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -99,7 +99,8 @@ class _AddNewContactAddressViewState
width: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
- color: CFColors.textFieldActive,
+ color:
+ StackTheme.instance.color.textFieldActiveBG,
),
child: Center(
child: contact.emojiChar == null
@@ -144,17 +145,13 @@ class _AddNewContactAddressViewState
children: [
Expanded(
child: TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
- ),
+ color: StackTheme
+ .instance.color.accentColorDark),
),
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -178,14 +175,13 @@ class _AddNewContactAddressViewState
ref.watch(validContactStateProvider([0]));
return TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- shouldEnableSave
- ? CFColors.stackAccent
- : CFColors.disabledButton,
- ),
- ),
+ style: shouldEnableSave
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(
+ context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(
+ context),
onPressed: shouldEnableSave
? () async {
if (FocusScope.of(context)
diff --git a/lib/pages/address_book_views/subviews/address_book_filter_view.dart b/lib/pages/address_book_views/subviews/address_book_filter_view.dart
index e990919de..91e3fcbcb 100644
--- a/lib/pages/address_book_views/subviews/address_book_filter_view.dart
+++ b/lib/pages/address_book_views/subviews/address_book_filter_view.dart
@@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/providers/ui/address_book_providers/address_book_filter_provider.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -42,9 +42,9 @@ class _AddressBookFilterViewState extends ConsumerState {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
leading: AppBarBackButton(
onPressed: () async {
Navigator.of(context).pop();
diff --git a/lib/pages/address_book_views/subviews/coin_select_sheet.dart b/lib/pages/address_book_views/subviews/coin_select_sheet.dart
index 5008a688f..a74bfda8d 100644
--- a/lib/pages/address_book_views/subviews/coin_select_sheet.dart
+++ b/lib/pages/address_book_views/subviews/coin_select_sheet.dart
@@ -3,10 +3,10 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/global/prefs_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
class CoinSelectSheet extends StatelessWidget {
const CoinSelectSheet({Key? key}) : super(key: key);
@@ -17,9 +17,9 @@ class CoinSelectSheet extends StatelessWidget {
var coins_ = [...Coin.values];
coins_.remove(Coin.firoTestNet);
return Container(
- decoration: const BoxDecoration(
- color: CFColors.white,
- borderRadius: BorderRadius.vertical(
+ decoration: BoxDecoration(
+ color: StackTheme.instance.color.popupBG,
+ borderRadius: const BorderRadius.vertical(
top: Radius.circular(20),
),
),
@@ -39,7 +39,7 @@ class CoinSelectSheet extends StatelessWidget {
Center(
child: Container(
decoration: BoxDecoration(
- color: CFColors.fieldGray,
+ color: StackTheme.instance.color.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
@@ -77,7 +77,7 @@ class CoinSelectSheet extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4),
child: RawMaterialButton(
- // splashColor: CFColors.splashLight,
+ // splashColor: StackTheme.instance.color.highlight,
onPressed: () {
Navigator.of(context).pop(coin);
},
diff --git a/lib/pages/address_book_views/subviews/contact_details_view.dart b/lib/pages/address_book_views/subviews/contact_details_view.dart
index c22b1faa8..b74d9d693 100644
--- a/lib/pages/address_book_views/subviews/contact_details_view.dart
+++ b/lib/pages/address_book_views/subviews/contact_details_view.dart
@@ -13,11 +13,11 @@ import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/providers/ui/address_book_providers/address_entry_data_provider.dart';
import 'package:stackwallet/services/coins/manager.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
@@ -105,7 +105,7 @@ class _ContactDetailsViewState extends ConsumerState {
.select((value) => value.getContactById(_contactId)));
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
@@ -129,12 +129,12 @@ class _ContactDetailsViewState extends ConsumerState {
key: const Key("contactDetails"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
Assets.svg.star,
color: _contact.isFavorite
- ? CFColors.link2
- : CFColors.buttonGray,
+ ? StackTheme.instance.color.infoItemIcons
+ : StackTheme.instance.color.buttonBackSecondary,
width: 20,
height: 20,
),
@@ -160,10 +160,10 @@ class _ContactDetailsViewState extends ConsumerState {
key: const Key("contactDetailsViewDeleteContactButtonKey"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
Assets.svg.trash,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
width: 20,
height: 20,
),
@@ -176,14 +176,8 @@ class _ContactDetailsViewState extends ConsumerState {
title: "Delete ${_contact.name}?",
message: "Contact will be deleted permanently!",
leftButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.itemSubtitle12,
@@ -193,14 +187,8 @@ class _ContactDetailsViewState extends ConsumerState {
},
),
rightButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
child: Text(
"Delete",
style: STextStyles.button,
@@ -246,7 +234,7 @@ class _ContactDetailsViewState extends ConsumerState {
width: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
- color: CFColors.textFieldActive,
+ color: StackTheme.instance.color.textFieldActiveBG,
),
child: Center(
child: _contact.emojiChar == null
@@ -280,23 +268,21 @@ class _ContactDetailsViewState extends ConsumerState {
arguments: _contact.id,
);
},
- style: ButtonStyle(
- minimumSize:
- MaterialStateProperty.all(const Size(46, 32)),
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context)!
+ .copyWith(
+ minimumSize: MaterialStateProperty.all(
+ const Size(46, 32)),
+ ),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Row(
children: [
- SvgPicture.asset(
- Assets.svg.pencil,
- width: 10,
- height: 10,
- color: CFColors.stackAccent,
- ),
+ SvgPicture.asset(Assets.svg.pencil,
+ width: 10,
+ height: 10,
+ color:
+ StackTheme.instance.color.accentColorDark),
const SizedBox(
width: 4,
),
@@ -391,14 +377,14 @@ class _ContactDetailsViewState extends ConsumerState {
);
},
child: RoundedContainer(
- color: CFColors.fieldGray,
+ color: StackTheme
+ .instance.color.textFieldDefaultBG,
padding: const EdgeInsets.all(4),
- child: SvgPicture.asset(
- Assets.svg.pencil,
- width: 12,
- height: 12,
- color: CFColors.stackAccent,
- ),
+ child: SvgPicture.asset(Assets.svg.pencil,
+ width: 12,
+ height: 12,
+ color: StackTheme
+ .instance.color.accentColorDark),
),
),
const SizedBox(
@@ -417,14 +403,14 @@ class _ContactDetailsViewState extends ConsumerState {
);
},
child: RoundedContainer(
- color: CFColors.fieldGray,
+ color: StackTheme
+ .instance.color.textFieldDefaultBG,
padding: const EdgeInsets.all(4),
- child: SvgPicture.asset(
- Assets.svg.copy,
- width: 12,
- height: 12,
- color: CFColors.stackAccent,
- ),
+ child: SvgPicture.asset(Assets.svg.copy,
+ width: 12,
+ height: 12,
+ color: StackTheme
+ .instance.color.accentColorDark),
),
),
],
diff --git a/lib/pages/address_book_views/subviews/contact_popup.dart b/lib/pages/address_book_views/subviews/contact_popup.dart
index b1a926e33..b8e1e735a 100644
--- a/lib/pages/address_book_views/subviews/contact_popup.dart
+++ b/lib/pages/address_book_views/subviews/contact_popup.dart
@@ -10,11 +10,11 @@ import 'package:stackwallet/providers/exchange/exchange_flow_is_active_state_pro
import 'package:stackwallet/providers/global/address_book_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:tuple/tuple.dart';
@@ -71,7 +71,7 @@ class ContactPopUp extends ConsumerWidget {
),
child: Container(
decoration: BoxDecoration(
- color: CFColors.white,
+ color: StackTheme.instance.color.popupBG,
borderRadius: BorderRadius.circular(
20,
),
@@ -98,7 +98,8 @@ class ContactPopUp extends ConsumerWidget {
width: 32,
height: 32,
decoration: BoxDecoration(
- color: CFColors.contactIconBackground,
+ color: StackTheme
+ .instance.color.textFieldDefaultBG,
borderRadius: BorderRadius.circular(32),
),
child: contact.id == "default"
@@ -138,15 +139,14 @@ class ContactPopUp extends ConsumerWidget {
arguments: contact.id,
);
},
- style: ButtonStyle(
- minimumSize:
- MaterialStateProperty.all(
- const Size(46, 32)),
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(
+ context)!
+ .copyWith(
+ minimumSize:
+ MaterialStateProperty.all<
+ Size>(const Size(46, 32)),
+ ),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: 18),
@@ -162,7 +162,7 @@ class ContactPopUp extends ConsumerWidget {
),
Container(
height: 1,
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
),
if (addresses.isEmpty)
Padding(
@@ -254,14 +254,15 @@ class ContactPopUp extends ConsumerWidget {
);
},
child: RoundedContainer(
- color: CFColors.fieldGray,
+ color: StackTheme.instance.color
+ .textFieldDefaultBG,
padding: const EdgeInsets.all(4),
child: SvgPicture.asset(
- Assets.svg.copy,
- width: 12,
- height: 12,
- color: CFColors.stackAccent,
- ),
+ Assets.svg.copy,
+ width: 12,
+ height: 12,
+ color: StackTheme.instance
+ .color.accentColorDark),
),
),
],
@@ -304,15 +305,17 @@ class ContactPopUp extends ConsumerWidget {
}
},
child: RoundedContainer(
- color: CFColors.fieldGray,
+ color: StackTheme.instance.color
+ .textFieldDefaultBG,
padding:
const EdgeInsets.all(4),
child: SvgPicture.asset(
- Assets.svg.circleArrowUpRight,
- width: 12,
- height: 12,
- color: CFColors.stackAccent,
- ),
+ Assets
+ .svg.circleArrowUpRight,
+ width: 12,
+ height: 12,
+ color: StackTheme.instance
+ .color.accentColorDark),
),
),
],
diff --git a/lib/pages/address_book_views/subviews/edit_contact_address_view.dart b/lib/pages/address_book_views/subviews/edit_contact_address_view.dart
index fc67f064c..fb4527f27 100644
--- a/lib/pages/address_book_views/subviews/edit_contact_address_view.dart
+++ b/lib/pages/address_book_views/subviews/edit_contact_address_view.dart
@@ -9,9 +9,9 @@ import 'package:stackwallet/providers/ui/address_book_providers/address_entry_da
import 'package:stackwallet/providers/ui/address_book_providers/valid_contact_state_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
class EditContactAddressView extends ConsumerStatefulWidget {
@@ -60,7 +60,7 @@ class _EditContactAddressViewState
.select((value) => value.getContactById(contactId)));
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -103,7 +103,8 @@ class _EditContactAddressViewState
width: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
- color: CFColors.textFieldActive,
+ color:
+ StackTheme.instance.color.textFieldActiveBG,
),
child: Center(
child: contact.emojiChar == null
@@ -179,17 +180,13 @@ class _EditContactAddressViewState
children: [
Expanded(
child: TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
- ),
+ color: StackTheme
+ .instance.color.accentColorDark),
),
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -213,14 +210,13 @@ class _EditContactAddressViewState
ref.watch(validContactStateProvider([0]));
return TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- shouldEnableSave
- ? CFColors.stackAccent
- : CFColors.disabledButton,
- ),
- ),
+ style: shouldEnableSave
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(
+ context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(
+ context),
onPressed: shouldEnableSave
? () async {
if (FocusScope.of(context)
diff --git a/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart b/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart
index d8c4f7708..bc9b2a5b2 100644
--- a/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart
+++ b/lib/pages/address_book_views/subviews/edit_contact_name_emoji_view.dart
@@ -4,9 +4,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/providers/global/address_book_service_provider.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/emoji_select_sheet.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
@@ -68,7 +68,7 @@ class _EditContactNameEmojiViewState
.select((value) => value.getContactById(contactId)));
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -139,7 +139,8 @@ class _EditContactNameEmojiViewState
width: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
- color: CFColors.textFieldActive,
+ color: StackTheme
+ .instance.color.textFieldActiveBG,
),
child: Center(
child: _selectedEmoji == null
@@ -160,20 +161,22 @@ class _EditContactNameEmojiViewState
height: 14,
width: 14,
decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(14),
- color: CFColors.stackAccent,
- ),
+ borderRadius: BorderRadius.circular(14),
+ color: StackTheme
+ .instance.color.accentColorDark),
child: Center(
child: _selectedEmoji == null
? SvgPicture.asset(
Assets.svg.plus,
- color: CFColors.white,
+ color: StackTheme
+ .instance.color.textWhite,
width: 12,
height: 12,
)
: SvgPicture.asset(
Assets.svg.thickX,
- color: CFColors.white,
+ color: StackTheme
+ .instance.color.textWhite,
width: 8,
height: 8,
),
@@ -230,17 +233,13 @@ class _EditContactNameEmojiViewState
children: [
Expanded(
child: TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Cancel",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
- ),
+ color: StackTheme
+ .instance.color.accentColorDark),
),
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -264,14 +263,13 @@ class _EditContactNameEmojiViewState
nameController.text.isNotEmpty;
return TextButton(
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all(
- shouldEnableSave
- ? CFColors.stackAccent
- : CFColors.disabledButton,
- ),
- ),
+ style: shouldEnableSave
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(
+ context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(
+ context),
onPressed: shouldEnableSave
? () async {
if (FocusScope.of(context)
diff --git a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart
index 568222870..4736b20c5 100644
--- a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart
+++ b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart
@@ -8,12 +8,13 @@ import 'package:stackwallet/providers/ui/address_book_providers/address_entry_da
import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
import 'package:stackwallet/widgets/icon_widgets/qrcode_icon.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
@@ -80,7 +81,7 @@ class _NewContactAddressEntryFormState
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: RawMaterialButton(
- splashColor: CFColors.splashLight,
+ splashColor: StackTheme.instance.color.highlight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
@@ -134,7 +135,7 @@ class _NewContactAddressEntryFormState
Assets.svg.chevronDown,
width: 8,
height: 4,
- color: CFColors.gray3,
+ color: StackTheme.instance.color.textSubtitle2,
),
],
),
@@ -352,7 +353,7 @@ class _NewContactAddressEntryFormState
"Invalid address",
textAlign: TextAlign.left,
style: STextStyles.label.copyWith(
- color: CFColors.notificationRedForeground,
+ color: StackTheme.instance.color.textError,
),
),
],
diff --git a/lib/pages/exchange_view/confirm_change_now_send.dart b/lib/pages/exchange_view/confirm_change_now_send.dart
index dc15457e2..5209d6fd6 100644
--- a/lib/pages/exchange_view/confirm_change_now_send.dart
+++ b/lib/pages/exchange_view/confirm_change_now_send.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart';
@@ -8,10 +10,10 @@ import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/route_generator.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -47,14 +49,14 @@ class _ConfirmChangeNowSendViewState
late final ExchangeTransaction trade;
Future _attemptSend(BuildContext context) async {
- showDialog(
+ unawaited(showDialog(
context: context,
useSafeArea: false,
barrierDismissible: false,
builder: (context) {
return const SendingTransactionDialog();
},
- );
+ ));
final String note = transactionInfo["note"] as String? ?? "";
final manager =
@@ -62,10 +64,10 @@ class _ConfirmChangeNowSendViewState
try {
final txid = await manager.confirmSend(txData: transactionInfo);
- manager.refresh();
+ unawaited(manager.refresh());
// save note
- ref
+ await ref
.read(notesServiceChangeNotifierProvider(walletId))
.editOrAddNote(txid: txid, note: note);
@@ -86,7 +88,7 @@ class _ConfirmChangeNowSendViewState
// pop sending dialog
Navigator.of(context).pop();
- showDialog(
+ await showDialog(
context: context,
useSafeArea: false,
barrierDismissible: true,
@@ -95,15 +97,12 @@ class _ConfirmChangeNowSendViewState
title: "Broadcast transaction failed",
message: e.toString(),
rightButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style:
+ StackTheme.instance.getSecondaryEnabledButtonColor(context),
child: Text(
"Ok",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.buttonTextSecondary,
),
),
onPressed: () {
@@ -131,7 +130,7 @@ class _ConfirmChangeNowSendViewState
.select((value) => value.getManagerProvider(walletId)));
return Scaffold(
appBar: AppBar(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
leading: AppBarBackButton(
onPressed: () async {
// if (FocusScope.of(context).hasFocus) {
@@ -317,7 +316,7 @@ class _ConfirmChangeNowSendViewState
height: 12,
),
RoundedContainer(
- color: CFColors.stackGreen15,
+ color: StackTheme.instance.color.snackBarBackSuccess,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@@ -348,13 +347,8 @@ class _ConfirmChangeNowSendViewState
),
const Spacer(),
TextButton(
- style:
- Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
onPressed: () async {
final unlocked = await Navigator.push(
context,
@@ -378,7 +372,7 @@ class _ConfirmChangeNowSendViewState
);
if (unlocked is bool && unlocked && mounted) {
- _attemptSend(context);
+ await _attemptSend(context);
}
},
child: Text(
diff --git a/lib/pages/exchange_view/edit_trade_note_view.dart b/lib/pages/exchange_view/edit_trade_note_view.dart
index 457b0e6bc..db166b01c 100644
--- a/lib/pages/exchange_view/edit_trade_note_view.dart
+++ b/lib/pages/exchange_view/edit_trade_note_view.dart
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/exchange/trade_note_service_provider.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/stack_text_field.dart';
@@ -46,9 +46,9 @@ class _EditNoteViewState extends ConsumerState {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
leading: AppBarBackButton(
onPressed: () async {
if (FocusScope.of(context).hasFocus) {
@@ -126,13 +126,8 @@ class _EditNoteViewState extends ConsumerState {
Navigator.of(context).pop();
}
},
- style:
- Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
child: Text(
"Save",
style: STextStyles.button,
diff --git a/lib/pages/exchange_view/exchange_coin_selection/fixed_rate_pair_coin_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/fixed_rate_pair_coin_selection_view.dart
index 7741d1d54..f660e362e 100644
--- a/lib/pages/exchange_view/exchange_coin_selection/fixed_rate_pair_coin_selection_view.dart
+++ b/lib/pages/exchange_view/exchange_coin_selection/fixed_rate_pair_coin_selection_view.dart
@@ -4,10 +4,10 @@ import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/exchange/change_now/currency.dart';
import 'package:stackwallet/models/exchange/change_now/fixed_rate_market.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
@@ -119,7 +119,7 @@ class _FixedRateMarketPairCoinSelectionViewState
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -232,12 +232,12 @@ class _FixedRateMarketPairCoinSelectionViewState
child: Row(
children: [
SizedBox(
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
child: SvgPicture.network(
tuple.item1,
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
),
@@ -245,9 +245,26 @@ class _FixedRateMarketPairCoinSelectionViewState
const SizedBox(
width: 10,
),
- Text(
- "${tuple.item2} / ${ticker.toUpperCase()}",
- style: STextStyles.titleBold12,
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ tuple.item2,
+ style: STextStyles.largeMedium14,
+ ),
+ const SizedBox(
+ height: 2,
+ ),
+ Text(
+ ticker.toUpperCase(),
+ style: STextStyles.smallMed12.copyWith(
+ color: StackTheme
+ .instance.color.textSubtitle1,
+ ),
+ ),
+ ],
+ ),
),
],
),
@@ -289,12 +306,12 @@ class _FixedRateMarketPairCoinSelectionViewState
child: Row(
children: [
SizedBox(
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
child: SvgPicture.network(
tuple.item1,
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
),
@@ -302,9 +319,26 @@ class _FixedRateMarketPairCoinSelectionViewState
const SizedBox(
width: 10,
),
- Text(
- "${tuple.item2} / ${ticker.toUpperCase()}",
- style: STextStyles.titleBold12,
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ tuple.item2,
+ style: STextStyles.largeMedium14,
+ ),
+ const SizedBox(
+ height: 2,
+ ),
+ Text(
+ ticker.toUpperCase(),
+ style: STextStyles.smallMed12.copyWith(
+ color: StackTheme
+ .instance.color.textSubtitle1,
+ ),
+ ),
+ ],
+ ),
),
],
),
diff --git a/lib/pages/exchange_view/exchange_coin_selection/floating_rate_currency_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/floating_rate_currency_selection_view.dart
index 94f7c039b..522e0e041 100644
--- a/lib/pages/exchange_view/exchange_coin_selection/floating_rate_currency_selection_view.dart
+++ b/lib/pages/exchange_view/exchange_coin_selection/floating_rate_currency_selection_view.dart
@@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/models/exchange/change_now/currency.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
@@ -75,7 +75,7 @@ class _FloatingRateCurrencySelectionViewState
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -139,6 +139,7 @@ class _FloatingRateCurrencySelectionViewState
setState(() {
_searchController.text = "";
});
+ filter("");
},
),
],
@@ -183,12 +184,12 @@ class _FloatingRateCurrencySelectionViewState
child: Row(
children: [
SizedBox(
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
child: SvgPicture.network(
items[index].image,
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
),
@@ -196,9 +197,26 @@ class _FloatingRateCurrencySelectionViewState
const SizedBox(
width: 10,
),
- Text(
- "${items[index].name} / ${items[index].ticker.toUpperCase()}",
- style: STextStyles.titleBold12,
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ items[index].name,
+ style: STextStyles.largeMedium14,
+ ),
+ const SizedBox(
+ height: 2,
+ ),
+ Text(
+ items[index].ticker.toUpperCase(),
+ style: STextStyles.smallMed12.copyWith(
+ color: StackTheme
+ .instance.color.textSubtitle1,
+ ),
+ ),
+ ],
+ ),
),
],
),
@@ -236,12 +254,12 @@ class _FloatingRateCurrencySelectionViewState
child: Row(
children: [
SizedBox(
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
child: SvgPicture.network(
_currencies[index].image,
- width: 20,
- height: 20,
+ width: 24,
+ height: 24,
placeholderBuilder: (_) =>
const LoadingIndicator(),
),
@@ -249,9 +267,26 @@ class _FloatingRateCurrencySelectionViewState
const SizedBox(
width: 10,
),
- Text(
- "${_currencies[index].name} / ${_currencies[index].ticker.toUpperCase()}",
- style: STextStyles.titleBold12,
+ Expanded(
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ _currencies[index].name,
+ style: STextStyles.largeMedium14,
+ ),
+ const SizedBox(
+ height: 2,
+ ),
+ Text(
+ _currencies[index].ticker.toUpperCase(),
+ style: STextStyles.smallMed12.copyWith(
+ color: StackTheme
+ .instance.color.textSubtitle1,
+ ),
+ ),
+ ],
+ ),
),
],
),
diff --git a/lib/pages/exchange_view/exchange_loading_overlay.dart b/lib/pages/exchange_view/exchange_loading_overlay.dart
index 28484022a..ad05fea5a 100644
--- a/lib/pages/exchange_view/exchange_loading_overlay.dart
+++ b/lib/pages/exchange_view/exchange_loading_overlay.dart
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/exchange/changenow_initial_load_status.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@@ -65,7 +65,7 @@ class _ExchangeLoadingOverlayViewState
if (_statusEst == ChangeNowLoadStatus.loading ||
(_statusFixed == ChangeNowLoadStatus.loading && userReloaded))
Container(
- color: CFColors.stackAccent.withOpacity(0.7),
+ color: StackTheme.instance.color.overlay.withOpacity(0.7),
child: const CustomLoadingOverlay(
message: "Loading ChangeNOW data", eventBus: null),
),
@@ -74,7 +74,7 @@ class _ExchangeLoadingOverlayViewState
_statusEst != ChangeNowLoadStatus.loading &&
_statusFixed != ChangeNowLoadStatus.loading)
Container(
- color: CFColors.stackAccent.withOpacity(0.7),
+ color: StackTheme.instance.color.overlay.withOpacity(0.7),
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
@@ -83,10 +83,13 @@ class _ExchangeLoadingOverlayViewState
message:
"ChangeNOW requires a working internet connection. Tap OK to try fetching again.",
rightButton: TextButton(
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"OK",
- style: STextStyles.button
- .copyWith(color: CFColors.stackAccent),
+ style: STextStyles.button.copyWith(
+ color: StackTheme.instance.color.buttonTextSecondary,
+ ),
),
onPressed: () {
userReloaded = true;
diff --git a/lib/pages/exchange_view/exchange_step_views/step_1_view.dart b/lib/pages/exchange_view/exchange_step_views/step_1_view.dart
index 32a5a4205..072c4b536 100644
--- a/lib/pages/exchange_view/exchange_step_views/step_1_view.dart
+++ b/lib/pages/exchange_view/exchange_step_views/step_1_view.dart
@@ -3,9 +3,9 @@ import 'package:stackwallet/models/exchange/incomplete_exchange.dart';
import 'package:stackwallet/pages/exchange_view/exchange_step_views/step_2_view.dart';
import 'package:stackwallet/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart';
import 'package:stackwallet/pages/exchange_view/sub_widgets/step_row.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -40,7 +40,7 @@ class _Step1ViewState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -102,11 +102,15 @@ class _Step1ViewState extends State {
children: [
Text(
"You send",
- style: STextStyles.itemSubtitle,
+ style: STextStyles.itemSubtitle.copyWith(
+ color:
+ StackTheme.instance.color.infoItemText),
),
Text(
- "${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker}",
- style: STextStyles.itemSubtitle12,
+ "${model.sendAmount.toStringAsFixed(8)} ${model.sendTicker.toUpperCase()}",
+ style: STextStyles.itemSubtitle12.copyWith(
+ color:
+ StackTheme.instance.color.infoItemText),
),
],
),
@@ -120,11 +124,15 @@ class _Step1ViewState extends State {
children: [
Text(
"You receive",
- style: STextStyles.itemSubtitle,
+ style: STextStyles.itemSubtitle.copyWith(
+ color:
+ StackTheme.instance.color.infoItemText),
),
Text(
- "~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker}",
- style: STextStyles.itemSubtitle12,
+ "~${model.receiveAmount.toStringAsFixed(8)} ${model.receiveTicker.toUpperCase()}",
+ style: STextStyles.itemSubtitle12.copyWith(
+ color:
+ StackTheme.instance.color.infoItemText),
),
],
),
@@ -140,11 +148,16 @@ class _Step1ViewState extends State {
model.rateType == ExchangeRateType.estimated
? "Estimated rate"
: "Fixed rate",
- style: STextStyles.itemSubtitle,
+ style: STextStyles.itemSubtitle.copyWith(
+ color:
+ StackTheme.instance.color.infoItemLabel,
+ ),
),
Text(
model.rateInfo,
- style: STextStyles.itemSubtitle12,
+ style: STextStyles.itemSubtitle12.copyWith(
+ color:
+ StackTheme.instance.color.infoItemText),
),
],
),
@@ -158,13 +171,8 @@ class _Step1ViewState extends State {
Navigator.of(context).pushNamed(Step2View.routeName,
arguments: model);
},
- style:
- Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
child: Text(
"Next",
style: STextStyles.button,
diff --git a/lib/pages/exchange_view/exchange_step_views/step_2_view.dart b/lib/pages/exchange_view/exchange_step_views/step_2_view.dart
index 57e10f0eb..131242b98 100644
--- a/lib/pages/exchange_view/exchange_step_views/step_2_view.dart
+++ b/lib/pages/exchange_view/exchange_step_views/step_2_view.dart
@@ -10,12 +10,12 @@ import 'package:stackwallet/providers/exchange/exchange_send_from_wallet_id_prov
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/address_utils.dart';
import 'package:stackwallet/utilities/barcode_scanner_interface.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/icon_widgets/addressbook_icon.dart';
import 'package:stackwallet/widgets/icon_widgets/clipboard_icon.dart';
@@ -95,7 +95,7 @@ class _Step2ViewState extends ConsumerState {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -156,9 +156,7 @@ class _Step2ViewState extends ConsumerState {
children: [
Text(
"Recipient Wallet",
- style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
- ),
+ style: STextStyles.smallMed12,
),
// GestureDetector(
// onTap: () {
@@ -198,7 +196,7 @@ class _Step2ViewState extends ConsumerState {
focusNode: _toFocusNode,
style: STextStyles.field,
decoration: standardInputDecoration(
- "Enter the ${model.receiveTicker} payout address",
+ "Enter the ${model.receiveTicker.toUpperCase()} payout address",
_toFocusNode,
).copyWith(
contentPadding: const EdgeInsets.only(
@@ -335,7 +333,7 @@ class _Step2ViewState extends ConsumerState {
),
RoundedWhiteContainer(
child: Text(
- "This is the wallet where your ${model.receiveTicker} will be sent to.",
+ "This is the wallet where your ${model.receiveTicker.toUpperCase()} will be sent to.",
style: STextStyles.label,
),
),
@@ -386,7 +384,7 @@ class _Step2ViewState extends ConsumerState {
focusNode: _refundFocusNode,
style: STextStyles.field,
decoration: standardInputDecoration(
- "Enter ${model.sendTicker} refund address",
+ "Enter ${model.sendTicker.toUpperCase()} refund address",
_refundFocusNode,
).copyWith(
contentPadding: const EdgeInsets.only(
@@ -537,10 +535,13 @@ class _Step2ViewState extends ConsumerState {
onPressed: () {
Navigator.of(context).pop();
},
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Back",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme
+ .instance.color.buttonTextSecondary,
),
),
),
@@ -558,15 +559,8 @@ class _Step2ViewState extends ConsumerState {
Step3View.routeName,
arguments: model);
},
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
child: Text(
"Next",
style: STextStyles.button,
diff --git a/lib/pages/exchange_view/exchange_step_views/step_3_view.dart b/lib/pages/exchange_view/exchange_step_views/step_3_view.dart
index a0c79343f..a8116dd42 100644
--- a/lib/pages/exchange_view/exchange_step_views/step_3_view.dart
+++ b/lib/pages/exchange_view/exchange_step_views/step_3_view.dart
@@ -12,9 +12,9 @@ import 'package:stackwallet/providers/exchange/change_now_provider.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/services/notifications_api.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@@ -50,7 +50,7 @@ class _Step3ViewState extends ConsumerState {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -108,7 +108,7 @@ class _Step3ViewState extends ConsumerState {
),
const Spacer(),
Text(
- "${model.sendAmount.toString()} ${model.sendTicker}",
+ "${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12,
)
],
@@ -126,7 +126,7 @@ class _Step3ViewState extends ConsumerState {
),
const Spacer(),
Text(
- "${model.receiveAmount.toString()} ${model.receiveTicker}",
+ "${model.receiveAmount.toString()} ${model.receiveTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12,
)
],
@@ -158,7 +158,7 @@ class _Step3ViewState extends ConsumerState {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "Recipient ${model.receiveTicker} address",
+ "Recipient ${model.receiveTicker.toUpperCase()} address",
style: STextStyles.itemSubtitle,
),
const SizedBox(
@@ -179,7 +179,7 @@ class _Step3ViewState extends ConsumerState {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- "Refund ${model.sendTicker} address",
+ "Refund ${model.sendTicker.toUpperCase()} address",
style: STextStyles.itemSubtitle,
),
const SizedBox(
@@ -203,10 +203,13 @@ class _Step3ViewState extends ConsumerState {
onPressed: () {
Navigator.of(context).pop();
},
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Back",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme
+ .instance.color.buttonTextSecondary,
),
),
),
@@ -303,15 +306,8 @@ class _Step3ViewState extends ConsumerState {
));
}
},
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
child: Text(
"Next",
style: STextStyles.button,
diff --git a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart
index 91c3f1a6d..b94f29cbe 100644
--- a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart
+++ b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart
@@ -18,13 +18,13 @@ import 'package:stackwallet/providers/exchange/exchange_send_from_wallet_id_prov
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -114,7 +114,7 @@ class _Step4ViewState extends ConsumerState {
final bool isWalletCoin =
_isWalletCoinAndHasWallet(model.trade!.fromCurrency, ref);
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -157,27 +157,27 @@ class _Step4ViewState extends ConsumerState {
height: 14,
),
Text(
- "Send ${model.sendTicker} to the address below",
+ "Send ${model.sendTicker.toUpperCase()} to the address below",
style: STextStyles.pageTitleH1,
),
const SizedBox(
height: 8,
),
Text(
- "Send ${model.sendTicker} to the address below. Once it is received, ChangeNOW will send the ${model.receiveTicker} to the recipient address you provided. You can find this trade details and check its status in the list of trades.",
+ "Send ${model.sendTicker.toUpperCase()} to the address below. Once it is received, ChangeNOW will send the ${model.receiveTicker.toUpperCase()} to the recipient address you provided. You can find this trade details and check its status in the list of trades.",
style: STextStyles.itemSubtitle,
),
const SizedBox(
height: 12,
),
RoundedContainer(
- color: CFColors.warningBackground,
+ color: StackTheme.instance.color.warningBackground,
child: RichText(
text: TextSpan(
text:
"You must send at least ${model.sendAmount.toString()} ${model.sendTicker}. ",
style: STextStyles.label.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.textDark,
fontWeight: FontWeight.w700,
),
children: [
@@ -185,7 +185,7 @@ class _Step4ViewState extends ConsumerState {
text:
"If you send less than ${model.sendAmount.toString()} ${model.sendTicker}, your transaction may not be converted and it may not be refunded.",
style: STextStyles.label.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.textDark,
fontWeight: FontWeight.w500,
),
),
@@ -206,9 +206,7 @@ class _Step4ViewState extends ConsumerState {
children: [
Text(
"Amount",
- style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
- ),
+ style: STextStyles.itemSubtitle,
),
GestureDetector(
onTap: () async {
@@ -225,7 +223,8 @@ class _Step4ViewState extends ConsumerState {
children: [
SvgPicture.asset(
Assets.svg.copy,
- color: CFColors.link2,
+ color: StackTheme
+ .instance.color.infoItemIcons,
width: 10,
),
const SizedBox(
@@ -244,7 +243,7 @@ class _Step4ViewState extends ConsumerState {
height: 4,
),
Text(
- "${model.sendAmount.toString()} ${model.sendTicker}",
+ "${model.sendAmount.toString()} ${model.sendTicker.toUpperCase()}",
style: STextStyles.itemSubtitle12,
),
],
@@ -262,10 +261,8 @@ class _Step4ViewState extends ConsumerState {
MainAxisAlignment.spaceBetween,
children: [
Text(
- "Send ${model.sendTicker} to this address",
- style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
- ),
+ "Send ${model.sendTicker.toUpperCase()} to this address",
+ style: STextStyles.itemSubtitle,
),
GestureDetector(
onTap: () async {
@@ -282,7 +279,8 @@ class _Step4ViewState extends ConsumerState {
children: [
SvgPicture.asset(
Assets.svg.copy,
- color: CFColors.link2,
+ color: StackTheme
+ .instance.color.infoItemIcons,
width: 10,
),
const SizedBox(
@@ -340,7 +338,8 @@ class _Step4ViewState extends ConsumerState {
},
child: SvgPicture.asset(
Assets.svg.copy,
- color: CFColors.link2,
+ color: StackTheme
+ .instance.color.infoItemIcons,
width: 12,
),
)
@@ -358,14 +357,13 @@ class _Step4ViewState extends ConsumerState {
children: [
Text(
"Status",
- style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
- ),
+ style: STextStyles.itemSubtitle,
),
Text(
_statusString,
style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.status.forStatus(_status),
+ color: StackTheme.instance
+ .colorForStatus(_status),
),
),
],
@@ -405,7 +403,8 @@ class _Step4ViewState extends ConsumerState {
.size
.width /
2,
- foregroundColor: CFColors.stackAccent,
+ foregroundColor: StackTheme
+ .instance.color.accentColorDark,
),
),
const SizedBox(
@@ -418,11 +417,17 @@ class _Step4ViewState extends ConsumerState {
child: TextButton(
onPressed: () =>
Navigator.of(context).pop(),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(
+ context),
child: Text(
"Cancel",
style:
STextStyles.button.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme
+ .instance
+ .color
+ .buttonTextSecondary,
),
),
),
@@ -435,13 +440,8 @@ class _Step4ViewState extends ConsumerState {
},
);
},
- style:
- Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(context),
child: Text(
"Show QR Code",
style: STextStyles.button,
@@ -562,22 +562,17 @@ class _Step4ViewState extends ConsumerState {
title: "Transaction failed",
message: e.toString(),
rightButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty
- .all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(
+ context),
child: Text(
"Ok",
style: STextStyles.button
.copyWith(
- color:
- CFColors.stackAccent,
+ color: StackTheme
+ .instance
+ .color
+ .buttonTextSecondary,
),
),
onPressed: () {
@@ -614,10 +609,13 @@ class _Step4ViewState extends ConsumerState {
),
);
},
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
buttonTitle,
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme
+ .instance.color.buttonTextSecondary,
),
),
);
diff --git a/lib/pages/exchange_view/exchange_view.dart b/lib/pages/exchange_view/exchange_view.dart
index b95315359..4222fa665 100644
--- a/lib/pages/exchange_view/exchange_view.dart
+++ b/lib/pages/exchange_view/exchange_view.dart
@@ -29,10 +29,10 @@ import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_prov
import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@@ -66,7 +66,7 @@ class _ExchangeViewState extends ConsumerState {
builder: (_) => WillPopScope(
onWillPop: () async => false,
child: Container(
- color: CFColors.stackAccent.withOpacity(0.8),
+ color: StackTheme.instance.color.overlay.withOpacity(0.8),
child: const CustomLoadingOverlay(
message: "Updating exchange rate",
eventBus: null,
@@ -367,7 +367,7 @@ class _ExchangeViewState extends ConsumerState {
Text(
"You will send",
style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
+ color: StackTheme.instance.color.textDark3,
),
),
const SizedBox(
@@ -561,7 +561,10 @@ class _ExchangeViewState extends ConsumerState {
width: 18,
height: 18,
decoration: BoxDecoration(
- color: CFColors.gray3,
+ color: StackTheme
+ .instance
+ .color
+ .textFieldDefaultBG,
borderRadius:
BorderRadius.circular(
18,
@@ -583,7 +586,7 @@ class _ExchangeViewState extends ConsumerState {
width: 18,
height: 18,
decoration: BoxDecoration(
- // color: CFColors.stackAccent,
+ // color: StackTheme.instance.color.accentColorDark
borderRadius:
BorderRadius.circular(18),
),
@@ -591,7 +594,8 @@ class _ExchangeViewState extends ConsumerState {
Assets.svg.circleQuestion,
width: 18,
height: 18,
- color: CFColors.gray3,
+ color: StackTheme.instance
+ .color.textFieldDefaultBG,
),
);
}
@@ -616,7 +620,8 @@ class _ExchangeViewState extends ConsumerState {
.toUpperCase())) ??
"-",
style: STextStyles.smallMed14.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme
+ .instance.color.textDark,
),
),
const SizedBox(
@@ -626,7 +631,8 @@ class _ExchangeViewState extends ConsumerState {
Assets.svg.chevronDown,
width: 5,
height: 2.5,
- color: CFColors.stackAccent,
+ color:
+ StackTheme.instance.color.textDark,
),
],
),
@@ -647,7 +653,7 @@ class _ExchangeViewState extends ConsumerState {
child: Text(
"You will receive",
style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
+ color: StackTheme.instance.color.textDark3,
),
),
),
@@ -663,6 +669,8 @@ class _ExchangeViewState extends ConsumerState {
Assets.svg.swap,
width: 20,
height: 20,
+ color:
+ StackTheme.instance.color.accentColorDark,
),
),
),
@@ -874,7 +882,10 @@ class _ExchangeViewState extends ConsumerState {
width: 18,
height: 18,
decoration: BoxDecoration(
- color: CFColors.gray3,
+ color: StackTheme
+ .instance
+ .color
+ .textFieldDefaultBG,
borderRadius:
BorderRadius.circular(
18),
@@ -895,7 +906,7 @@ class _ExchangeViewState extends ConsumerState {
width: 18,
height: 18,
decoration: BoxDecoration(
- // color: CFColors.stackAccent,
+ // color: StackTheme.instance.color.accentColorDark
borderRadius:
BorderRadius.circular(18),
),
@@ -903,7 +914,8 @@ class _ExchangeViewState extends ConsumerState {
Assets.svg.circleQuestion,
width: 18,
height: 18,
- color: CFColors.gray3,
+ color: StackTheme.instance
+ .color.textFieldDefaultBG,
),
);
}
@@ -928,7 +940,8 @@ class _ExchangeViewState extends ConsumerState {
.toUpperCase())) ??
"-",
style: STextStyles.smallMed14.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme
+ .instance.color.textDark,
),
),
const SizedBox(
@@ -938,7 +951,8 @@ class _ExchangeViewState extends ConsumerState {
Assets.svg.chevronDown,
width: 5,
height: 2.5,
- color: CFColors.stackAccent,
+ color:
+ StackTheme.instance.color.textDark,
),
],
),
@@ -1117,28 +1131,18 @@ class _ExchangeViewState extends ConsumerState {
height: 12,
),
TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- ((ref
- .read(
- prefsChangeNotifierProvider)
- .exchangeRateType ==
- ExchangeRateType.estimated)
- ? ref.watch(
- estimatedRateExchangeFormProvider
- .select((value) =>
- value.canExchange))
- : ref.watch(
- fixedRateExchangeFormProvider
- .select((value) =>
- value.canExchange)))
- ? CFColors.stackAccent
- : CFColors.buttonGray,
- ),
- ),
+ style: ((ref
+ .read(prefsChangeNotifierProvider)
+ .exchangeRateType ==
+ ExchangeRateType.estimated)
+ ? ref.watch(estimatedRateExchangeFormProvider
+ .select((value) => value.canExchange))
+ : ref.watch(fixedRateExchangeFormProvider
+ .select((value) => value.canExchange)))
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance
+ .getPrimaryDisabledButtonColor(context),
onPressed: ((ref
.read(prefsChangeNotifierProvider)
.exchangeRateType ==
@@ -1303,16 +1307,9 @@ class _ExchangeViewState extends ConsumerState {
message:
"${response.value!.warningMessage!}\n\nDo you want to attempt trade anyways?",
leftButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all<
- Color>(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(
+ context),
child: Text(
"Cancel",
style: STextStyles.itemSubtitle12,
@@ -1323,16 +1320,9 @@ class _ExchangeViewState extends ConsumerState {
},
),
rightButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all<
- Color>(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(
+ context),
child: Text(
"Attempt",
style: STextStyles.button,
@@ -1351,7 +1341,7 @@ class _ExchangeViewState extends ConsumerState {
}
String rate =
- "1 $fromTicker ~${ref.read(fixedRateExchangeFormProvider).rate!.toStringAsFixed(8)} $toTicker";
+ "1 ${fromTicker.toUpperCase()} ~${ref.read(fixedRateExchangeFormProvider).rate!.toStringAsFixed(8)} ${toTicker.toUpperCase()}";
final model = IncompleteExchangeModel(
sendTicker: fromTicker,
@@ -1388,7 +1378,7 @@ class _ExchangeViewState extends ConsumerState {
// Text(
// "Trades",
// style: STextStyles.itemSubtitle.copyWith(
- // color: CFColors.neutral50,
+ // color: StackTheme.instance.color.textDark3,
// ),
// ),
// SizedBox(
@@ -1428,7 +1418,7 @@ class _ExchangeViewState extends ConsumerState {
Text(
"Trades",
style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
+ color: StackTheme.instance.color.textDark3,
),
),
const SizedBox(
@@ -1471,6 +1461,7 @@ class _ExchangeViewState extends ConsumerState {
debugPrint("name: ${manager.walletName}");
+ // TODO store tx data completely locally in isar so we don't lock up ui here when querying txData
final txData = await manager.transactionData;
final tx = txData.getAllTransactions()[txid];
@@ -1500,7 +1491,7 @@ class _ExchangeViewState extends ConsumerState {
padding: const EdgeInsets.symmetric(horizontal: 4),
child: Container(
decoration: BoxDecoration(
- color: CFColors.white,
+ color: StackTheme.instance.color.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
@@ -1542,7 +1533,7 @@ class RateInfo extends ConsumerWidget {
return Container(
decoration: BoxDecoration(
- color: CFColors.white,
+ color: StackTheme.instance.color.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
@@ -1630,7 +1621,7 @@ class RateInfo extends ConsumerWidget {
Assets.svg.chevronDown,
width: 5,
height: 2.5,
- color: CFColors.neutral60,
+ color: StackTheme.instance.color.infoItemLabel,
),
],
),
diff --git a/lib/pages/exchange_view/send_from_view.dart b/lib/pages/exchange_view/send_from_view.dart
index e50796e75..9bc42e174 100644
--- a/lib/pages/exchange_view/send_from_view.dart
+++ b/lib/pages/exchange_view/send_from_view.dart
@@ -1,3 +1,5 @@
+import 'dart:async';
+
import 'package:decimal/decimal.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
@@ -9,12 +11,12 @@ import 'package:stackwallet/pages/send_view/sub_widgets/building_transaction_dia
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/animated_text.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -58,7 +60,7 @@ class _SendFromViewState extends ConsumerState {
@override
Widget build(BuildContext context) {
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () {
@@ -159,7 +161,7 @@ class _SendFromCardState extends ConsumerState {
return RoundedWhiteContainer(
padding: const EdgeInsets.all(0),
child: MaterialButton(
- splashColor: CFColors.splashLight,
+ splashColor: StackTheme.instance.color.highlight,
key: Key("walletsSheetItemButtonKey_$walletId"),
padding: const EdgeInsets.all(5),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -174,7 +176,7 @@ class _SendFromCardState extends ConsumerState {
try {
bool wasCancelled = false;
- showDialog(
+ unawaited(showDialog(
context: context,
useSafeArea: false,
barrierDismissible: false,
@@ -187,7 +189,7 @@ class _SendFromCardState extends ConsumerState {
},
);
},
- );
+ ));
final txData = await manager.prepareSend(
address: address,
@@ -210,7 +212,7 @@ class _SendFromCardState extends ConsumerState {
txData["address"] = address;
if (mounted) {
- Navigator.of(context).push(
+ await Navigator.of(context).push(
RouteGenerator.getRoute(
shouldUseMaterialRoute: RouteGenerator.useMaterialPageRoute,
builder: (_) => ConfirmChangeNowSendView(
@@ -231,7 +233,7 @@ class _SendFromCardState extends ConsumerState {
// pop building dialog
Navigator.of(context).pop();
- showDialog(
+ await showDialog(
context: context,
useSafeArea: false,
barrierDismissible: true,
@@ -240,15 +242,12 @@ class _SendFromCardState extends ConsumerState {
title: "Transaction failed",
message: e.toString(),
rightButton: TextButton(
- style: Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor: MaterialStateProperty.all(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
child: Text(
"Ok",
style: STextStyles.button.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.buttonTextSecondary,
),
),
onPressed: () {
@@ -265,7 +264,9 @@ class _SendFromCardState extends ConsumerState {
children: [
Container(
decoration: BoxDecoration(
- color: CFColors.coin.forCoin(manager.coin).withOpacity(0.5),
+ color: StackTheme.instance
+ .colorForCoin(manager.coin)
+ .withOpacity(0.5),
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
diff --git a/lib/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart b/lib/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart
index 4a96a6074..9926b2eab 100644
--- a/lib/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart
+++ b/lib/pages/exchange_view/sub_widgets/exchange_rate_sheet.dart
@@ -1,9 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/providers/providers.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
enum ExchangeRateType { estimated, fixed }
@@ -15,9 +15,9 @@ class ExchangeRateSheet extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
return Container(
- decoration: const BoxDecoration(
- color: CFColors.white,
- borderRadius: BorderRadius.vertical(
+ decoration: BoxDecoration(
+ color: StackTheme.instance.color.popupBG,
+ borderRadius: const BorderRadius.vertical(
top: Radius.circular(20),
),
),
@@ -35,7 +35,7 @@ class ExchangeRateSheet extends ConsumerWidget {
Center(
child: Container(
decoration: BoxDecoration(
- color: CFColors.fieldGray,
+ color: StackTheme.instance.color.textSubtitle4,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
@@ -76,7 +76,8 @@ class ExchangeRateSheet extends ConsumerWidget {
width: 20,
height: 20,
child: Radio(
- activeColor: CFColors.link2,
+ activeColor: StackTheme
+ .instance.color.radioButtonIconEnabled,
value: ExchangeRateType.estimated,
groupValue: ref.watch(prefsChangeNotifierProvider
.select((value) => value.exchangeRateType)),
@@ -102,9 +103,7 @@ class ExchangeRateSheet extends ConsumerWidget {
children: [
Text(
"Estimated rate",
- style: STextStyles.titleBold12.copyWith(
- color: const Color(0xFF44464E),
- ),
+ style: STextStyles.titleBold12,
textAlign: TextAlign.left,
),
const SizedBox(
@@ -112,7 +111,9 @@ class ExchangeRateSheet extends ConsumerWidget {
),
Text(
"ChangeNOW will pick the best rate for you during the moment of the exchange.",
- style: STextStyles.itemSubtitle,
+ style: STextStyles.itemSubtitle.copyWith(
+ color: StackTheme.instance.color.textSubtitle1,
+ ),
textAlign: TextAlign.left,
),
],
@@ -146,7 +147,8 @@ class ExchangeRateSheet extends ConsumerWidget {
width: 20,
height: 20,
child: Radio(
- activeColor: CFColors.link2,
+ activeColor: StackTheme
+ .instance.color.radioButtonIconEnabled,
value: ExchangeRateType.fixed,
groupValue: ref.watch(prefsChangeNotifierProvider
.select((value) => value.exchangeRateType)),
@@ -169,9 +171,7 @@ class ExchangeRateSheet extends ConsumerWidget {
children: [
Text(
"Fixed rate",
- style: STextStyles.titleBold12.copyWith(
- color: const Color(0xFF44464E),
- ),
+ style: STextStyles.titleBold12,
textAlign: TextAlign.left,
),
const SizedBox(
@@ -179,7 +179,9 @@ class ExchangeRateSheet extends ConsumerWidget {
),
Text(
"You will get the exact exchange amount displayed - ChangeNOW takes all the rate risks.",
- style: STextStyles.itemSubtitle,
+ style: STextStyles.itemSubtitle.copyWith(
+ color: StackTheme.instance.color.textSubtitle1,
+ ),
textAlign: TextAlign.left,
)
],
diff --git a/lib/pages/exchange_view/sub_widgets/step_indicator.dart b/lib/pages/exchange_view/sub_widgets/step_indicator.dart
index c4923a379..9e8cd4dca 100644
--- a/lib/pages/exchange_view/sub_widgets/step_indicator.dart
+++ b/lib/pages/exchange_view/sub_widgets/step_indicator.dart
@@ -2,7 +2,7 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/svg.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
enum StepIndicatorStatus { current, completed, incomplete }
@@ -22,11 +22,11 @@ class StepIndicator extends StatelessWidget {
Color get background {
switch (status) {
case StepIndicatorStatus.current:
- return CFColors.selection;
+ return StackTheme.instance.color.stepIndicatorBGNumber;
case StepIndicatorStatus.completed:
- return CFColors.selection;
+ return StackTheme.instance.color.stepIndicatorBGCheck;
case StepIndicatorStatus.incomplete:
- return CFColors.stackAccent.withOpacity(0.2);
+ return StackTheme.instance.color.stepIndicatorBGInactive;
}
}
@@ -38,13 +38,13 @@ class StepIndicator extends StatelessWidget {
style: GoogleFonts.roboto(
fontWeight: FontWeight.w600,
fontSize: 8,
- color: CFColors.link2,
+ color: StackTheme.instance.color.stepIndicatorIconNumber,
),
);
case StepIndicatorStatus.completed:
return SvgPicture.asset(
Assets.svg.check,
- color: CFColors.link2,
+ color: StackTheme.instance.color.stepIndicatorIconText,
width: 10,
);
case StepIndicatorStatus.incomplete:
@@ -53,7 +53,7 @@ class StepIndicator extends StatelessWidget {
style: GoogleFonts.roboto(
fontWeight: FontWeight.w600,
fontSize: 8,
- color: CFColors.white,
+ color: StackTheme.instance.color.stepIndicatorIconInactive,
),
);
}
diff --git a/lib/pages/exchange_view/sub_widgets/step_row.dart b/lib/pages/exchange_view/sub_widgets/step_row.dart
index 5404eb98b..9d2b09451 100644
--- a/lib/pages/exchange_view/sub_widgets/step_row.dart
+++ b/lib/pages/exchange_view/sub_widgets/step_row.dart
@@ -1,6 +1,6 @@
import 'package:flutter/cupertino.dart';
import 'package:stackwallet/pages/exchange_view/sub_widgets/step_indicator.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
class StepRow extends StatelessWidget {
const StepRow({
@@ -20,13 +20,13 @@ class StepRow extends StatelessWidget {
Color getColor(int index) {
if (current >= count - 1) {
- return CFColors.stackAccent;
+ return StackTheme.instance.color.accentColorDark;
}
if (current <= index) {
- return CFColors.stackAccent.withOpacity(0.2);
+ return StackTheme.instance.color.stepIndicatorBGLinesInactive;
} else {
- return CFColors.link2;
+ return StackTheme.instance.color.stepIndicatorBGLines;
}
}
diff --git a/lib/pages/exchange_view/trade_details_view.dart b/lib/pages/exchange_view/trade_details_view.dart
index 68b1f49a6..2f293b95e 100644
--- a/lib/pages/exchange_view/trade_details_view.dart
+++ b/lib/pages/exchange_view/trade_details_view.dart
@@ -17,12 +17,12 @@ import 'package:stackwallet/providers/exchange/trade_note_service_provider.dart'
import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/clipboard_interface.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/format.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/rounded_container.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart';
@@ -140,9 +140,9 @@ class _TradeDetailsViewState extends ConsumerState {
Decimal.parse("-1");
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
leading: AppBarBackButton(
onPressed: () async {
Navigator.of(context).pop();
@@ -221,9 +221,9 @@ class _TradeDetailsViewState extends ConsumerState {
trade.statusObject?.status.name ?? trade.statusString,
style: STextStyles.itemSubtitle.copyWith(
color: trade.statusObject != null
- ? CFColors.status
- .forStatus(trade.statusObject!.status)
- : CFColors.stackAccent,
+ ? StackTheme.instance
+ .colorForStatus(trade.statusObject!.status)
+ : StackTheme.instance.color.accentColorDark,
),
),
// ),
@@ -237,7 +237,7 @@ class _TradeDetailsViewState extends ConsumerState {
),
if (!sentFromStack && !hasTx)
RoundedContainer(
- color: CFColors.warningBackground,
+ color: StackTheme.instance.color.warningBackground,
child: RichText(
text: TextSpan(
text:
@@ -245,7 +245,7 @@ class _TradeDetailsViewState extends ConsumerState {
trade.fromCurrency.toLowerCase() == "xmr" ? 12 : 8,
)} ${trade.fromCurrency.toUpperCase()}. ",
style: STextStyles.label.copyWith(
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.accentColorDark,
fontWeight: FontWeight.w700,
),
children: [
@@ -257,7 +257,8 @@ class _TradeDetailsViewState extends ConsumerState {
: 8,
)} ${trade.fromCurrency.toUpperCase()}, your transaction may not be converted and it may not be refunded.",
style: STextStyles.label.copyWith(
- color: CFColors.stackAccent,
+ color:
+ StackTheme.instance.color.accentColorDark,
fontWeight: FontWeight.w500,
),
),
@@ -382,12 +383,14 @@ class _TradeDetailsViewState extends ConsumerState {
width: width + 20,
height: width + 20,
child: QrImage(
- data: trade.payinAddress,
- size: width,
- backgroundColor: CFColors.white,
- foregroundColor:
- CFColors.stackAccent,
- ),
+ data: trade.payinAddress,
+ size: width,
+ backgroundColor: StackTheme
+ .instance.color.popupBG,
+ foregroundColor: StackTheme
+ .instance
+ .color
+ .accentColorDark),
),
),
),
@@ -402,19 +405,17 @@ class _TradeDetailsViewState extends ConsumerState {
// await _capturePng(true);
Navigator.of(context).pop();
},
- style: ButtonStyle(
- backgroundColor:
- MaterialStateProperty.all<
- Color>(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(
+ context),
child: Text(
"Cancel",
- style:
- STextStyles.button.copyWith(
- color: CFColors.stackAccent,
- ),
+ style: STextStyles.button
+ .copyWith(
+ color: StackTheme
+ .instance
+ .color
+ .accentColorDark),
),
),
),
@@ -431,7 +432,7 @@ class _TradeDetailsViewState extends ConsumerState {
Assets.svg.pencil,
width: 10,
height: 10,
- color: CFColors.link2,
+ color: StackTheme.instance.color.infoItemIcons,
),
const SizedBox(
width: 4,
@@ -478,7 +479,8 @@ class _TradeDetailsViewState extends ConsumerState {
Assets.svg.pencil,
width: 10,
height: 10,
- color: CFColors.link2,
+ color:
+ StackTheme.instance.color.infoItemIcons,
),
const SizedBox(
width: 4,
@@ -536,7 +538,8 @@ class _TradeDetailsViewState extends ConsumerState {
Assets.svg.pencil,
width: 10,
height: 10,
- color: CFColors.link2,
+ color:
+ StackTheme.instance.color.infoItemIcons,
),
const SizedBox(
width: 4,
@@ -655,7 +658,7 @@ class _TradeDetailsViewState extends ConsumerState {
},
child: SvgPicture.asset(
Assets.svg.copy,
- color: CFColors.link2,
+ color: StackTheme.instance.color.infoItemIcons,
width: 12,
),
)
diff --git a/lib/pages/exchange_view/wallet_initiated_exchange_view.dart b/lib/pages/exchange_view/wallet_initiated_exchange_view.dart
index 551f8b5d9..126e1e0ec 100644
--- a/lib/pages/exchange_view/wallet_initiated_exchange_view.dart
+++ b/lib/pages/exchange_view/wallet_initiated_exchange_view.dart
@@ -26,10 +26,10 @@ import 'package:stackwallet/providers/exchange/fixed_rate_exchange_form_provider
import 'package:stackwallet/providers/exchange/fixed_rate_market_pairs_provider.dart';
import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/enums/flush_bar_type.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/loading_indicator.dart';
@@ -81,7 +81,7 @@ class _WalletInitiatedExchangeViewState
builder: (_) => WillPopScope(
onWillPop: () async => false,
child: Container(
- color: CFColors.stackAccent.withOpacity(0.8),
+ color: StackTheme.instance.color.accentColorDark.withOpacity(0.8),
child: const CustomLoadingOverlay(
message: "Updating exchange rate",
eventBus: null,
@@ -353,7 +353,7 @@ class _WalletInitiatedExchangeViewState
});
return Scaffold(
- backgroundColor: CFColors.almostWhite,
+ backgroundColor: StackTheme.instance.color.background,
appBar: AppBar(
leading: AppBarBackButton(
onPressed: () async {
@@ -412,7 +412,7 @@ class _WalletInitiatedExchangeViewState
Text(
"You will send",
style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
+ color: StackTheme.instance.color.textDark3,
),
),
const SizedBox(
@@ -621,7 +621,10 @@ class _WalletInitiatedExchangeViewState
width: 18,
height: 18,
decoration: BoxDecoration(
- color: CFColors.gray3,
+ color: StackTheme
+ .instance
+ .color
+ .textSubtitle2,
borderRadius:
BorderRadius
.circular(
@@ -645,7 +648,7 @@ class _WalletInitiatedExchangeViewState
width: 18,
height: 18,
decoration: BoxDecoration(
- // color: CFColors.stackAccent,
+ // color: StackTheme.instance.color.accentColorDark
borderRadius:
BorderRadius.circular(
18),
@@ -654,7 +657,8 @@ class _WalletInitiatedExchangeViewState
Assets.svg.circleQuestion,
width: 18,
height: 18,
- color: CFColors.gray3,
+ color: StackTheme.instance
+ .color.textSubtitle2,
),
);
}
@@ -678,10 +682,10 @@ class _WalletInitiatedExchangeViewState
.market?.from
.toUpperCase())) ??
"-",
- style:
- STextStyles.smallMed14.copyWith(
- color: CFColors.stackAccent,
- ),
+ style: STextStyles.smallMed14
+ .copyWith(
+ color: StackTheme.instance
+ .color.accentColorDark),
),
const SizedBox(
width: 6,
@@ -705,11 +709,11 @@ class _WalletInitiatedExchangeViewState
return Container();
}
return SvgPicture.asset(
- Assets.svg.chevronDown,
- width: 5,
- height: 2.5,
- color: CFColors.stackAccent,
- );
+ Assets.svg.chevronDown,
+ width: 5,
+ height: 2.5,
+ color: StackTheme.instance.color
+ .accentColorDark);
}),
],
),
@@ -730,7 +734,7 @@ class _WalletInitiatedExchangeViewState
child: Text(
"You will receive",
style: STextStyles.itemSubtitle.copyWith(
- color: CFColors.neutral50,
+ color: StackTheme.instance.color.textDark3,
),
),
),
@@ -980,7 +984,10 @@ class _WalletInitiatedExchangeViewState
width: 18,
height: 18,
decoration: BoxDecoration(
- color: CFColors.gray3,
+ color: StackTheme
+ .instance
+ .color
+ .textSubtitle2,
borderRadius:
BorderRadius
.circular(18),
@@ -1002,7 +1009,7 @@ class _WalletInitiatedExchangeViewState
width: 18,
height: 18,
decoration: BoxDecoration(
- // color: CFColors.stackAccent,
+ // color: StackTheme.instance.color.accentColorDark
borderRadius:
BorderRadius.circular(
18),
@@ -1011,7 +1018,8 @@ class _WalletInitiatedExchangeViewState
Assets.svg.circleQuestion,
width: 18,
height: 18,
- color: CFColors.gray3,
+ color: StackTheme.instance
+ .color.textSubtitle2,
),
);
}
@@ -1035,10 +1043,10 @@ class _WalletInitiatedExchangeViewState
.market?.to
.toUpperCase())) ??
"-",
- style:
- STextStyles.smallMed14.copyWith(
- color: CFColors.stackAccent,
- ),
+ style: STextStyles.smallMed14
+ .copyWith(
+ color: StackTheme.instance
+ .color.accentColorDark),
),
const SizedBox(
width: 6,
@@ -1062,11 +1070,11 @@ class _WalletInitiatedExchangeViewState
return Container();
}
return SvgPicture.asset(
- Assets.svg.chevronDown,
- width: 5,
- height: 2.5,
- color: CFColors.stackAccent,
- );
+ Assets.svg.chevronDown,
+ width: 5,
+ height: 2.5,
+ color: StackTheme.instance.color
+ .accentColorDark);
}),
],
),
@@ -1215,27 +1223,18 @@ class _WalletInitiatedExchangeViewState
),
const Spacer(),
TextButton(
- style:
- Theme.of(context).textButtonTheme.style?.copyWith(
- backgroundColor:
- MaterialStateProperty.all(
- ((ref
- .read(
- prefsChangeNotifierProvider)
- .exchangeRateType ==
- ExchangeRateType.estimated)
- ? ref.watch(
- estimatedRateExchangeFormProvider
- .select((value) =>
- value.canExchange))
- : ref.watch(
- fixedRateExchangeFormProvider
- .select((value) =>
- value.canExchange)))
- ? CFColors.stackAccent
- : CFColors.buttonGray,
- ),
- ),
+ style: ((ref
+ .read(prefsChangeNotifierProvider)
+ .exchangeRateType ==
+ ExchangeRateType.estimated)
+ ? ref.watch(estimatedRateExchangeFormProvider
+ .select((value) => value.canExchange))
+ : ref.watch(fixedRateExchangeFormProvider
+ .select((value) => value.canExchange)))
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(context)
+ : StackTheme.instance
+ .getSecondaryEnabledButtonColor(context),
onPressed: ((ref
.read(prefsChangeNotifierProvider)
.exchangeRateType ==
@@ -1471,16 +1470,9 @@ class _WalletInitiatedExchangeViewState
message:
"${response.value!.warningMessage!}\n\nDo you want to attempt trade anyways?",
leftButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all<
- Color>(
- CFColors.buttonGray,
- ),
- ),
+ style: StackTheme.instance
+ .getSecondaryEnabledButtonColor(
+ context),
child: Text(
"Cancel",
style: STextStyles.itemSubtitle12,
@@ -1491,16 +1483,9 @@ class _WalletInitiatedExchangeViewState
},
),
rightButton: TextButton(
- style: Theme.of(context)
- .textButtonTheme
- .style
- ?.copyWith(
- backgroundColor:
- MaterialStateProperty.all<
- Color>(
- CFColors.stackAccent,
- ),
- ),
+ style: StackTheme.instance
+ .getPrimaryEnabledButtonColor(
+ context),
child: Text(
"Attempt",
style: STextStyles.button,
diff --git a/lib/pages/home_view/home_view.dart b/lib/pages/home_view/home_view.dart
index 669561adf..ecb6c49a0 100644
--- a/lib/pages/home_view/home_view.dart
+++ b/lib/pages/home_view/home_view.dart
@@ -15,9 +15,9 @@ import 'package:stackwallet/providers/ui/home_view_index_provider.dart';
import 'package:stackwallet/providers/ui/unread_notifications_provider.dart';
import 'package:stackwallet/services/change_now/change_now_loading_service.dart';
import 'package:stackwallet/utilities/assets.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
@@ -44,7 +44,6 @@ class _HomeViewState extends ConsumerState {
final _cnLoadingService = ChangeNowLoadingService();
Future _onWillPop() async {
-
// go to home view when tapping back on the main exchange view
if (ref.read(homeViewPageIndexStateProvider.state).state == 1) {
ref.read(homeViewPageIndexStateProvider.state).state = 0;
@@ -145,7 +144,6 @@ class _HomeViewState extends ConsumerState {
onTap: _hiddenOptions,
child: SvgPicture.asset(
Assets.svg.stackIcon,
- // color: CFColors.stackAccent,
width: 24,
height: 24,
),
@@ -172,7 +170,7 @@ class _HomeViewState extends ConsumerState {
key: const Key("walletsViewAlertsButton"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
ref.watch(notificationsProvider
.select((value) => value.hasUnreadNotifications))
@@ -180,6 +178,10 @@ class _HomeViewState extends ConsumerState {
: Assets.svg.bell,
width: 20,
height: 20,
+ color: ref.watch(notificationsProvider
+ .select((value) => value.hasUnreadNotifications))
+ ? null
+ : StackTheme.instance.color.topNavIconPrimary,
),
onPressed: () {
// reset unread state
@@ -225,10 +227,10 @@ class _HomeViewState extends ConsumerState {
key: const Key("walletsViewSettingsButton"),
size: 36,
shadows: const [],
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
icon: SvgPicture.asset(
Assets.svg.gear,
- color: CFColors.stackAccent,
+ color: StackTheme.instance.color.topNavIconPrimary,
width: 20,
height: 20,
),
@@ -243,15 +245,15 @@ class _HomeViewState extends ConsumerState {
],
),
body: Container(
- color: CFColors.almostWhite,
+ color: StackTheme.instance.color.background,
child: Column(
children: [
if (Constants.enableExchange)
Container(
- decoration: const BoxDecoration(
- color: CFColors.almostWhite,
+ decoration: BoxDecoration(
+ color: StackTheme.instance.color.background,
boxShadow: [
- CFColors.standardBoxShadow,
+ StackTheme.instance.standardBoxShadow,
],
),
child: const Padding(
diff --git a/lib/pages/home_view/sub_widgets/home_view_button_bar.dart b/lib/pages/home_view/sub_widgets/home_view_button_bar.dart
index ca7133a0f..967c23236 100644
--- a/lib/pages/home_view/sub_widgets/home_view_button_bar.dart
+++ b/lib/pages/home_view/sub_widgets/home_view_button_bar.dart
@@ -10,9 +10,9 @@ import 'package:stackwallet/providers/exchange/estimate_rate_exchange_form_provi
import 'package:stackwallet/providers/exchange/fixed_rate_exchange_form_provider.dart';
import 'package:stackwallet/providers/exchange/fixed_rate_market_pairs_provider.dart';
import 'package:stackwallet/providers/providers.dart';
-import 'package:stackwallet/utilities/cfcolors.dart';
import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
+import 'package:stackwallet/utilities/theme/stack_theme.dart';
import 'package:stackwallet/widgets/stack_dialog.dart';
class HomeViewButtonBar extends ConsumerStatefulWidget {
@@ -147,14 +147,19 @@ class _HomeViewButtonBarState extends ConsumerState {
children: [
Expanded(
child: TextButton(
- style: ButtonStyle(
- minimumSize: MaterialStateProperty.all(const Size(46, 36)),
- backgroundColor: MaterialStateProperty.all(
- selectedIndex == 0
- ? CFColors.stackAccent
- : CFColors.disabledButton,
- ),
- ),
+ style: selectedIndex == 0
+ ? StackTheme.instance
+ .getPrimaryEnabledButtonColor(context)!
+ .copyWith(
+ minimumSize:
+ MaterialStateProperty.all(const Size(46, 36)),
+ )
+ : StackTheme.instance
+ .getSecondaryEnabledButtonColor(context)!
+ .copyWith(
+ minimumSize:
+ MaterialStateProperty.all