mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-11-29 11:44:01 +01: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:
co-authored by
OmarHatem
Blazebrain
parent
7b8ddf9685
commit
df88914628
@@ -84,7 +84,7 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
}
|
||||
|
||||
final dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss.SSS');
|
||||
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: logs.length,
|
||||
itemBuilder: (context, index) {
|
||||
@@ -92,18 +92,16 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
log.message,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontFamily: 'Monospace',
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontFamily: 'Monospace',
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'${dateFormat.format(log.timestamp)} | ${log.level}' +
|
||||
(log.sessionId != null ? ' | Session: ${log.sessionId}' : ''),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
),
|
||||
dense: true,
|
||||
onTap: () {
|
||||
@@ -132,24 +130,24 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
}
|
||||
|
||||
final dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss');
|
||||
|
||||
|
||||
return ListView.builder(
|
||||
itemCount: sessions.length,
|
||||
itemBuilder: (context, index) {
|
||||
final session = sessions[index];
|
||||
final isActive = session.endTime == null;
|
||||
|
||||
|
||||
return ExpansionTile(
|
||||
title: Text(
|
||||
session.name,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isActive ? Colors.green : null,
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: isActive ? Colors.green : null,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'ID: ${session.id} | Started: ${dateFormat.format(session.startTime)}',
|
||||
style: TextStyle(fontSize: 12),
|
||||
style: Theme.of(context).textTheme.bodySmall!,
|
||||
),
|
||||
children: [
|
||||
Padding(
|
||||
@@ -158,8 +156,7 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Start: ${session.startTime.toString()}'),
|
||||
if (session.endTime != null)
|
||||
Text('End: ${session.endTime.toString()}'),
|
||||
if (session.endTime != null) Text('End: ${session.endTime.toString()}'),
|
||||
if (session.duration != null)
|
||||
Text('Duration: ${_formatDuration(session.duration!)}'),
|
||||
SizedBox(height: 8),
|
||||
@@ -174,19 +171,21 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
}
|
||||
|
||||
Widget _buildSessionLogs(BuildContext context, int sessionId) {
|
||||
final sessionLogs = viewModel.logs
|
||||
.where((log) => log.sessionId == sessionId)
|
||||
.toList();
|
||||
|
||||
final sessionLogs = viewModel.logs.where((log) => log.sessionId == sessionId).toList();
|
||||
|
||||
if (sessionLogs.isEmpty) {
|
||||
return Text('No logs for this session');
|
||||
}
|
||||
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Session Logs (${sessionLogs.length}):',
|
||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
'Session Logs (${sessionLogs.length}):',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 8),
|
||||
Container(
|
||||
height: 200,
|
||||
@@ -202,11 +201,10 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
|
||||
child: Text(
|
||||
'[${log.level}] ${log.message}',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'Monospace',
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
style: Theme.of(context).textTheme.bodySmall!.copyWith(
|
||||
fontFamily: 'Monospace',
|
||||
color: _getLevelColor(log.level),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -248,14 +246,14 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
|
||||
void _copyAllLogs(BuildContext context) {
|
||||
if (viewModel.logData == null) return;
|
||||
|
||||
|
||||
final buffer = StringBuffer();
|
||||
final dateFormat = DateFormat('yyyy-MM-dd HH:mm:ss.SSS');
|
||||
|
||||
|
||||
for (final log in viewModel.logs) {
|
||||
buffer.writeln('${dateFormat.format(log.timestamp)} [${log.level}] ${log.message}');
|
||||
}
|
||||
|
||||
|
||||
Clipboard.setData(ClipboardData(text: buffer.toString()));
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text('All logs copied to clipboard')),
|
||||
@@ -311,4 +309,4 @@ class DevBackgroundSyncLogsPage extends BasePage {
|
||||
String twoDigitSeconds = twoDigits(duration.inSeconds.remainder(60));
|
||||
return '${twoDigits(duration.inHours)}:$twoDigitMinutes:$twoDigitSeconds';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
||||
@override
|
||||
String? get title => "[dev] xmr background sync";
|
||||
|
||||
Widget _buildSingleCell(String title, String value) {
|
||||
Widget _buildSingleCell(String title, String value, BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Colors.grey),
|
||||
@@ -22,7 +22,12 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(title, style: TextStyle(fontWeight: FontWeight.bold)),
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Text(value, maxLines: 1, overflow: TextOverflow.ellipsis),
|
||||
],
|
||||
),
|
||||
@@ -36,59 +41,60 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
||||
return GridView.count(
|
||||
padding: const EdgeInsets.all(16),
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 25/9,
|
||||
childAspectRatio: 25 / 9,
|
||||
crossAxisSpacing: 16,
|
||||
mainAxisSpacing: 16,
|
||||
children: [
|
||||
_buildSingleCell('Height (local)', viewModel.localBlockHeight ?? ''),
|
||||
_buildSingleCell('Height (node)', viewModel.nodeBlockHeight ?? ''),
|
||||
_buildSingleCell('Time', viewModel.tick.toString()),
|
||||
_buildSingleCell('Background Sync', viewModel.isBackgroundSyncing ? 'Enabled' : 'Disabled'),
|
||||
_buildSingleCell('Public View Key', viewModel.publicViewKey ?? ''),
|
||||
_buildSingleCell('Private View Key', viewModel.privateViewKey ?? ''),
|
||||
_buildSingleCell('Public Spend Key', viewModel.publicSpendKey ?? ''),
|
||||
_buildSingleCell('Private Spend Key', viewModel.privateSpendKey ?? ''),
|
||||
_buildSingleCell('Primary Address', viewModel.primaryAddress ?? ''),
|
||||
_buildSingleCell('Passphrase', viewModel.passphrase ?? ''),
|
||||
_buildSingleCell('Seed', viewModel.seed ?? ''),
|
||||
_buildSingleCell('Seed Legacy', viewModel.seedLegacy ?? ''),
|
||||
_enableBackgroundSyncButton(),
|
||||
_disableBackgroundSyncButton(),
|
||||
_refreshButton(),
|
||||
_manualRescanButton(),
|
||||
_buildSingleCell('Height (local)', viewModel.localBlockHeight ?? '', context),
|
||||
_buildSingleCell('Height (node)', viewModel.nodeBlockHeight ?? '', context),
|
||||
_buildSingleCell('Time', viewModel.tick.toString(), context),
|
||||
_buildSingleCell(
|
||||
'Background Sync', viewModel.isBackgroundSyncing ? 'Enabled' : 'Disabled', context),
|
||||
_buildSingleCell('Public View Key', viewModel.publicViewKey ?? '', context),
|
||||
_buildSingleCell('Private View Key', viewModel.privateViewKey ?? '', context),
|
||||
_buildSingleCell('Public Spend Key', viewModel.publicSpendKey ?? '', context),
|
||||
_buildSingleCell('Private Spend Key', viewModel.privateSpendKey ?? '', context),
|
||||
_buildSingleCell('Primary Address', viewModel.primaryAddress ?? '', context),
|
||||
_buildSingleCell('Passphrase', viewModel.passphrase ?? '', context),
|
||||
_buildSingleCell('Seed', viewModel.seed ?? '', context),
|
||||
_buildSingleCell('Seed Legacy', viewModel.seedLegacy ?? '', context),
|
||||
_enableBackgroundSyncButton(context),
|
||||
_disableBackgroundSyncButton(context),
|
||||
_refreshButton(context),
|
||||
_manualRescanButton(context),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _enableBackgroundSyncButton() {
|
||||
PrimaryButton _enableBackgroundSyncButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: "Enable background sync",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
viewModel.startBackgroundSync();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _disableBackgroundSyncButton() {
|
||||
PrimaryButton _disableBackgroundSyncButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: "Disable background sync",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
viewModel.stopBackgroundSync();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _refreshButton() {
|
||||
PrimaryButton _refreshButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: viewModel.refreshTimer == null ? "Enable refresh" : "Disable refresh",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
if (viewModel.refreshTimer == null) {
|
||||
viewModel.startRefreshTimer();
|
||||
@@ -99,11 +105,11 @@ class DevMoneroBackgroundSyncPage extends BasePage {
|
||||
);
|
||||
}
|
||||
|
||||
PrimaryButton _manualRescanButton() {
|
||||
PrimaryButton _manualRescanButton(BuildContext context) {
|
||||
return PrimaryButton(
|
||||
text: "Manual rescan",
|
||||
color: Colors.purple,
|
||||
textColor: Colors.white,
|
||||
textColor: Theme.of(context).colorScheme.onPrimary,
|
||||
onPressed: () {
|
||||
viewModel.manualRescan();
|
||||
},
|
||||
|
||||
@@ -123,7 +123,7 @@ max: slowest execution (% of frame)
|
||||
SelectableText cw(String text, Color? color) {
|
||||
return SelectableText(
|
||||
text,
|
||||
style: TextStyle(color: color),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: color),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ max: slowest execution (% of frame)
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
key,
|
||||
style: TextStyle(color: perfc(np)),
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: perfc(np)),
|
||||
),
|
||||
subtitle: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
|
||||
@@ -38,10 +38,10 @@ class DevSecurePreferencesPage extends BasePage {
|
||||
Clipboard.setData(ClipboardData(text: key + ": " + values[key].toString()));
|
||||
},
|
||||
title: switch (type) {
|
||||
PreferenceType.bool => Text(key, style: TextStyle(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: TextStyle(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: TextStyle(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: TextStyle(color: Colors.purple)),
|
||||
PreferenceType.bool => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.purple)),
|
||||
PreferenceType.string => Text(key),
|
||||
PreferenceType.unknown => Text(key),
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
|
||||
import 'package:cake_wallet/view_model/dev/shared_preferences.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -49,10 +50,10 @@ class DevSharedPreferencesPage extends BasePage {
|
||||
_showEditDialog(context, key, type, values[key]);
|
||||
},
|
||||
title: switch (type) {
|
||||
PreferenceType.bool => Text(key, style: TextStyle(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: TextStyle(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: TextStyle(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: TextStyle(color: Colors.purple)),
|
||||
PreferenceType.bool => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.blue)),
|
||||
PreferenceType.int => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.green)),
|
||||
PreferenceType.double => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.yellow)),
|
||||
PreferenceType.listString => Text(key, style: Theme.of(context).textTheme.bodyMedium!.copyWith(color: Colors.purple)),
|
||||
PreferenceType.string => Text(key),
|
||||
PreferenceType.unknown => Text(key),
|
||||
},
|
||||
@@ -193,9 +194,9 @@ class DevSharedPreferencesPage extends BasePage {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
BaseTextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: 'String value'),
|
||||
hintText: 'String value',
|
||||
maxLines: null,
|
||||
),
|
||||
],
|
||||
@@ -206,9 +207,9 @@ class DevSharedPreferencesPage extends BasePage {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
BaseTextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: label),
|
||||
hintText: label,
|
||||
keyboardType: isInteger
|
||||
? TextInputType.number
|
||||
: TextInputType.numberWithOptions(decimal: true),
|
||||
@@ -261,9 +262,9 @@ class DevSharedPreferencesPage extends BasePage {
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TextField(
|
||||
child: BaseTextFormField(
|
||||
controller: controller,
|
||||
decoration: InputDecoration(labelText: 'New item'),
|
||||
hintText: 'New item',
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
@@ -344,9 +345,9 @@ class DevSharedPreferencesPage extends BasePage {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TextField(
|
||||
BaseTextFormField(
|
||||
controller: keyController,
|
||||
decoration: InputDecoration(labelText: 'Preference Key'),
|
||||
hintText: 'Preference Key',
|
||||
),
|
||||
SizedBox(height: 16),
|
||||
DropdownButtonFormField<PreferenceType>(
|
||||
|
||||
Reference in New Issue
Block a user