mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-11 05:04:35 +00:00
Add themes folder, setup json for dark theme assets and test getting assets from folder
This commit is contained in:
parent
00a287be53
commit
3e36165db5
4 changed files with 83 additions and 1 deletions
51
lib/assets/defaults/dark.dart
Normal file
51
lib/assets/defaults/dark.dart
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
final Map<String, dynamic> darkJson = {
|
||||||
|
"name": "dark",
|
||||||
|
"svg": {
|
||||||
|
"background": "",
|
||||||
|
"coin_icons": {
|
||||||
|
"small": {
|
||||||
|
"bitcoin ": "svg/coin_icons/small/Bitcoin.svg",
|
||||||
|
"litecoin ": "svg/coin_icons/small/Litecoin.svg",
|
||||||
|
"bitcoincash ": "svg/coin_icons/small/Bitcoincash.svg",
|
||||||
|
"dogecoin ": "svg/coin_icons/small/Dogecoin.svg",
|
||||||
|
"epicCash ": "svg/coin_icons/small/EpicCash.svg",
|
||||||
|
"ethereum ": "svg/coin_icons/small/Ethereum.svg",
|
||||||
|
"firo ": "svg/coin_icons/small/Firo.svg",
|
||||||
|
"monero ": "svg/coin_icons/small/Monero.svg",
|
||||||
|
"wownero ": "svg/coin_icons/small/Wownero.svg",
|
||||||
|
"namecoin ": "svg/coin_icons/small/Namecoin.svg",
|
||||||
|
"particl ": "svg/coin_icons/small/Particl.svg",
|
||||||
|
},
|
||||||
|
"big": {
|
||||||
|
"bitcoin ": "svg/coin_icons/big/bitcoin.svg",
|
||||||
|
"litecoin ": "svg/coin_icons/big/litecoin.svg",
|
||||||
|
"bitcoincash ": "svg/coin_icons/big/bitcoincash.svg",
|
||||||
|
"dogecoin ": "svg/coin_icons/big/doge.svg",
|
||||||
|
"epicCash ": "svg/coin_icons/big/epic-cash.svg",
|
||||||
|
"ethereum ": "svg/coin_icons/big/ethereum.svg",
|
||||||
|
"firo ": "svg/coin_icons/big/firo.svg",
|
||||||
|
"monero ": "svg/coin_icons/big/monero.svg",
|
||||||
|
"wownero ": "svg/coin_icons/big/wownero.svg",
|
||||||
|
"namecoin ": "svg/coin_icons/big/namecoin.svg",
|
||||||
|
"particl ": "svg/coin_icons/big/particl.svg",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"bell_new": "svg/bell-new.svg",
|
||||||
|
"persona_incognito": "svg/persona-incognito-1.svg",
|
||||||
|
"persona_easy": "svg/persona-easy-1.svg",
|
||||||
|
"stack": "svg/stack.svg",
|
||||||
|
"stack_icon": "svg/stack-icon1.svg",
|
||||||
|
"receive": "svg/tx-icon-receive.svg",
|
||||||
|
"receive_pending": "svg/tx-icon-receive-pending.svg",
|
||||||
|
"receive_cancelled": "svg/tx-icon-receive-failed.svg",
|
||||||
|
"send": "svg/tx-icon-send.svg",
|
||||||
|
"send_pending": "svg/tx-icon-send-pending.svg",
|
||||||
|
"send_cancelled": "svg/tx-icon-send-failed.svg",
|
||||||
|
"theme_dark": "svg/dark-theme.svg",
|
||||||
|
"theme_dark_chan": "svg/darkChansTheme.svg",
|
||||||
|
},
|
||||||
|
"png": {
|
||||||
|
"chan_persona_easy": "images/chan-persona-easy.png",
|
||||||
|
"chan_persona_incognito": "images/chan-persona-incognito.png"
|
||||||
|
}
|
||||||
|
};
|
|
@ -51,6 +51,7 @@ import 'package:stackwallet/services/node_service.dart';
|
||||||
import 'package:stackwallet/services/notifications_api.dart';
|
import 'package:stackwallet/services/notifications_api.dart';
|
||||||
import 'package:stackwallet/services/notifications_service.dart';
|
import 'package:stackwallet/services/notifications_service.dart';
|
||||||
import 'package:stackwallet/services/trade_service.dart';
|
import 'package:stackwallet/services/trade_service.dart';
|
||||||
|
import 'package:stackwallet/themes/theme_providers.dart';
|
||||||
import 'package:stackwallet/utilities/constants.dart';
|
import 'package:stackwallet/utilities/constants.dart';
|
||||||
import 'package:stackwallet/utilities/db_version_migration.dart';
|
import 'package:stackwallet/utilities/db_version_migration.dart';
|
||||||
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
import 'package:stackwallet/utilities/enums/backup_frequency_type.dart';
|
||||||
|
@ -66,6 +67,7 @@ import 'package:window_size/window_size.dart';
|
||||||
final openedFromSWBFileStringStateProvider =
|
final openedFromSWBFileStringStateProvider =
|
||||||
StateProvider<String?>((ref) => null);
|
StateProvider<String?>((ref) => null);
|
||||||
|
|
||||||
|
String? themeDirectory;
|
||||||
// main() is the entry point to the app. It initializes Hive (local database),
|
// 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
|
// runs the MyApp widget and checks for new users, caching the value in the
|
||||||
// miscellaneous box for later use
|
// miscellaneous box for later use
|
||||||
|
@ -178,6 +180,9 @@ void main() async {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Add Themes directory - TODO
|
||||||
|
// await StackFileSystem.applicationThemesDirectory();
|
||||||
|
|
||||||
monero.onStartup();
|
monero.onStartup();
|
||||||
wownero.onStartup();
|
wownero.onStartup();
|
||||||
|
|
||||||
|
@ -270,6 +275,10 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
|
||||||
await loadShared();
|
await loadShared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
themeDirectory = ref
|
||||||
|
.read(applicationThemesDirectoryPathProvider.notifier)
|
||||||
|
.state = (await StackFileSystem.applicationThemesDirectory()).path;
|
||||||
|
|
||||||
_notificationsService = ref.read(notificationsProvider);
|
_notificationsService = ref.read(notificationsProvider);
|
||||||
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
_nodeService = ref.read(nodeServiceChangeNotifierProvider);
|
||||||
_tradesService = ref.read(tradesServiceProvider);
|
_tradesService = ref.read(tradesServiceProvider);
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:cw_core/pathForWallet.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.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/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/color_theme.dart';
|
||||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
|
@ -106,7 +111,11 @@ class _SVG {
|
||||||
case ThemeType.chan:
|
case ThemeType.chan:
|
||||||
return "assets/svg/themed/${ThemeType.light.name}";
|
return "assets/svg/themed/${ThemeType.light.name}";
|
||||||
case ThemeType.darkChans:
|
case ThemeType.darkChans:
|
||||||
return "assets/svg/themed/${ThemeType.dark.name}";
|
// 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";
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "assets/svg/themed/${Theme.of(context).extension<StackColors>()!.themeType.name}";
|
return "assets/svg/themed/${Theme.of(context).extension<StackColors>()!.themeType.name}";
|
||||||
|
|
|
@ -62,4 +62,17 @@ abstract class StackFileSystem {
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<Directory> applicationThemesDirectory() async {
|
||||||
|
final root = await applicationRootDirectory();
|
||||||
|
if (Util.isDesktop) {
|
||||||
|
final dir = Directory("${root.path}/themes");
|
||||||
|
if (!dir.existsSync()) {
|
||||||
|
await dir.create();
|
||||||
|
}
|
||||||
|
return dir;
|
||||||
|
} else {
|
||||||
|
return root;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue