From 2baaf5c0bbbbf6098949595fdc24bd004ba036ca Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Tue, 18 Apr 2023 09:33:00 +0200 Subject: [PATCH 01/17] feat(ui_kit): add more control over flat button prefix/suffix color --- .../flat_button/flat_button_screen.dart | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart index cffc95da..da65300f 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart @@ -169,7 +169,11 @@ class FlatButtonScreen extends CubitScreen { mainAxisSize: mainAxisSize ?? MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - if (style.foregroundColors?.color != null && + if (prefix != null && + (prefix is Icon?) && + ((prefix as Icon?)?.color != null)) ...[ + prefix! + ] else if (style.foregroundColors?.color != null && prefix != null) ...[ ColorFiltered( colorFilter: ColorFilter.mode( @@ -208,7 +212,21 @@ class FlatButtonScreen extends CubitScreen { ) ], Gap(style.padding?.vertical ?? 10), - if (style.foregroundColors?.color != null && + if (suffix != null && + (suffix is Icon?) && + ((suffix as Icon?)?.color != null)) ...[ + suffix! + ] else if (style.foregroundColors?.colors != null && + style.foregroundColors!.colors.isNotEmpty && + suffix != null) ...[ + ColorFiltered( + colorFilter: ColorFilter.mode( + style.foregroundColors!.colors.last, + BlendMode.srcIn, + ), + child: suffix, + ) + ] else if (style.foregroundColors?.color != null && suffix != null) ...[ ColorFiltered( colorFilter: ColorFilter.mode( -- 2.47.2 From 32cc6e8288ae08915f52b362bf50d7a260923790 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Tue, 18 Apr 2023 11:47:56 +0200 Subject: [PATCH 02/17] feat(ui_kit): make flat button fade on transition --- .../flat_button/flat_button_screen.dart | 205 +++++++++--------- 1 file changed, 108 insertions(+), 97 deletions(-) diff --git a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart index da65300f..bd5648e1 100644 --- a/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart +++ b/packages/wyatt_ui_kit/lib/src/components/buttons/flat_button/flat_button_screen.dart @@ -130,115 +130,126 @@ class FlatButtonScreen extends CubitScreen { onPressed?.call(state.state); bloc(context).onClickUpOut(); }, - child: DecoratedBox( + child: AnimatedContainer( + // TODO(wyatt): make it configurable, and generalize it + duration: const Duration(milliseconds: 150), + curve: Curves.easeOut, decoration: BoxDecoration( color: style.backgroundColors?.color, - // If no border color => no default value - border: (style.borderColors != null && style.stroke != null) - ? (style.borderColors?.isGradient ?? false) - ? GradientBoxBorder( - gradient: LinearGradient( - colors: style.borderColors!.colors, - ), - width: style.stroke!, - ) - : Border.all( - color: style.borderColors!.color, - width: style.stroke!, - ) - : null, + // if no gradient colors => no default value gradient: (style.backgroundColors?.isGradient ?? false) ? LinearGradient( colors: style.backgroundColors!.colors, ) : null, - boxShadow: [ - if (style.shadow != null) ...[style.shadow!] - ], + borderRadius: style.radius, ), - child: ConstrainedBox( - constraints: const BoxConstraints( - minWidth: 88, - minHeight: 36, - ), // min sizes for Material buttons - child: Padding( - padding: style.padding ?? EdgeInsets.zero, - child: Row( - mainAxisSize: mainAxisSize ?? MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - if (prefix != null && - (prefix is Icon?) && - ((prefix as Icon?)?.color != null)) ...[ - prefix! - ] else if (style.foregroundColors?.color != null && - prefix != null) ...[ - ColorFiltered( - colorFilter: ColorFilter.mode( - style.foregroundColors!.color, - BlendMode.srcIn, - ), - child: prefix, - ) - ] else ...[ - prefix ?? const SizedBox.shrink() - ], - Gap(style.padding?.vertical ?? 10), + child: DecoratedBox( + decoration: BoxDecoration( + // If no border color => no default value + border: (style.borderColors != null && style.stroke != null) + ? (style.borderColors?.isGradient ?? false) + ? GradientBoxBorder( + gradient: LinearGradient( + colors: style.borderColors!.colors, + ), + width: style.stroke!, + ) + : Border.all( + color: style.borderColors!.color, + width: style.stroke!, + ) + : null, - /// Choose color - /// buttonStyle.label.style.color ?? - /// context.textTheme.labelLarge.color - /// - /// Choose gradient - /// label.gradient ?? - /// buttonStyle.foregroundColor.colors ?? - /// null - /// - /// More infos in ThemeResolver class - if (label != null) ...[ - Text( - label!.data, - style: label!.style ?? style.label, - textAlign: label!.textAlign, - textDirection: label!.textDirection, - softWrap: label!.softWrap, - overflow: label!.overflow, - maxLines: label!.maxLines, - selectionColor: label!.selectionColor, - ).toGradient( - gradientColors: style.foregroundColors, - ) + boxShadow: [ + if (style.shadow != null) ...[style.shadow!] + ], + borderRadius: style.radius, + ), + child: ConstrainedBox( + constraints: const BoxConstraints( + minWidth: 88, + minHeight: 36, + ), // min sizes for Material buttons + child: Padding( + padding: style.padding ?? EdgeInsets.zero, + child: Row( + mainAxisSize: mainAxisSize ?? MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + if (prefix != null && + (prefix is Icon?) && + ((prefix as Icon?)?.color != null)) ...[ + prefix! + ] else if (style.foregroundColors?.color != null && + prefix != null) ...[ + ColorFiltered( + colorFilter: ColorFilter.mode( + style.foregroundColors!.color, + BlendMode.srcIn, + ), + child: prefix, + ) + ] else ...[ + prefix ?? const SizedBox.shrink() + ], + Gap(style.padding?.vertical ?? 10), + + /// Choose color + /// buttonStyle.label.style.color ?? + /// context.textTheme.labelLarge.color + /// + /// Choose gradient + /// label.gradient ?? + /// buttonStyle.foregroundColor.colors ?? + /// null + /// + /// More infos in ThemeResolver class + if (label != null) ...[ + Text( + label!.data, + style: label!.style ?? style.label, + textAlign: label!.textAlign, + textDirection: label!.textDirection, + softWrap: label!.softWrap, + overflow: label!.overflow, + maxLines: label!.maxLines, + selectionColor: label!.selectionColor, + ).toGradient( + gradientColors: style.foregroundColors, + ) + ], + Gap(style.padding?.vertical ?? 10), + if (suffix != null && + (suffix is Icon?) && + ((suffix as Icon?)?.color != null)) ...[ + suffix! + ] else if (style.foregroundColors?.colors != null && + style.foregroundColors!.colors.isNotEmpty && + suffix != null) ...[ + ColorFiltered( + colorFilter: ColorFilter.mode( + style.foregroundColors!.colors.last, + BlendMode.srcIn, + ), + child: suffix, + ) + ] else if (style.foregroundColors?.color != null && + suffix != null) ...[ + ColorFiltered( + colorFilter: ColorFilter.mode( + style.foregroundColors!.color, + BlendMode.srcIn, + ), + child: suffix, + ) + ] else ...[ + suffix ?? const SizedBox.shrink() + ], ], - Gap(style.padding?.vertical ?? 10), - if (suffix != null && - (suffix is Icon?) && - ((suffix as Icon?)?.color != null)) ...[ - suffix! - ] else if (style.foregroundColors?.colors != null && - style.foregroundColors!.colors.isNotEmpty && - suffix != null) ...[ - ColorFiltered( - colorFilter: ColorFilter.mode( - style.foregroundColors!.colors.last, - BlendMode.srcIn, - ), - child: suffix, - ) - ] else if (style.foregroundColors?.color != null && - suffix != null) ...[ - ColorFiltered( - colorFilter: ColorFilter.mode( - style.foregroundColors!.color, - BlendMode.srcIn, - ), - child: suffix, - ) - ] else ...[ - suffix ?? const SizedBox.shrink() - ], - ], + ), ), ), ), -- 2.47.2 From cef73aa62de6d693e74255620a1bd815f88fdefc Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Wed, 26 Apr 2023 18:12:10 +0200 Subject: [PATCH 03/17] fix(gen): rename builder correctly --- .../lib/wyatt_component_copy_with_extension.dart | 2 +- packages/wyatt_component_copy_with_gen/build.yaml | 8 ++++---- .../lib/wyatt_component_copy_with_gen.dart | 2 +- packages/wyatt_ui_components/build.yaml | 4 ++-- packages/wyatt_ui_kit/build.yaml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/wyatt_component_copy_with_extension/lib/wyatt_component_copy_with_extension.dart b/packages/wyatt_component_copy_with_extension/lib/wyatt_component_copy_with_extension.dart index 9ba9c518..ba920e68 100644 --- a/packages/wyatt_component_copy_with_extension/lib/wyatt_component_copy_with_extension.dart +++ b/packages/wyatt_component_copy_with_extension/lib/wyatt_component_copy_with_extension.dart @@ -15,7 +15,7 @@ // along with this program. If not, see . /// Extension for component copy with feature -library component_copy_with_extension; +library wyatt_component_copy_with_extension; export './src/domain/domain.dart'; export 'src/component_copy_with_extension.dart'; diff --git a/packages/wyatt_component_copy_with_gen/build.yaml b/packages/wyatt_component_copy_with_gen/build.yaml index 5d11aeaf..ec4b846d 100644 --- a/packages/wyatt_component_copy_with_gen/build.yaml +++ b/packages/wyatt_component_copy_with_gen/build.yaml @@ -1,7 +1,7 @@ targets: $default: builders: - component_copy_with_gen: + wyatt_component_copy_with_gen: enabled: true generate_for: exclude: @@ -11,9 +11,9 @@ targets: - test/gen_* builders: - component_copy_with_gen: - target: ":component_copy_with_gen" - import: "package:wyatt_component_copy_with_gen/component_copy_with_gen.dart" + wyatt_component_copy_with_gen: + target: ":wyatt_component_copy_with_gen" + import: "package:wyatt_component_copy_with_gen/wyatt_component_copy_with_gen.dart" builder_factories: ["componentCopyWithReporter"] build_extensions: { ".dart": ["copy_with_extension_gen.g.part"] } auto_apply: dependents diff --git a/packages/wyatt_component_copy_with_gen/lib/wyatt_component_copy_with_gen.dart b/packages/wyatt_component_copy_with_gen/lib/wyatt_component_copy_with_gen.dart index 6e51cdd6..3ae2761e 100644 --- a/packages/wyatt_component_copy_with_gen/lib/wyatt_component_copy_with_gen.dart +++ b/packages/wyatt_component_copy_with_gen/lib/wyatt_component_copy_with_gen.dart @@ -15,7 +15,7 @@ // along with this program. If not, see . /// Generator for copywith method for components -library component_copy_with_gen; +library wyatt_component_copy_with_gen; export 'src/builder.dart'; export 'src/generators/component_copy_with_generator.dart'; diff --git a/packages/wyatt_ui_components/build.yaml b/packages/wyatt_ui_components/build.yaml index 2c112259..5b42632a 100644 --- a/packages/wyatt_ui_components/build.yaml +++ b/packages/wyatt_ui_components/build.yaml @@ -2,8 +2,8 @@ targets: $default: builders: # Typically the builder key is just the package name, run `pub run build_runner doctor` to check your config. - wyatt_component_copy_with_gen:component_copy_with_gen: + wyatt_component_copy_with_gen:wyatt_component_copy_with_gen: generate_for: # Example glob for only the Dart files under `lib/models` - lib/**/*.dart - - example/lib/**/*.dart \ No newline at end of file + - example/lib/**/*.dart diff --git a/packages/wyatt_ui_kit/build.yaml b/packages/wyatt_ui_kit/build.yaml index 70c89a03..663add87 100644 --- a/packages/wyatt_ui_kit/build.yaml +++ b/packages/wyatt_ui_kit/build.yaml @@ -2,7 +2,7 @@ targets: $default: builders: # Typically the builder key is just the package name, run `pub run build_runner doctor` to check your config. - wyatt_component_copy_with_gen:component_copy_with_gen: + wyatt_component_copy_with_gen:wyatt_component_copy_with_gen: generate_for: # Example glob for only the Dart files under `lib/models` - - lib/**/*.dart \ No newline at end of file + - lib/**/*.dart -- 2.47.2 From 3fb40205945679a3bc4156dae6397b5398f3b959 Mon Sep 17 00:00:00 2001 From: Hugo Pointcheval Date: Wed, 26 Apr 2023 18:14:00 +0200 Subject: [PATCH 04/17] feat(ui): fix, rename, rewrite some helpers --- .../lib/src/core/core.dart | 1 - .../src/core/extensions/string_extension.dart | 25 ------- .../lib/src/core/utils/gradient_helper.dart | 38 +++++++++++ .../lib/src/core/utils/text_wrapper.dart | 29 ++++++--- .../lib/src/core/utils/theme_helper.dart | 65 +++++++++++++++---- .../lib/src/core/utils/theme_importer.dart} | 25 +++++-- .../lib/src/core/utils/theme_resolver.dart | 59 +++++++++-------- .../lib/src/core/utils/utils.dart | 1 + packages/wyatt_ui_kit/lib/src/core/core.dart | 1 - .../lib/src/core/helpers/helpers.dart | 17 ----- .../features/wyatt_component_theme_data.dart | 4 ++ 11 files changed, 169 insertions(+), 96 deletions(-) delete mode 100644 packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart create mode 100644 packages/wyatt_ui_components/lib/src/core/utils/gradient_helper.dart rename packages/{wyatt_ui_kit/lib/src/core/helpers/linear_gradient_helper.dart => wyatt_ui_components/lib/src/core/utils/theme_importer.dart} (58%) delete mode 100644 packages/wyatt_ui_kit/lib/src/core/helpers/helpers.dart diff --git a/packages/wyatt_ui_components/lib/src/core/core.dart b/packages/wyatt_ui_components/lib/src/core/core.dart index 50874264..e4df47c7 100644 --- a/packages/wyatt_ui_components/lib/src/core/core.dart +++ b/packages/wyatt_ui_components/lib/src/core/core.dart @@ -16,6 +16,5 @@ export 'enums/enums.dart'; export 'extensions/build_context_extensions.dart'; -export 'extensions/string_extension.dart'; export 'mixins/copy_with_mixin.dart'; export 'utils/utils.dart'; diff --git a/packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart b/packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart deleted file mode 100644 index d0eb575b..00000000 --- a/packages/wyatt_ui_components/lib/src/core/extensions/string_extension.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (C) 2023 WYATT GROUP -// Please see the AUTHORS file for details. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -import 'package:flutter/widgets.dart'; -import 'package:wyatt_ui_components/wyatt_ui_components.dart'; - -extension StringExtension on String? { - TextWrapper? wrap({TextStyle? style, MultiColor? gradientColors}) => - this != null - ? TextWrapper(this!, style: style, gradientColors: gradientColors) - : null; -} diff --git a/packages/wyatt_ui_components/lib/src/core/utils/gradient_helper.dart b/packages/wyatt_ui_components/lib/src/core/utils/gradient_helper.dart new file mode 100644 index 00000000..740d9281 --- /dev/null +++ b/packages/wyatt_ui_components/lib/src/core/utils/gradient_helper.dart @@ -0,0 +1,38 @@ +// Copyright (C) 2023 WYATT GROUP +// Please see the AUTHORS file for details. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +import 'package:flutter/material.dart'; +import 'package:wyatt_ui_components/wyatt_ui_components.dart'; + +abstract class GradientHelper { + static LinearGradient? linearFromNullableColors(List? colors) => + colors != null ? LinearGradient(colors: colors) : null; + + static LinearGradient? linearFromMultiColor(MultiColor multiColor) => + multiColor.isGradient ? LinearGradient(colors: multiColor.colors) : null; + + static RadialGradient? radialFromNullableColors(List? colors) => + colors != null ? RadialGradient(colors: colors) : null; + + static RadialGradient? radialFromMultiColor(MultiColor multiColor) => + multiColor.isGradient ? RadialGradient(colors: multiColor.colors) : null; + + static SweepGradient? sweepFromNullableColors(List? colors) => + colors != null ? SweepGradient(colors: colors) : null; + + static SweepGradient? sweepFromMultiColor(MultiColor multiColor) => + multiColor.isGradient ? SweepGradient(colors: multiColor.colors) : null; +} diff --git a/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart b/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart index 2c6e248e..bed9dd99 100644 --- a/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart +++ b/packages/wyatt_ui_components/lib/src/core/utils/text_wrapper.dart @@ -36,15 +36,28 @@ class TextWrapper { }); /// Creates a [TextWrapper] from a [Text] widget. - const TextWrapper.text(this.data) - : style = null, + TextWrapper.text(Text text) + : data = text.data!, + style = text.style, gradientColors = null, - textAlign = null, - textDirection = null, - softWrap = null, - overflow = null, - maxLines = null, - selectionColor = null; + textAlign = text.textAlign, + textDirection = text.textDirection, + softWrap = text.softWrap, + overflow = text.overflow, + maxLines = text.maxLines, + selectionColor = text.selectionColor; + + /// Creates a [TextWrapper] from a [RichText] widget. + TextWrapper.rich(RichText richText) + : data = richText.text.toPlainText(), + style = richText.text.style, + gradientColors = null, + textAlign = richText.textAlign, + textDirection = richText.textDirection, + softWrap = richText.softWrap, + overflow = richText.overflow, + maxLines = richText.maxLines, + selectionColor = richText.selectionColor; /// Text to be displayed final String data; diff --git a/packages/wyatt_ui_components/lib/src/core/utils/theme_helper.dart b/packages/wyatt_ui_components/lib/src/core/utils/theme_helper.dart index 97fe94a0..f376b5c9 100644 --- a/packages/wyatt_ui_components/lib/src/core/utils/theme_helper.dart +++ b/packages/wyatt_ui_components/lib/src/core/utils/theme_helper.dart @@ -16,33 +16,76 @@ /// A helper class for getting theme elements. abstract class ThemeHelper { - /// Gets a theme element from a list of styles. + /// Gets a nullable theme element from a list of styles. + /// {@template getElement} /// Styles are checked in order, and the first one that passes the /// [valueValidator] is returned. /// Style elements are transformed using the [transform] function. /// - /// [styles]: A list of styles that need to be checked. - /// [transform]: A function that transforms each style element - /// to a [T] type. - /// [valueValidator]: An optional validation function that - /// determines if a style element is valid. - /// [combine]: A function that combines two [P] type objects to create - /// a new object. - static T? getThemeElement( + /// - [styles] : A list of styles that need to be checked. + /// + /// - [transform] : An optional function that transforms each style element + /// to a [T] type after it passes the [valueValidator]. *(default: returns + /// element as is)* + /// + /// - [valueValidator] : An optional validation function that + /// determines if a style element is valid. *(default: checks if element + /// is not null)* + /// + /// - [combine] : A function that combines two [P] type objects to create + /// a new object. *(default: returns the first element)* + /// + /// So, if you only pass a [styles] list, the first valid style element + /// will be returned as is. + /// If you pass a [transform] function, the first valid style element + /// will be transformed to a [T] type. + /// {@endtemplate} + static T? maybeGetElement( List? styles, { - required T? Function(P?)? transform, + T? Function(P?)? transform, bool? Function(P?)? valueValidator, P? Function(P?, P?)? combine, }) { + // List of valid styles final Iterable? validStyles = styles?.where( (element) => valueValidator?.call(element) ?? (element != null), ); + + // tranformation function + final transformation = transform ?? (element) => element as T?; + return (validStyles?.isNotEmpty ?? false) - ? transform?.call( + ? transformation.call( validStyles?.reduce( (value, element) => combine?.call(value, element) ?? value, ), ) : null; } + + /// Gets a theme element from a list of styles. Throws an exception if no + /// valid style is found. + /// + /// See [maybeGetElement] for more details. + /// + /// {@macro getElement} + static T getElement( + List? styles, { + T? Function(P?)? transform, + bool? Function(P?)? valueValidator, + P? Function(P?, P?)? combine, + }) { + final result = maybeGetElement( + styles, + transform: transform, + valueValidator: valueValidator, + combine: combine, + ); + + if (result == null) { + throw Exception('No valid style found'); + } + + return result; + } } diff --git a/packages/wyatt_ui_kit/lib/src/core/helpers/linear_gradient_helper.dart b/packages/wyatt_ui_components/lib/src/core/utils/theme_importer.dart similarity index 58% rename from packages/wyatt_ui_kit/lib/src/core/helpers/linear_gradient_helper.dart rename to packages/wyatt_ui_components/lib/src/core/utils/theme_importer.dart index 49eb9c80..a5c5eae0 100644 --- a/packages/wyatt_ui_kit/lib/src/core/helpers/linear_gradient_helper.dart +++ b/packages/wyatt_ui_components/lib/src/core/utils/theme_importer.dart @@ -15,12 +15,25 @@ // along with this program. If not, see . import 'package:flutter/material.dart'; -import 'package:wyatt_ui_components/wyatt_ui_components.dart'; -class LinearGradientHelper { - static LinearGradient? fromNullableColors(List? colors) => - colors != null ? LinearGradient(colors: colors) : null; +abstract class ThemeImporter { + /// Imports a [ThemeData] from either a [BuildContext] or a [ThemeData]. + /// + /// Throws an [ArgumentError] if the type of [from] is not a [BuildContext] + /// or a [ThemeData]. + static ThemeData importFrom(T from) { + ThemeData theme; - static LinearGradient? fromMultiColor(MultiColor multiColor) => - multiColor.isGradient ? LinearGradient(colors: multiColor.colors) : null; + if (from is BuildContext) { + theme = Theme.of(from); + } else if (from is ThemeData) { + theme = from; + } else { + throw ArgumentError( + 'from must be either a BuildContext or a ThemeData', + ); + } + + return theme; + } } diff --git a/packages/wyatt_ui_components/lib/src/core/utils/theme_resolver.dart b/packages/wyatt_ui_components/lib/src/core/utils/theme_resolver.dart index a8cb2d1e..72a9d231 100644 --- a/packages/wyatt_ui_components/lib/src/core/utils/theme_resolver.dart +++ b/packages/wyatt_ui_components/lib/src/core/utils/theme_resolver.dart @@ -26,47 +26,52 @@ import 'package:wyatt_ui_components/src/domain/entities/theme_style.dart'; /// 1) Pass the "radius" into the constructor, `Component(radius: 12)`. /// 2) Set up a theme extension `ComponentThemeExtension(radius: 15)`. /// 3) Let `wyatt_ui_kit` "negotiate" and try to find a suitable style in the -/// flutter theme. +/// flutter theme, or use a hardcoded value. /// -/// If this negotiation phase fails, then: -/// - If the value is mandatory: a hardcoded value in "wyatt_ui_kit" is chosen. -/// - If not, the style is simply not applied. +/// If a negotiation phase fails, it will fallback to the next one. +/// +/// This resolver uses [ThemeHelper] to negotiate and merge styles. /// {@endtemplate} -abstract class ThemeResolver, T, E> { +abstract class ThemeResolver