mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
* 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>
230 lines
6.6 KiB
Dart
230 lines
6.6 KiB
Dart
import 'package:cake_wallet/src/widgets/standard_list_card.dart';
|
|
import 'package:cake_wallet/src/widgets/standard_list_status_row.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class StandardListRow extends StatelessWidget {
|
|
StandardListRow({
|
|
required this.title,
|
|
required this.isSelected,
|
|
this.onTap,
|
|
this.decoration,
|
|
super.key,
|
|
});
|
|
|
|
final String title;
|
|
final bool isSelected;
|
|
final void Function(BuildContext context)? onTap;
|
|
final Decoration? decoration;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final leading = buildLeading(context);
|
|
final trailing = buildTrailing(context);
|
|
return Container(
|
|
height: 56,
|
|
padding: EdgeInsets.only(left: 12, right: 12),
|
|
child: TextButton(
|
|
onPressed: () => onTap?.call(context),
|
|
style: ButtonStyle(
|
|
//backgroundColor: MaterialStateProperty.all(Theme.of(context).colorScheme.surfaceContainer),
|
|
shape: WidgetStateProperty.all(
|
|
RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(10)),
|
|
),
|
|
),
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
if (leading != null) leading,
|
|
buildCenter(context, hasLeftOffset: leading != null),
|
|
if (trailing != null) trailing,
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget? buildLeading(BuildContext context) => null;
|
|
|
|
Widget buildCenter(BuildContext context, {required bool hasLeftOffset}) {
|
|
return Expanded(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
if (hasLeftOffset) SizedBox(width: 10),
|
|
Expanded(
|
|
child: Text(
|
|
title,
|
|
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
|
color: titleColor(context),
|
|
fontWeight: isSelected ? FontWeight.w800 : FontWeight.w400,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget? buildTrailing(BuildContext context) => null;
|
|
|
|
Color titleColor(BuildContext context) =>
|
|
isSelected ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.onSurface;
|
|
}
|
|
|
|
class SectionHeaderListRow extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) => Column(children: [
|
|
StandardListSeparator(padding: EdgeInsets.only(left: 24)),
|
|
Container(
|
|
width: double.infinity,
|
|
height: 40,
|
|
color: Theme.of(context).colorScheme.surface,
|
|
),
|
|
//StandardListSeparator(padding: EdgeInsets.only(left: 24))
|
|
]);
|
|
}
|
|
|
|
class StandardListSeparator extends StatelessWidget {
|
|
const StandardListSeparator({this.padding, this.height = 1});
|
|
|
|
final EdgeInsets? padding;
|
|
final double height;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
height: height,
|
|
padding: padding,
|
|
color: Colors.transparent,
|
|
child: Container(
|
|
height: height,
|
|
color: Colors.transparent,
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class StandardList extends StatelessWidget {
|
|
StandardList({required this.itemCount, required this.itemBuilder});
|
|
|
|
final int itemCount;
|
|
final IndexedWidgetBuilder itemBuilder;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.separated(
|
|
separatorBuilder: (_, __) => StandardListSeparator(padding: EdgeInsets.only(left: 24)),
|
|
itemCount: itemCount,
|
|
itemBuilder: itemBuilder);
|
|
}
|
|
}
|
|
|
|
class SectionStandardListItem {
|
|
SectionStandardListItem({this.hasFullSeparator = false, required this.child});
|
|
|
|
final bool hasFullSeparator;
|
|
final Widget child;
|
|
}
|
|
|
|
class SectionStandardList extends StatelessWidget {
|
|
SectionStandardList({
|
|
required this.itemCounter,
|
|
required this.itemBuilder,
|
|
required this.sectionCount,
|
|
this.dividerPadding = const EdgeInsets.only(left: 24),
|
|
this.sectionTitleBuilder,
|
|
this.hasTopSeparator = false,
|
|
}) : totalRows = [];
|
|
|
|
final int sectionCount;
|
|
final bool hasTopSeparator;
|
|
|
|
final int Function(int sectionIndex) itemCounter;
|
|
final Widget Function(int sectionIndex, int itemIndex) itemBuilder;
|
|
final Widget Function(int sectionIndex)? sectionTitleBuilder;
|
|
final List<Widget> totalRows;
|
|
final EdgeInsets dividerPadding;
|
|
|
|
List<Widget> transform(
|
|
bool hasTopSeparator,
|
|
int sectionCount,
|
|
int Function(int sectionIndex) itemCounter,
|
|
Widget Function(int sectionIndex, int itemIndex) itemBuilder,
|
|
Widget Function(int sectionIndex)? sectionTitleBuilder) {
|
|
final items = <Widget>[];
|
|
|
|
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
|
|
if ((sectionIndex == 0) && (hasTopSeparator)) {
|
|
items.add(StandardListSeparator(padding: EdgeInsets.only(left: 24)));
|
|
}
|
|
|
|
if (sectionTitleBuilder != null) {
|
|
items.add(buildTitle(items, sectionIndex));
|
|
}
|
|
|
|
final itemCount = itemCounter(sectionIndex);
|
|
|
|
items.addAll(buildSection(itemCount, items, sectionIndex));
|
|
|
|
items.add(sectionIndex + 1 != sectionCount
|
|
? SectionHeaderListRow()
|
|
: StandardListSeparator(padding: dividerPadding));
|
|
}
|
|
|
|
return items;
|
|
}
|
|
|
|
Widget buildTitle(List<Widget> items, int sectionIndex) {
|
|
if (sectionTitleBuilder == null) {
|
|
throw Exception('Cannot to build title. sectionTitleBuilder is null');
|
|
}
|
|
|
|
return sectionTitleBuilder!.call(sectionIndex);
|
|
}
|
|
|
|
List<Widget> buildSection(int itemCount, List<Widget> items, int sectionIndex) {
|
|
final List<Widget> section = [];
|
|
|
|
for (var itemIndex = 0; itemIndex < itemCount; itemIndex++) {
|
|
final item = itemBuilder(sectionIndex, itemIndex);
|
|
|
|
section.add(item);
|
|
}
|
|
return section;
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
totalRows.clear();
|
|
totalRows.addAll(
|
|
transform(hasTopSeparator, sectionCount, itemCounter, itemBuilder, sectionTitleBuilder));
|
|
|
|
return ListView.separated(
|
|
separatorBuilder: (_, index) {
|
|
final row = totalRows[index];
|
|
|
|
if (row is StandardListSeparator || row is SectionHeaderListRow) {
|
|
return Container();
|
|
}
|
|
|
|
if (row is StandardListStatusRow || row is TradeDetailsStandardListCard) {
|
|
return Container();
|
|
}
|
|
|
|
final nextRow = totalRows[index + 1];
|
|
|
|
// If current row is pre last and last row is separator.
|
|
if (nextRow is StandardListSeparator || nextRow is SectionHeaderListRow) {
|
|
return Container();
|
|
}
|
|
|
|
return StandardListSeparator(padding: dividerPadding);
|
|
},
|
|
itemCount: totalRows.length,
|
|
itemBuilder: (_, index) => totalRows[index],
|
|
);
|
|
}
|
|
}
|