mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-31 15:59:26 +00:00
WIP testing themes
This commit is contained in:
parent
66f17b2ba1
commit
ec00f6aea4
18 changed files with 127 additions and 118 deletions
|
@ -24,6 +24,7 @@ import 'package:stackwallet/models/exchange/change_now/exchange_transaction.dart
|
|||
import 'package:stackwallet/models/exchange/change_now/exchange_transaction_status.dart';
|
||||
import 'package:stackwallet/models/exchange/response_objects/trade.dart';
|
||||
import 'package:stackwallet/models/isar/models/isar_models.dart';
|
||||
import 'package:stackwallet/models/isar/sw_theme.dart';
|
||||
import 'package:stackwallet/models/models.dart';
|
||||
import 'package:stackwallet/models/node_model.dart';
|
||||
import 'package:stackwallet/models/notification_model.dart';
|
||||
|
@ -41,7 +42,6 @@ import 'package:stackwallet/providers/global/base_currencies_provider.dart';
|
|||
// import 'package:stackwallet/providers/global/has_authenticated_start_state_provider.dart';
|
||||
import 'package:stackwallet/providers/global/trades_service_provider.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/route_generator.dart';
|
||||
// import 'package:stackwallet/services/buy/buy_data_loading_service.dart';
|
||||
import 'package:stackwallet/services/debug_service.dart';
|
||||
|
@ -51,6 +51,7 @@ import 'package:stackwallet/services/node_service.dart';
|
|||
import 'package:stackwallet/services/notifications_api.dart';
|
||||
import 'package:stackwallet/services/notifications_service.dart';
|
||||
import 'package:stackwallet/services/trade_service.dart';
|
||||
import 'package:stackwallet/themes/defaults/dark.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/db_version_migration.dart';
|
||||
|
@ -60,14 +61,12 @@ import 'package:stackwallet/utilities/logger.dart';
|
|||
import 'package:stackwallet/utilities/prefs.dart';
|
||||
import 'package:stackwallet/utilities/stack_file_system.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:window_size/window_size.dart';
|
||||
|
||||
final openedFromSWBFileStringStateProvider =
|
||||
StateProvider<String?>((ref) => null);
|
||||
|
||||
String? themeDirectory;
|
||||
// main() is the entry point to the app. It initializes Hive (local database),
|
||||
// runs the MyApp widget and checks for new users, caching the value in the
|
||||
// miscellaneous box for later use
|
||||
|
@ -275,9 +274,8 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
await loadShared();
|
||||
}
|
||||
|
||||
themeDirectory = ref
|
||||
.read(applicationThemesDirectoryPathProvider.notifier)
|
||||
.state = (await StackFileSystem.applicationThemesDirectory()).path;
|
||||
ref.read(applicationThemesDirectoryPathProvider.notifier).state =
|
||||
(await StackFileSystem.applicationThemesDirectory()).path;
|
||||
|
||||
_notificationsService = ref.read(notificationsProvider);
|
||||
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
||||
|
@ -372,8 +370,12 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
.loadLocale(notify: false);
|
||||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
ref.read(colorThemeProvider.state).state =
|
||||
StackColors.fromStackColorTheme(colorTheme);
|
||||
ref.read(themeProvider.state).state = StackTheme.fromJson(
|
||||
json: darkJson,
|
||||
applicationThemesDirectoryPath: ref.read(
|
||||
applicationThemesDirectoryPathProvider,
|
||||
),
|
||||
);
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
// fetch open file if it exists
|
||||
|
@ -411,8 +413,12 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (ref.read(prefsChangeNotifierProvider).enableSystemBrightness) {
|
||||
ref.read(colorThemeProvider.notifier).state =
|
||||
StackColors.fromStackColorTheme(colorTheme);
|
||||
ref.read(themeProvider.state).state = StackTheme.fromJson(
|
||||
json: darkJson,
|
||||
applicationThemesDirectoryPath: ref.read(
|
||||
applicationThemesDirectoryPathProvider,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
@ -547,7 +553,7 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
|||
// addToDebugMessagesDB: false);
|
||||
// });
|
||||
|
||||
final colorScheme = ref.watch(colorThemeProvider.state).state;
|
||||
final colorScheme = ref.watch(colorProvider.state).state;
|
||||
|
||||
return MaterialApp(
|
||||
key: GlobalKey(),
|
||||
|
|
|
@ -72,14 +72,34 @@ class StackTheme {
|
|||
// ==== boxShadows =====================================================
|
||||
|
||||
@ignore
|
||||
BoxShadow get boxShadows => _boxShadows ??= BoxShadowExt.fromJson(
|
||||
BoxShadow get standardBoxShadow =>
|
||||
_standardBoxShadow ??= BoxShadowExt.fromJson(
|
||||
Map<String, dynamic>.from(
|
||||
jsonDecode(boxShadowsString) as Map,
|
||||
jsonDecode(standardBoxShadowString) as Map,
|
||||
),
|
||||
);
|
||||
@ignore
|
||||
BoxShadow? _boxShadows;
|
||||
final String boxShadowsString;
|
||||
BoxShadow? _standardBoxShadow;
|
||||
final String standardBoxShadowString;
|
||||
|
||||
@ignore
|
||||
BoxShadow? get homeViewButtonBarBoxShadow {
|
||||
if (homeViewButtonBarBoxShadowString == null) {
|
||||
_homeViewButtonBarBoxShadow = null;
|
||||
} else {
|
||||
_homeViewButtonBarBoxShadow ??= BoxShadowExt.fromJson(
|
||||
Map<String, dynamic>.from(
|
||||
jsonDecode(homeViewButtonBarBoxShadowString!) as Map,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return _homeViewButtonBarBoxShadow;
|
||||
}
|
||||
|
||||
@ignore
|
||||
BoxShadow? _homeViewButtonBarBoxShadow;
|
||||
final String? homeViewButtonBarBoxShadowString;
|
||||
|
||||
// ==== overlay =====================================================
|
||||
|
||||
|
@ -1456,7 +1476,8 @@ class StackTheme {
|
|||
required this.backgroundInt,
|
||||
required this.backgroundAppBarInt,
|
||||
required this.gradientBackgroundString,
|
||||
required this.boxShadowsString,
|
||||
required this.standardBoxShadowString,
|
||||
required this.homeViewButtonBarBoxShadowString,
|
||||
required this.overlayInt,
|
||||
required this.accentColorBlueInt,
|
||||
required this.accentColorGreenInt,
|
||||
|
@ -1624,7 +1645,12 @@ class StackTheme {
|
|||
json["colors"]["background_colors"]["backgroundAppBar"] as String),
|
||||
gradientBackgroundString:
|
||||
jsonEncode(json["gradients"]["background"] as Map),
|
||||
boxShadowsString: jsonEncode(json["box_shadows"] as Map),
|
||||
standardBoxShadowString:
|
||||
jsonEncode(json["box_shadows"]["standard"] as Map),
|
||||
homeViewButtonBarBoxShadowString:
|
||||
json["box_shadows"]["home_view_button_bar"] == null
|
||||
? null
|
||||
: jsonEncode(json["box_shadows"]["home_view_button_bar"] as Map),
|
||||
coinColorsJsonString: jsonEncode(json["coinColors"] as Map),
|
||||
assets: ThemeAssets.fromJson(
|
||||
json: json,
|
||||
|
|
|
@ -12,8 +12,8 @@ import 'package:stackwallet/pages/add_wallet_views/restore_wallet_view/restore_o
|
|||
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/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/verify_recovery_phrase/mnemonic_word_count_state_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
|
@ -67,7 +67,7 @@ class _RestoreOptionsViewState extends ConsumerState<RestoreOptionsView> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
baseColor = ref.read(colorThemeProvider.state).state.textSubtitle2;
|
||||
baseColor = ref.read(themeProvider.state).state.textSubtitle2;
|
||||
walletName = widget.walletName;
|
||||
coin = widget.coin;
|
||||
isDesktop = Util.isDesktop;
|
||||
|
|
|
@ -3,7 +3,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_option.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/system_brightness_theme_selection_view.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -51,10 +50,12 @@ class _ThemeOptionsWidgetState extends ConsumerState<ThemeOptionsWidget> {
|
|||
}
|
||||
|
||||
// apply theme
|
||||
ref.read(colorThemeProvider.notifier).state =
|
||||
StackColors.fromStackColorTheme(
|
||||
theme.colorTheme,
|
||||
);
|
||||
|
||||
throw Exception("bbbbbbbbbbbbbbbbb");
|
||||
// ref.read(colorThemeProvider.notifier).state =
|
||||
// StackColors.fromStackColorTheme(
|
||||
// theme.colorTheme,
|
||||
// );
|
||||
|
||||
Assets.precache(context);
|
||||
} else {
|
||||
|
@ -73,11 +74,12 @@ class _ThemeOptionsWidgetState extends ConsumerState<ThemeOptionsWidget> {
|
|||
ref.read(prefsChangeNotifierProvider.notifier).theme = theme;
|
||||
|
||||
// apply theme
|
||||
ref.read(colorThemeProvider.notifier).state =
|
||||
StackColors.fromStackColorTheme(
|
||||
theme.colorTheme,
|
||||
);
|
||||
// ref.read(colorThemeProvider.notifier).state =
|
||||
// StackColors.fromStackColorTheme(
|
||||
// theme.colorTheme,
|
||||
// );
|
||||
|
||||
throw Exception("bbbbbbbbbbbbbbbbb");
|
||||
Assets.precache(context);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/pages/settings_views/global_settings_view/appearance_settings/sub_widgets/theme_option.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
@ -27,18 +26,20 @@ class SystemBrightnessThemeSelectionView extends ConsumerWidget {
|
|||
if (isDark) {
|
||||
ref.read(prefsChangeNotifierProvider).systemBrightnessDarkTheme = type;
|
||||
if (brightness == Brightness.dark) {
|
||||
ref.read(colorThemeProvider.notifier).state =
|
||||
StackColors.fromStackColorTheme(
|
||||
type.colorTheme,
|
||||
);
|
||||
throw Exception("aaaaaaaaaaaaaaaa");
|
||||
// ref.read(themeProvider.notifier).state =
|
||||
// StackColors.fromStackColorTheme(
|
||||
// type.colorTheme,
|
||||
// );
|
||||
}
|
||||
} else {
|
||||
ref.read(prefsChangeNotifierProvider).systemBrightnessLightTheme = type;
|
||||
if (brightness == Brightness.light) {
|
||||
ref.read(colorThemeProvider.notifier).state =
|
||||
StackColors.fromStackColorTheme(
|
||||
type.colorTheme,
|
||||
);
|
||||
throw Exception("aaaaaaaaaaaaaaaa");
|
||||
// ref.read(colorThemeProvider.notifier).state =
|
||||
// StackColors.fromStackColorTheme(
|
||||
// type.colorTheme,
|
||||
// );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,8 +8,8 @@ import 'package:stackwallet/pages/pinpad_views/create_pin_view.dart';
|
|||
import 'package:stackwallet/pages_desktop_specific/password/create_password_view.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/global/price_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -311,9 +311,9 @@ class _PrivacyToggleState extends ConsumerState<PrivacyToggle> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool lightChan =
|
||||
ref.read(colorThemeProvider.state).state.themeType == ThemeType.chan;
|
||||
final bool darkChan = ref.read(colorThemeProvider.state).state.themeType ==
|
||||
ThemeType.darkChans;
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.chan;
|
||||
final bool darkChan =
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.darkChans;
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart';
|
|||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/models/transaction_filter.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/transaction_filter_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
|
@ -61,7 +61,7 @@ class _TransactionSearchViewState
|
|||
|
||||
@override
|
||||
initState() {
|
||||
baseColor = ref.read(colorThemeProvider.state).state.textSubtitle2;
|
||||
baseColor = ref.read(themeProvider.state).state.textSubtitle2;
|
||||
final filterState = ref.read(transactionFilterProvider.state).state;
|
||||
if (filterState != null) {
|
||||
_isActiveReceivedCheckbox = filterState.received;
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
|
@ -17,12 +17,12 @@ class EmptyWallets extends ConsumerWidget {
|
|||
debugPrint("BUILD: $runtimeType");
|
||||
|
||||
final isDesktop = Util.isDesktop;
|
||||
final bool isSorbet = ref.read(colorThemeProvider.state).state.themeType ==
|
||||
ThemeType.fruitSorbet;
|
||||
final bool isSorbet =
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.fruitSorbet;
|
||||
final bool isForest =
|
||||
ref.read(colorThemeProvider.state).state.themeType == ThemeType.forest;
|
||||
final bool isOcean = ref.read(colorThemeProvider.state).state.themeType ==
|
||||
ThemeType.oceanBreeze;
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.forest;
|
||||
final bool isOcean =
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.oceanBreeze;
|
||||
|
||||
return SafeArea(
|
||||
child: Padding(
|
||||
|
@ -98,8 +98,8 @@ class AddWalletButton extends ConsumerWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final bool isOLED = ref.read(colorThemeProvider.state).state.themeType ==
|
||||
ThemeType.oledBlack;
|
||||
final bool isOLED =
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.oledBlack;
|
||||
return TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
|
|
|
@ -5,7 +5,7 @@ import 'package:stackwallet/pages/wallets_view/sub_widgets/all_wallets.dart';
|
|||
import 'package:stackwallet/pages/wallets_view/sub_widgets/empty_wallets.dart';
|
||||
import 'package:stackwallet/pages/wallets_view/sub_widgets/favorite_wallets.dart';
|
||||
import 'package:stackwallet/providers/providers.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
|
||||
class WalletsView extends ConsumerWidget {
|
||||
|
@ -25,8 +25,7 @@ class WalletsView extends ConsumerWidget {
|
|||
child: hasWallets
|
||||
? Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: ref.watch(colorThemeProvider).themeType ==
|
||||
ThemeType.fruitSorbet
|
||||
top: ref.watch(themeProvider).themeType == ThemeType.fruitSorbet
|
||||
? 6
|
||||
: 20,
|
||||
),
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'package:flutter_svg/svg.dart';
|
|||
import 'package:stackwallet/db/hive/db.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/global/price_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/services/exchange/exchange_data_loading_service.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -227,9 +227,9 @@ class _PrivacyToggleState extends ConsumerState<PrivacyToggle> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final bool lightChan =
|
||||
ref.read(colorThemeProvider.state).state.themeType == ThemeType.chan;
|
||||
final bool darkChan = ref.read(colorThemeProvider.state).state.themeType ==
|
||||
ThemeType.darkChans;
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.chan;
|
||||
final bool darkChan =
|
||||
ref.read(themeProvider.state).state.themeType == ThemeType.darkChans;
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
|
|
|
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/providers/global/prefs_provider.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/constants.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
|
@ -233,14 +233,16 @@ class _ThemeToggle extends ConsumerState<ThemeToggle> {
|
|||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
if (ref.read(colorThemeProvider.notifier).state.themeType !=
|
||||
if (ref.read(themeProvider.notifier).state.themeType !=
|
||||
ThemeType.values[i]) {
|
||||
ref.read(prefsChangeNotifierProvider.notifier).theme =
|
||||
ThemeType.values[i];
|
||||
|
||||
ref.read(colorThemeProvider.notifier).state =
|
||||
StackColors.fromStackColorTheme(
|
||||
ThemeType.values[i].colorTheme);
|
||||
throw Exception(
|
||||
"TODO: set theme here properly once implemented");
|
||||
// ref.read(themeProvider.notifier).state =
|
||||
// StackColors.fromStackColorTheme(
|
||||
// ThemeType.values[i].colorTheme);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
|
@ -254,7 +256,7 @@ class _ThemeToggle extends ConsumerState<ThemeToggle> {
|
|||
border: Border.all(
|
||||
width: 2.5,
|
||||
color: ref
|
||||
.read(colorThemeProvider.notifier)
|
||||
.read(themeProvider.notifier)
|
||||
.state
|
||||
.themeType ==
|
||||
ThemeType.values[i]
|
||||
|
@ -288,10 +290,8 @@ class _ThemeToggle extends ConsumerState<ThemeToggle> {
|
|||
.extension<StackColors>()!
|
||||
.radioButtonIconEnabled,
|
||||
value: ThemeType.values[i],
|
||||
groupValue: ref
|
||||
.read(colorThemeProvider.state)
|
||||
.state
|
||||
.themeType,
|
||||
groupValue:
|
||||
ref.read(themeProvider.state).state.themeType,
|
||||
onChanged: (_) {},
|
||||
),
|
||||
),
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/utilities/theme/light_colors.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
||||
final colorThemeProvider = StateProvider<StackColors>(
|
||||
(ref) => StackColors.fromStackColorTheme(LightColors()));
|
|
@ -189,18 +189,16 @@ final Map<String, dynamic> darkJson = {
|
|||
"token_summary_button_bg": "0xFFC9D0FF",
|
||||
"token_summary_icon": "0xFF252C78"
|
||||
},
|
||||
"box_shadows": [
|
||||
{
|
||||
"type": "standard",
|
||||
"box_shadows": {
|
||||
"standard": {
|
||||
"color": "0x0F2D3132",
|
||||
"spread_radius": 3.0,
|
||||
"blur_radius": 4.0
|
||||
},
|
||||
{
|
||||
"type": "home_view_button_bar",
|
||||
"home_view_button_bar": {
|
||||
"color": "0x0F2D3132",
|
||||
"spread_radius": 3.0,
|
||||
"blur_radius": 4.0
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
@ -5,9 +5,16 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/models/isar/sw_theme.dart';
|
||||
import 'package:stackwallet/themes/defaults/dark.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
||||
final applicationThemesDirectoryPathProvider = StateProvider((ref) => "");
|
||||
|
||||
final colorProvider = StateProvider<StackColors>(
|
||||
(ref) => StackColors.fromStackColorTheme(
|
||||
ref.watch(themeProvider.state).state,
|
||||
),
|
||||
);
|
||||
|
||||
final themeProvider = StateProvider<StackTheme>((ref) {
|
||||
// Return default if no theme was properly loaded on startup. This should
|
||||
// technically never actually be read but we don't want an optional.
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:cw_core/pathForWallet.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/main.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/stack_file_system.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
|
@ -113,9 +108,9 @@ class _SVG {
|
|||
case ThemeType.darkChans:
|
||||
// print("THIS THEMES DIRECTORY IS $themeDirectory");
|
||||
// final themesPath = themesDirectory();
|
||||
// return "assets/svg/themed/${ThemeType.dark.name}";
|
||||
//TODO - remove, this will be accesses from js
|
||||
return "$themeDirectory/dark";
|
||||
return "assets/svg/themed/${ThemeType.dark.name}";
|
||||
// //TODO - remove, this will be accesses from js
|
||||
// return "$themeDirectory/dark";
|
||||
|
||||
default:
|
||||
return "assets/svg/themed/${Theme.of(context).extension<StackColors>()!.themeType.name}";
|
||||
|
|
|
@ -30,28 +30,9 @@ final map = {
|
|||
};
|
||||
|
||||
extension BoxShadowExt on BoxShadow {
|
||||
static BoxShadow fromJson(Map<String, dynamic> json) {
|
||||
switch (json["boxShadowType"] as String) {
|
||||
case "standard":
|
||||
final colorStrings = (json["colors"]);
|
||||
return BoxShadow(
|
||||
color: Color(
|
||||
colorStrings as int,
|
||||
),
|
||||
spreadRadius: json["spread_radius"] as double,
|
||||
blurRadius: json["blur_radius"] as double,
|
||||
);
|
||||
case "home_view_button_bar":
|
||||
final colorStrings = (json["colors"]);
|
||||
return BoxShadow(
|
||||
color: Color(
|
||||
colorStrings as int,
|
||||
),
|
||||
spreadRadius: json["spread_radius"] as double,
|
||||
blurRadius: json["blur_radius"] as double,
|
||||
);
|
||||
default:
|
||||
throw ArgumentError("Invalid json box shadow: $json");
|
||||
}
|
||||
}
|
||||
static BoxShadow fromJson(Map<String, dynamic> json) => BoxShadow(
|
||||
color: Color(int.parse(json["color"] as String)),
|
||||
spreadRadius: json["spread_radius"] as double,
|
||||
blurRadius: json["blur_radius"] as double,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/models/isar/sw_theme.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/utilities/theme/color_theme.dart';
|
||||
|
||||
|
@ -359,7 +360,7 @@ class StackColors extends ThemeExtension<StackColors> {
|
|||
required this.tokenSummaryIcon,
|
||||
});
|
||||
|
||||
factory StackColors.fromStackColorTheme(StackColorTheme colorTheme) {
|
||||
factory StackColors.fromStackColorTheme(StackTheme colorTheme) {
|
||||
return StackColors(
|
||||
themeType: colorTheme.themeType,
|
||||
brightness: colorTheme.brightness,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:stackwallet/providers/ui/color_theme_provider.dart';
|
||||
import 'package:stackwallet/themes/theme_providers.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
|
||||
|
@ -37,10 +37,9 @@ class _FavoriteToggleState extends ConsumerState<FavoriteToggle> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
on = widget.on ??
|
||||
ref.read(colorThemeProvider.state).state.favoriteStarActive;
|
||||
off = widget.off ??
|
||||
ref.read(colorThemeProvider.state).state.favoriteStarInactive;
|
||||
on = widget.on ?? ref.read(themeProvider.state).state.favoriteStarActive;
|
||||
off =
|
||||
widget.off ?? ref.read(themeProvider.state).state.favoriteStarInactive;
|
||||
_isActive = widget.initialState;
|
||||
_color = _isActive ? on : off;
|
||||
_onChanged = widget.onChanged;
|
||||
|
|
Loading…
Reference in a new issue