mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-06-28 20:39:51 +00:00
New themes (#2239)
* Add theme base v2 * Initial new theme base files * Typos * Fixes * Update theme files * feat: Migrate to Material 3 Theming Foundation, Theme Data Refactor, and First Extension Cleanup Batch. This commit completes the first major phase of migrating to Material 3 theming by setting up the foundations for material 3 integration and begins the initial migration, removing custom theme extensions, updating theme data, and refactoring all relevant widget and page theming to use Material 3’s built-in color and typography tokens. These changes: - Lays the groundwork for Material 3 theming by restructuring the app’s theme configuration to use Material 3’s ColorScheme and TextTheme as the primary sources of color and typography throughout the app. - Refactors the core theme config files by removing legacy custom color roles ensuring all color definitions now map directly to Material 3’s role. - Begins the first batch migration of custom theme extensions (InfoTheme, PlaceholderTheme, KeyboardTheme, PinCodeTheme) and updates all affected widgets and pages to use Material 3 color and typography tokens instead of the custom properties. - Cleans up the codebase by deleting the files of the initial set of migrated extensions and eliminating all related imports and usages. * feat: Migrate to Material 3 Theming. This change: - Updates the themes README.md file to reflect the current structure and give more information based on the first major phase that was completed. * feat: Migrate to Material 3 Theming Deleting previous theme extensions * feat: Migrate to Material 3 Theming Another batch of migrations from existing extensions * feat: Migration to Material 3 Theming Third Migration batch for theme extensions * fwat: Migration to Material 3 Theming Final Migration batch for previous theme extensions * Update onboarding hero * Update button radius * Add surfaceContainer to light theme * feat(themes): Migrate to Material 3 Theming This change: - Adds new set of hero images - Modifies the core structure for the themes - Add missing color tokens to the theme classes - Adds a CustomThemeColor class for custom color tokens - Modifies the themelist to have a fall back for previous theme implementation - Adds localization for some texts - Modifies the flow for loading the theme on app start - Add a WidgetsBindingObserver that listens for changes in the device theme and updates the app theme when there is a change - Registers the themeStore as a Singleton for codebase wide use * feat(themes): Migrate to Material 3 theming This change: - Migrates UI flows across the app to the new themes - Confirms styling and typography of components across the app uses the new themes - Remove instances of Palette use - Switch TextStyles across the app to use theme text styles * feat(themes): Migrate to Material 3 Theming. This change: - Adjusts bottomsheets styling and removes duplicate close button - Removes more themedata extensions from the previous implementation * - Remove outlines from cards and dock - Update menu colors - Update padding/divider size for cards * - Update PIN screen - Fix navigation dock shadow - Update wallet screen colors * Update border radius --skip-ci * feat(themes): Migrate to Material 3 Theming. This change: - Adds gradient backgrounds to the dashbaord and balance cards. - Migrates the input fields across the app to BaseTextFormFields. - Removes dependence of input fields on individual styling, focusing instead on using theme defined InputDecoration styling with adjustments on individual components where needed. - Applies new theme styling to BaseTextFormField, AddressTextField and CurrencyAmountTextField. * - Switch some hero images to PNG - Fix nagivation_dock shadow - Minor fixes * feat: Add fallback to previous underline styling in central widgets This change: - Adds a fallback to CurrencyAmountTextField, AddressTextField, and BaseTextFormField, allowing them use the previous theme styling. - Adds localization for new texts * feat(themes): Update warning box colors for dark and light themes * feat(themes): Relaod themes when user restores from backup, ensuring the user previous theme preference is used. * feat(themes): Handle themes logic during restore from backup This change: - Refactors theme loading logic to handle backup restore edgecase - Refreshes the theme based on the user saved preference during restore from backup flow * Fix card gradients and spacing * Fix even more radiuses Test new icons for navigation_dock.dart * Update onboarding flow backgrounds Fix swap icon clipping Fix some text colors Add more hero images * Fix incorrect color for light theme * Fix more hero images and cleanup * Update text field icons Fix info box CTA colors Fix sync indicator colors * Update toggle colors Update dark theme colors (minor) Update crypto_balance_widget.dart icon * Update page transitions in router.dart Fix some colors * feat(themes): Display label by default for filled textfields * feat(themes): Refactor theme handling across various components This change: - Fixes issue with themeMode resetting to system mode when app is restarted causing a UI glitch - Updates theme checks from `currentTheme.type == ThemeType.dark` to `currentTheme.isDark` for consistency - Adjusts UI components to use the theme directly from the themeStore * feat(themes): Add animating tagline to the create pin welcome screen * Revert text fields label temporarily, fix a couple colors, and cleanup some images --------- Co-authored-by: OmarHatem <omarh.ismail1@gmail.com> Co-authored-by: Blazebrain <davidadegoke16@gmail.com>
This commit is contained in:
parent
7b8ddf9685
commit
df88914628
412 changed files with 11173 additions and 13192 deletions
151
lib/main.dart
151
lib/main.dart
|
@ -25,7 +25,8 @@ import 'package:cake_wallet/routes.dart';
|
|||
import 'package:cake_wallet/src/screens/root/root.dart';
|
||||
import 'package:cake_wallet/store/app_store.dart';
|
||||
import 'package:cake_wallet/store/authentication_store.dart';
|
||||
import 'package:cake_wallet/themes/theme_base.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/themes/utils/theme_provider.dart';
|
||||
import 'package:cake_wallet/utils/device_info.dart';
|
||||
import 'package:cake_wallet/utils/exception_handler.dart';
|
||||
import 'package:cake_wallet/view_model/link_view_model.dart';
|
||||
|
@ -206,8 +207,7 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
|||
|
||||
final havenSeedStoreBoxKey =
|
||||
await getEncryptionKey(secureStorage: secureStorage, forKey: HavenSeedStore.boxKey);
|
||||
final havenSeedStore = await CakeHive.openBox<HavenSeedStore>(
|
||||
HavenSeedStore.boxName,
|
||||
final havenSeedStore = await CakeHive.openBox<HavenSeedStore>(HavenSeedStore.boxName,
|
||||
encryptionKey: havenSeedStoreBoxKey);
|
||||
|
||||
await initialSetup(
|
||||
|
@ -232,25 +232,26 @@ Future<void> initializeAppConfigs({bool loadWallet = true}) async {
|
|||
);
|
||||
}
|
||||
|
||||
Future<void> initialSetup(
|
||||
{required bool loadWallet,
|
||||
required SharedPreferences sharedPreferences,
|
||||
required Box<Node> nodes,
|
||||
required Box<Node> powNodes,
|
||||
required Box<WalletInfo> walletInfoSource,
|
||||
required Box<Contact> contactSource,
|
||||
required Box<Trade> tradesSource,
|
||||
required Box<Order> ordersSource,
|
||||
// required FiatConvertationService fiatConvertationService,
|
||||
required Box<Template> templates,
|
||||
required Box<ExchangeTemplate> exchangeTemplates,
|
||||
required Box<TransactionDescription> transactionDescriptions,
|
||||
required SecureStorage secureStorage,
|
||||
required Box<AnonpayInvoiceInfo> anonpayInvoiceInfo,
|
||||
required Box<UnspentCoinsInfo> unspentCoinsInfoSource,
|
||||
required Box<PayjoinSession> payjoinSessionSource,
|
||||
required Box<HavenSeedStore> havenSeedStore,
|
||||
int initialMigrationVersion = 15, }) async {
|
||||
Future<void> initialSetup({
|
||||
required bool loadWallet,
|
||||
required SharedPreferences sharedPreferences,
|
||||
required Box<Node> nodes,
|
||||
required Box<Node> powNodes,
|
||||
required Box<WalletInfo> walletInfoSource,
|
||||
required Box<Contact> contactSource,
|
||||
required Box<Trade> tradesSource,
|
||||
required Box<Order> ordersSource,
|
||||
// required FiatConvertationService fiatConvertationService,
|
||||
required Box<Template> templates,
|
||||
required Box<ExchangeTemplate> exchangeTemplates,
|
||||
required Box<TransactionDescription> transactionDescriptions,
|
||||
required SecureStorage secureStorage,
|
||||
required Box<AnonpayInvoiceInfo> anonpayInvoiceInfo,
|
||||
required Box<UnspentCoinsInfo> unspentCoinsInfoSource,
|
||||
required Box<PayjoinSession> payjoinSessionSource,
|
||||
required Box<HavenSeedStore> havenSeedStore,
|
||||
int initialMigrationVersion = 15,
|
||||
}) async {
|
||||
LanguageService.loadLocaleList();
|
||||
await defaultSettingsMigration(
|
||||
secureStorage: secureStorage,
|
||||
|
@ -289,50 +290,78 @@ class App extends StatefulWidget {
|
|||
AppState createState() => AppState();
|
||||
}
|
||||
|
||||
class AppState extends State<App> with SingleTickerProviderStateMixin {
|
||||
class AppState extends State<App> with SingleTickerProviderStateMixin, WidgetsBindingObserver {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void didChangePlatformBrightness() {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
if (appStore.themeStore.themeMode == ThemeMode.system) {
|
||||
final systemTheme = appStore.themeStore.getThemeFromSystem();
|
||||
if (appStore.themeStore.currentTheme != systemTheme) {
|
||||
appStore.themeStore.setTheme(systemTheme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Observer(builder: (BuildContext context) {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
final authService = getIt.get<AuthService>();
|
||||
final linkViewModel = getIt.get<LinkViewModel>();
|
||||
final settingsStore = appStore.settingsStore;
|
||||
final statusBarColor = Colors.transparent;
|
||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
|
||||
? Routes.welcome
|
||||
: Routes.login;
|
||||
final currentTheme = settingsStore.currentTheme;
|
||||
final statusBarBrightness =
|
||||
currentTheme.type == ThemeType.dark ? Brightness.light : Brightness.dark;
|
||||
final statusBarIconBrightness =
|
||||
currentTheme.type == ThemeType.dark ? Brightness.light : Brightness.dark;
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
statusBarColor: statusBarColor,
|
||||
statusBarBrightness: statusBarBrightness,
|
||||
statusBarIconBrightness: statusBarIconBrightness));
|
||||
return Observer(
|
||||
builder: (BuildContext context) {
|
||||
final appStore = getIt.get<AppStore>();
|
||||
final authService = getIt.get<AuthService>();
|
||||
final linkViewModel = getIt.get<LinkViewModel>();
|
||||
final statusBarColor = Colors.transparent;
|
||||
final authenticationStore = getIt.get<AuthenticationStore>();
|
||||
final initialRoute = authenticationStore.state == AuthenticationState.uninitialized
|
||||
? Routes.welcome
|
||||
: Routes.login;
|
||||
final currentTheme = appStore.themeStore.currentTheme;
|
||||
final statusBarBrightness = currentTheme.isDark ? Brightness.light : Brightness.dark;
|
||||
final statusBarIconBrightness = currentTheme.isDark ? Brightness.light : Brightness.dark;
|
||||
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
||||
statusBarColor: statusBarColor,
|
||||
statusBarBrightness: statusBarBrightness,
|
||||
statusBarIconBrightness: statusBarIconBrightness));
|
||||
|
||||
return Root(
|
||||
return Root(
|
||||
key: widget.key ?? rootKey,
|
||||
appStore: appStore,
|
||||
authenticationStore: authenticationStore,
|
||||
navigatorKey: navigatorKey,
|
||||
authService: authService,
|
||||
linkViewModel: linkViewModel,
|
||||
child: MaterialApp(
|
||||
navigatorObservers: [routeObserver],
|
||||
navigatorKey: navigatorKey,
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: settingsStore.theme,
|
||||
localizationsDelegates: localizationDelegates,
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
locale: Locale(settingsStore.languageCode),
|
||||
onGenerateRoute: (settings) => Router.createRoute(settings),
|
||||
initialRoute: initialRoute,
|
||||
scrollBehavior: AppScrollBehavior(),
|
||||
home: _Home(),
|
||||
));
|
||||
});
|
||||
child: ThemeProvider(
|
||||
themeStore: appStore.themeStore,
|
||||
materialAppBuilder: (context, theme, darkTheme, themeMode) => MaterialApp(
|
||||
navigatorObservers: [routeObserver],
|
||||
navigatorKey: navigatorKey,
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: theme,
|
||||
darkTheme: darkTheme,
|
||||
themeMode: themeMode,
|
||||
localizationsDelegates: localizationDelegates,
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
locale: Locale(appStore.settingsStore.languageCode),
|
||||
onGenerateRoute: (settings) => Router.createRoute(settings),
|
||||
initialRoute: initialRoute,
|
||||
scrollBehavior: AppScrollBehavior(),
|
||||
home: _Home(),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -392,11 +421,15 @@ class TopLevelErrorWidget extends StatelessWidget {
|
|||
children: [
|
||||
Text(
|
||||
'Error:\n${error.toString()}',
|
||||
style: TextStyle(fontSize: 22),
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(
|
||||
fontSize: 22,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Stack trace:\n${stackTrace.toString()}',
|
||||
style: TextStyle(fontSize: 16),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue