master #81

Closed
malo wants to merge 322 commits from master into feat/bloc_layout/new-package
29 changed files with 787 additions and 223 deletions
Showing only changes of commit 4030511f4a - Show all commits

View File

@ -35,59 +35,55 @@ abstract class ThemeResolver<S extends ThemeStyle<S>, T, E> {
/// {@macro theme_resolver} /// {@macro theme_resolver}
const ThemeResolver(); const ThemeResolver();
S? Function(BuildContext context, S extensionValue, {E? extra}) S? Function(BuildContext context, {E? extra}) get customStyleFn;
get customStyleFn;
/// Compute default value from Flutter Theme or with hardcoded values. /// Compute default value from Flutter Theme or with hardcoded values.
S computeDefaultValue(BuildContext context, {E? extra}); S computeDefaultValue(BuildContext context, {E? extra});
S? computeExtensionValueFn( S? computeExtensionValueFn(
BuildContext context, BuildContext context,
S defaultValue,
T themeExtension, { T themeExtension, {
E? extra, E? extra,
}); });
/// Compute values from the extension if found /// Compute values from the extension if found
S? _computeExtensionValue( S? _computeExtensionValue(
BuildContext context, BuildContext context, {
S defaultValue, {
E? extra, E? extra,
}) { }) {
final themeExtension = Theme.of(context).extension<T>(); final themeExtension = Theme.of(context).extension<T>();
if (themeExtension != null) { if (themeExtension != null) {
return computeExtensionValueFn( return computeExtensionValueFn(
context, context,
defaultValue,
themeExtension, themeExtension,
extra: extra, extra: extra,
); );
} }
return defaultValue; return null;
} }
/// Compute custom value /// Compute custom value
S? _computeCustomValue( S? _computeCustomValue(
BuildContext context, BuildContext context, {
S previousPhaseValue, {
E? extra, E? extra,
}) { }) {
final customStyle = customStyleFn( final customStyle = customStyleFn(
context, context,
previousPhaseValue,
extra: extra, extra: extra,
); );
if (customStyle != null) { if (customStyle != null) {
return customStyle; return customStyle;
} }
return previousPhaseValue; return null;
} }
/// Choose most suitable style for a given context. /// Choose most suitable style for a given context.
S negotiate(BuildContext context, {E? extra}) { S negotiate(BuildContext context, {E? extra}) {
S style = computeDefaultValue(context, extra: extra); S style = computeDefaultValue(context, extra: extra);
style = _computeExtensionValue(context, style, extra: extra) ?? style; style =
style = _computeCustomValue(context, style, extra: extra) ?? style; style.mergeWith(_computeExtensionValue(context, extra: extra)) ?? style;
style =
style.mergeWith(_computeCustomValue(context, extra: extra)) ?? style;
return style; return style;
} }
} }

View File

@ -16,10 +16,13 @@
import 'dart:ui'; import 'dart:ui';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart'; import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart'; import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
part 'file_selection_button_style.g.dart';
@CopyWith()
class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> { class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
const FileSelectionButtonStyle({ const FileSelectionButtonStyle({
this.title, this.title,
@ -106,35 +109,4 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
@override @override
FileSelectionButtonStyle mergeWith(FileSelectionButtonStyle? other) => FileSelectionButtonStyle mergeWith(FileSelectionButtonStyle? other) =>
FileSelectionButtonStyle.merge(this, other)!; FileSelectionButtonStyle.merge(this, other)!;
@override
FileSelectionButtonStyle? lerpWith(
FileSelectionButtonStyle? other,
double t,
) =>
FileSelectionButtonStyle.lerp(this, other, t);
@override
FileSelectionButtonStyle copyWith({
TextStyle? title,
TextStyle? subTitle,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
FileSelectionButtonStyle(
title: title ?? this.title,
subTitle: subTitle ?? this.subTitle,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
} }

View File

@ -0,0 +1,152 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'file_selection_button_style.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$FileSelectionButtonStyleCWProxy {
FileSelectionButtonStyle title(TextStyle? title);
FileSelectionButtonStyle subTitle(TextStyle? subTitle);
FileSelectionButtonStyle radius(BorderRadiusGeometry? radius);
FileSelectionButtonStyle padding(EdgeInsetsGeometry? padding);
FileSelectionButtonStyle foregroundColors(MultiColor? foregroundColors);
FileSelectionButtonStyle backgroundColors(MultiColor? backgroundColors);
FileSelectionButtonStyle borderColors(MultiColor? borderColors);
FileSelectionButtonStyle stroke(double? stroke);
FileSelectionButtonStyle shadow(BoxShadow? shadow);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `FileSelectionButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// FileSelectionButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
FileSelectionButtonStyle call({
TextStyle? title,
TextStyle? subTitle,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfFileSelectionButtonStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfFileSelectionButtonStyle.copyWith.fieldName(...)`
class _$FileSelectionButtonStyleCWProxyImpl
implements _$FileSelectionButtonStyleCWProxy {
const _$FileSelectionButtonStyleCWProxyImpl(this._value);
final FileSelectionButtonStyle _value;
@override
FileSelectionButtonStyle title(TextStyle? title) => this(title: title);
@override
FileSelectionButtonStyle subTitle(TextStyle? subTitle) =>
this(subTitle: subTitle);
@override
FileSelectionButtonStyle radius(BorderRadiusGeometry? radius) =>
this(radius: radius);
@override
FileSelectionButtonStyle padding(EdgeInsetsGeometry? padding) =>
this(padding: padding);
@override
FileSelectionButtonStyle foregroundColors(MultiColor? foregroundColors) =>
this(foregroundColors: foregroundColors);
@override
FileSelectionButtonStyle backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
FileSelectionButtonStyle borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
FileSelectionButtonStyle stroke(double? stroke) => this(stroke: stroke);
@override
FileSelectionButtonStyle shadow(BoxShadow? shadow) => this(shadow: shadow);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `FileSelectionButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// FileSelectionButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
FileSelectionButtonStyle call({
Object? title = const $CopyWithPlaceholder(),
Object? subTitle = const $CopyWithPlaceholder(),
Object? radius = const $CopyWithPlaceholder(),
Object? padding = const $CopyWithPlaceholder(),
Object? foregroundColors = const $CopyWithPlaceholder(),
Object? backgroundColors = const $CopyWithPlaceholder(),
Object? borderColors = const $CopyWithPlaceholder(),
Object? stroke = const $CopyWithPlaceholder(),
Object? shadow = const $CopyWithPlaceholder(),
}) {
return FileSelectionButtonStyle(
title: title == const $CopyWithPlaceholder()
? _value.title
// ignore: cast_nullable_to_non_nullable
: title as TextStyle?,
subTitle: subTitle == const $CopyWithPlaceholder()
? _value.subTitle
// ignore: cast_nullable_to_non_nullable
: subTitle as TextStyle?,
radius: radius == const $CopyWithPlaceholder()
? _value.radius
// ignore: cast_nullable_to_non_nullable
: radius as BorderRadiusGeometry?,
padding: padding == const $CopyWithPlaceholder()
? _value.padding
// ignore: cast_nullable_to_non_nullable
: padding as EdgeInsetsGeometry?,
foregroundColors: foregroundColors == const $CopyWithPlaceholder()
? _value.foregroundColors
// ignore: cast_nullable_to_non_nullable
: foregroundColors as MultiColor?,
backgroundColors: backgroundColors == const $CopyWithPlaceholder()
? _value.backgroundColors
// ignore: cast_nullable_to_non_nullable
: backgroundColors as MultiColor?,
borderColors: borderColors == const $CopyWithPlaceholder()
? _value.borderColors
// ignore: cast_nullable_to_non_nullable
: borderColors as MultiColor?,
stroke: stroke == const $CopyWithPlaceholder()
? _value.stroke
// ignore: cast_nullable_to_non_nullable
: stroke as double?,
shadow: shadow == const $CopyWithPlaceholder()
? _value.shadow
// ignore: cast_nullable_to_non_nullable
: shadow as BoxShadow?,
);
}
}
extension $FileSelectionButtonStyleCopyWith on FileSelectionButtonStyle {
/// Returns a callable class that can be used as follows: `instanceOfFileSelectionButtonStyle.copyWith(...)` or like so:`instanceOfFileSelectionButtonStyle.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$FileSelectionButtonStyleCWProxy get copyWith =>
_$FileSelectionButtonStyleCWProxyImpl(this);
}

View File

@ -16,10 +16,13 @@
import 'dart:ui'; import 'dart:ui';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart'; import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart'; import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
part 'flat_button_style.g.dart';
@CopyWith()
class FlatButtonStyle extends ButtonStyle<FlatButtonStyle> { class FlatButtonStyle extends ButtonStyle<FlatButtonStyle> {
const FlatButtonStyle({ const FlatButtonStyle({
this.label, this.label,
@ -98,30 +101,4 @@ class FlatButtonStyle extends ButtonStyle<FlatButtonStyle> {
@override @override
FlatButtonStyle mergeWith(FlatButtonStyle? other) => FlatButtonStyle mergeWith(FlatButtonStyle? other) =>
FlatButtonStyle.merge(this, other)!; FlatButtonStyle.merge(this, other)!;
@override
FlatButtonStyle? lerpWith(FlatButtonStyle? other, double t) =>
FlatButtonStyle.lerp(this, other, t);
@override
FlatButtonStyle copyWith({
TextStyle? label,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
FlatButtonStyle(
label: label ?? this.label,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
} }

View File

@ -0,0 +1,137 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'flat_button_style.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$FlatButtonStyleCWProxy {
FlatButtonStyle label(TextStyle? label);
FlatButtonStyle radius(BorderRadiusGeometry? radius);
FlatButtonStyle padding(EdgeInsetsGeometry? padding);
FlatButtonStyle foregroundColors(MultiColor? foregroundColors);
FlatButtonStyle backgroundColors(MultiColor? backgroundColors);
FlatButtonStyle borderColors(MultiColor? borderColors);
FlatButtonStyle stroke(double? stroke);
FlatButtonStyle shadow(BoxShadow? shadow);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `FlatButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// FlatButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
FlatButtonStyle call({
TextStyle? label,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfFlatButtonStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfFlatButtonStyle.copyWith.fieldName(...)`
class _$FlatButtonStyleCWProxyImpl implements _$FlatButtonStyleCWProxy {
const _$FlatButtonStyleCWProxyImpl(this._value);
final FlatButtonStyle _value;
@override
FlatButtonStyle label(TextStyle? label) => this(label: label);
@override
FlatButtonStyle radius(BorderRadiusGeometry? radius) => this(radius: radius);
@override
FlatButtonStyle padding(EdgeInsetsGeometry? padding) =>
this(padding: padding);
@override
FlatButtonStyle foregroundColors(MultiColor? foregroundColors) =>
this(foregroundColors: foregroundColors);
@override
FlatButtonStyle backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
FlatButtonStyle borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
FlatButtonStyle stroke(double? stroke) => this(stroke: stroke);
@override
FlatButtonStyle shadow(BoxShadow? shadow) => this(shadow: shadow);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `FlatButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// FlatButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
FlatButtonStyle call({
Object? label = const $CopyWithPlaceholder(),
Object? radius = const $CopyWithPlaceholder(),
Object? padding = const $CopyWithPlaceholder(),
Object? foregroundColors = const $CopyWithPlaceholder(),
Object? backgroundColors = const $CopyWithPlaceholder(),
Object? borderColors = const $CopyWithPlaceholder(),
Object? stroke = const $CopyWithPlaceholder(),
Object? shadow = const $CopyWithPlaceholder(),
}) {
return FlatButtonStyle(
label: label == const $CopyWithPlaceholder()
? _value.label
// ignore: cast_nullable_to_non_nullable
: label as TextStyle?,
radius: radius == const $CopyWithPlaceholder()
? _value.radius
// ignore: cast_nullable_to_non_nullable
: radius as BorderRadiusGeometry?,
padding: padding == const $CopyWithPlaceholder()
? _value.padding
// ignore: cast_nullable_to_non_nullable
: padding as EdgeInsetsGeometry?,
foregroundColors: foregroundColors == const $CopyWithPlaceholder()
? _value.foregroundColors
// ignore: cast_nullable_to_non_nullable
: foregroundColors as MultiColor?,
backgroundColors: backgroundColors == const $CopyWithPlaceholder()
? _value.backgroundColors
// ignore: cast_nullable_to_non_nullable
: backgroundColors as MultiColor?,
borderColors: borderColors == const $CopyWithPlaceholder()
? _value.borderColors
// ignore: cast_nullable_to_non_nullable
: borderColors as MultiColor?,
stroke: stroke == const $CopyWithPlaceholder()
? _value.stroke
// ignore: cast_nullable_to_non_nullable
: stroke as double?,
shadow: shadow == const $CopyWithPlaceholder()
? _value.shadow
// ignore: cast_nullable_to_non_nullable
: shadow as BoxShadow?,
);
}
}
extension $FlatButtonStyleCopyWith on FlatButtonStyle {
/// Returns a callable class that can be used as follows: `instanceOfFlatButtonStyle.copyWith(...)` or like so:`instanceOfFlatButtonStyle.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$FlatButtonStyleCWProxy get copyWith => _$FlatButtonStyleCWProxyImpl(this);
}

View File

@ -16,10 +16,13 @@
import 'dart:ui'; import 'dart:ui';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart'; import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart'; import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
part 'simple_icon_button_style.g.dart';
@CopyWith()
class SimpleIconButtonStyle extends ButtonStyle<SimpleIconButtonStyle> { class SimpleIconButtonStyle extends ButtonStyle<SimpleIconButtonStyle> {
const SimpleIconButtonStyle({ const SimpleIconButtonStyle({
this.dimension, this.dimension,
@ -98,30 +101,4 @@ class SimpleIconButtonStyle extends ButtonStyle<SimpleIconButtonStyle> {
@override @override
SimpleIconButtonStyle mergeWith(SimpleIconButtonStyle? other) => SimpleIconButtonStyle mergeWith(SimpleIconButtonStyle? other) =>
SimpleIconButtonStyle.merge(this, other)!; SimpleIconButtonStyle.merge(this, other)!;
@override
SimpleIconButtonStyle? lerpWith(SimpleIconButtonStyle? other, double t) =>
SimpleIconButtonStyle.lerp(this, other, t);
@override
SimpleIconButtonStyle copyWith({
double? dimension,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
SimpleIconButtonStyle(
dimension: dimension ?? this.dimension,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
} }

View File

@ -0,0 +1,141 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'simple_icon_button_style.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$SimpleIconButtonStyleCWProxy {
SimpleIconButtonStyle dimension(double? dimension);
SimpleIconButtonStyle radius(BorderRadiusGeometry? radius);
SimpleIconButtonStyle padding(EdgeInsetsGeometry? padding);
SimpleIconButtonStyle foregroundColors(MultiColor? foregroundColors);
SimpleIconButtonStyle backgroundColors(MultiColor? backgroundColors);
SimpleIconButtonStyle borderColors(MultiColor? borderColors);
SimpleIconButtonStyle stroke(double? stroke);
SimpleIconButtonStyle shadow(BoxShadow? shadow);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SimpleIconButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// SimpleIconButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
SimpleIconButtonStyle call({
double? dimension,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfSimpleIconButtonStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfSimpleIconButtonStyle.copyWith.fieldName(...)`
class _$SimpleIconButtonStyleCWProxyImpl
implements _$SimpleIconButtonStyleCWProxy {
const _$SimpleIconButtonStyleCWProxyImpl(this._value);
final SimpleIconButtonStyle _value;
@override
SimpleIconButtonStyle dimension(double? dimension) =>
this(dimension: dimension);
@override
SimpleIconButtonStyle radius(BorderRadiusGeometry? radius) =>
this(radius: radius);
@override
SimpleIconButtonStyle padding(EdgeInsetsGeometry? padding) =>
this(padding: padding);
@override
SimpleIconButtonStyle foregroundColors(MultiColor? foregroundColors) =>
this(foregroundColors: foregroundColors);
@override
SimpleIconButtonStyle backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
SimpleIconButtonStyle borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
SimpleIconButtonStyle stroke(double? stroke) => this(stroke: stroke);
@override
SimpleIconButtonStyle shadow(BoxShadow? shadow) => this(shadow: shadow);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SimpleIconButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// SimpleIconButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
SimpleIconButtonStyle call({
Object? dimension = const $CopyWithPlaceholder(),
Object? radius = const $CopyWithPlaceholder(),
Object? padding = const $CopyWithPlaceholder(),
Object? foregroundColors = const $CopyWithPlaceholder(),
Object? backgroundColors = const $CopyWithPlaceholder(),
Object? borderColors = const $CopyWithPlaceholder(),
Object? stroke = const $CopyWithPlaceholder(),
Object? shadow = const $CopyWithPlaceholder(),
}) {
return SimpleIconButtonStyle(
dimension: dimension == const $CopyWithPlaceholder()
? _value.dimension
// ignore: cast_nullable_to_non_nullable
: dimension as double?,
radius: radius == const $CopyWithPlaceholder()
? _value.radius
// ignore: cast_nullable_to_non_nullable
: radius as BorderRadiusGeometry?,
padding: padding == const $CopyWithPlaceholder()
? _value.padding
// ignore: cast_nullable_to_non_nullable
: padding as EdgeInsetsGeometry?,
foregroundColors: foregroundColors == const $CopyWithPlaceholder()
? _value.foregroundColors
// ignore: cast_nullable_to_non_nullable
: foregroundColors as MultiColor?,
backgroundColors: backgroundColors == const $CopyWithPlaceholder()
? _value.backgroundColors
// ignore: cast_nullable_to_non_nullable
: backgroundColors as MultiColor?,
borderColors: borderColors == const $CopyWithPlaceholder()
? _value.borderColors
// ignore: cast_nullable_to_non_nullable
: borderColors as MultiColor?,
stroke: stroke == const $CopyWithPlaceholder()
? _value.stroke
// ignore: cast_nullable_to_non_nullable
: stroke as double?,
shadow: shadow == const $CopyWithPlaceholder()
? _value.shadow
// ignore: cast_nullable_to_non_nullable
: shadow as BoxShadow?,
);
}
}
extension $SimpleIconButtonStyleCopyWith on SimpleIconButtonStyle {
/// Returns a callable class that can be used as follows: `instanceOfSimpleIconButtonStyle.copyWith(...)` or like so:`instanceOfSimpleIconButtonStyle.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$SimpleIconButtonStyleCWProxy get copyWith =>
_$SimpleIconButtonStyleCWProxyImpl(this);
}

View File

@ -16,10 +16,13 @@
import 'dart:ui'; import 'dart:ui';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/src/core/utils/multi_color.dart'; import 'package:wyatt_ui_components/src/core/utils/multi_color.dart';
import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart'; import 'package:wyatt_ui_components/src/domain/entities/buttons/button_style.dart';
part 'symbol_button_style.g.dart';
@CopyWith()
class SymbolButtonStyle extends ButtonStyle<SymbolButtonStyle> { class SymbolButtonStyle extends ButtonStyle<SymbolButtonStyle> {
const SymbolButtonStyle({ const SymbolButtonStyle({
this.label, this.label,
@ -106,32 +109,4 @@ class SymbolButtonStyle extends ButtonStyle<SymbolButtonStyle> {
@override @override
SymbolButtonStyle mergeWith(SymbolButtonStyle? other) => SymbolButtonStyle mergeWith(SymbolButtonStyle? other) =>
SymbolButtonStyle.merge(this, other)!; SymbolButtonStyle.merge(this, other)!;
@override
SymbolButtonStyle? lerpWith(SymbolButtonStyle? other, double t) =>
SymbolButtonStyle.lerp(this, other, t);
@override
SymbolButtonStyle copyWith({
TextStyle? label,
double? dimension,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
}) =>
SymbolButtonStyle(
label: label ?? this.label,
dimension: dimension ?? this.dimension,
radius: radius ?? this.radius,
padding: padding ?? this.padding,
foregroundColors: foregroundColors ?? this.foregroundColors,
backgroundColors: backgroundColors ?? this.backgroundColors,
borderColors: borderColors ?? this.borderColors,
stroke: stroke ?? this.stroke,
shadow: shadow ?? this.shadow,
);
} }

View File

@ -0,0 +1,150 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'symbol_button_style.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$SymbolButtonStyleCWProxy {
SymbolButtonStyle label(TextStyle? label);
SymbolButtonStyle dimension(double? dimension);
SymbolButtonStyle radius(BorderRadiusGeometry? radius);
SymbolButtonStyle padding(EdgeInsetsGeometry? padding);
SymbolButtonStyle foregroundColors(MultiColor? foregroundColors);
SymbolButtonStyle backgroundColors(MultiColor? backgroundColors);
SymbolButtonStyle borderColors(MultiColor? borderColors);
SymbolButtonStyle stroke(double? stroke);
SymbolButtonStyle shadow(BoxShadow? shadow);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SymbolButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// SymbolButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
SymbolButtonStyle call({
TextStyle? label,
double? dimension,
BorderRadiusGeometry? radius,
EdgeInsetsGeometry? padding,
MultiColor? foregroundColors,
MultiColor? backgroundColors,
MultiColor? borderColors,
double? stroke,
BoxShadow? shadow,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfSymbolButtonStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfSymbolButtonStyle.copyWith.fieldName(...)`
class _$SymbolButtonStyleCWProxyImpl implements _$SymbolButtonStyleCWProxy {
const _$SymbolButtonStyleCWProxyImpl(this._value);
final SymbolButtonStyle _value;
@override
SymbolButtonStyle label(TextStyle? label) => this(label: label);
@override
SymbolButtonStyle dimension(double? dimension) => this(dimension: dimension);
@override
SymbolButtonStyle radius(BorderRadiusGeometry? radius) =>
this(radius: radius);
@override
SymbolButtonStyle padding(EdgeInsetsGeometry? padding) =>
this(padding: padding);
@override
SymbolButtonStyle foregroundColors(MultiColor? foregroundColors) =>
this(foregroundColors: foregroundColors);
@override
SymbolButtonStyle backgroundColors(MultiColor? backgroundColors) =>
this(backgroundColors: backgroundColors);
@override
SymbolButtonStyle borderColors(MultiColor? borderColors) =>
this(borderColors: borderColors);
@override
SymbolButtonStyle stroke(double? stroke) => this(stroke: stroke);
@override
SymbolButtonStyle shadow(BoxShadow? shadow) => this(shadow: shadow);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `SymbolButtonStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// SymbolButtonStyle(...).copyWith(id: 12, name: "My name")
/// ````
SymbolButtonStyle call({
Object? label = const $CopyWithPlaceholder(),
Object? dimension = const $CopyWithPlaceholder(),
Object? radius = const $CopyWithPlaceholder(),
Object? padding = const $CopyWithPlaceholder(),
Object? foregroundColors = const $CopyWithPlaceholder(),
Object? backgroundColors = const $CopyWithPlaceholder(),
Object? borderColors = const $CopyWithPlaceholder(),
Object? stroke = const $CopyWithPlaceholder(),
Object? shadow = const $CopyWithPlaceholder(),
}) {
return SymbolButtonStyle(
label: label == const $CopyWithPlaceholder()
? _value.label
// ignore: cast_nullable_to_non_nullable
: label as TextStyle?,
dimension: dimension == const $CopyWithPlaceholder()
? _value.dimension
// ignore: cast_nullable_to_non_nullable
: dimension as double?,
radius: radius == const $CopyWithPlaceholder()
? _value.radius
// ignore: cast_nullable_to_non_nullable
: radius as BorderRadiusGeometry?,
padding: padding == const $CopyWithPlaceholder()
? _value.padding
// ignore: cast_nullable_to_non_nullable
: padding as EdgeInsetsGeometry?,
foregroundColors: foregroundColors == const $CopyWithPlaceholder()
? _value.foregroundColors
// ignore: cast_nullable_to_non_nullable
: foregroundColors as MultiColor?,
backgroundColors: backgroundColors == const $CopyWithPlaceholder()
? _value.backgroundColors
// ignore: cast_nullable_to_non_nullable
: backgroundColors as MultiColor?,
borderColors: borderColors == const $CopyWithPlaceholder()
? _value.borderColors
// ignore: cast_nullable_to_non_nullable
: borderColors as MultiColor?,
stroke: stroke == const $CopyWithPlaceholder()
? _value.stroke
// ignore: cast_nullable_to_non_nullable
: stroke as double?,
shadow: shadow == const $CopyWithPlaceholder()
? _value.shadow
// ignore: cast_nullable_to_non_nullable
: shadow as BoxShadow?,
);
}
}
extension $SymbolButtonStyleCopyWith on SymbolButtonStyle {
/// Returns a callable class that can be used as follows: `instanceOfSymbolButtonStyle.copyWith(...)` or like so:`instanceOfSymbolButtonStyle.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$SymbolButtonStyleCWProxy get copyWith =>
_$SymbolButtonStyleCWProxyImpl(this);
}

View File

@ -16,8 +16,11 @@
import 'dart:ui'; import 'dart:ui';
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'loader_style.g.dart';
@CopyWith()
class LoaderStyle extends ThemeStyle<LoaderStyle> { class LoaderStyle extends ThemeStyle<LoaderStyle> {
const LoaderStyle({ const LoaderStyle({
this.colors, this.colors,
@ -67,20 +70,6 @@ class LoaderStyle extends ThemeStyle<LoaderStyle> {
@override @override
LoaderStyle mergeWith(LoaderStyle? other) => LoaderStyle.merge(this, other)!; LoaderStyle mergeWith(LoaderStyle? other) => LoaderStyle.merge(this, other)!;
@override
LoaderStyle? lerpWith(LoaderStyle? other, double t) =>
LoaderStyle.lerp(this, other, t);
@override
LoaderStyle copyWith({
MultiColor? colors,
double? stroke,
}) =>
LoaderStyle(
colors: colors ?? this.colors,
stroke: stroke ?? this.stroke,
);
@override @override
String toString() => 'LoaderStyle($colors, $stroke)'; String toString() => 'LoaderStyle($colors, $stroke)';
} }

View File

@ -0,0 +1,67 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'loader_style.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$LoaderStyleCWProxy {
LoaderStyle colors(MultiColor? colors);
LoaderStyle stroke(double? stroke);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `LoaderStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// LoaderStyle(...).copyWith(id: 12, name: "My name")
/// ````
LoaderStyle call({
MultiColor? colors,
double? stroke,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfLoaderStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfLoaderStyle.copyWith.fieldName(...)`
class _$LoaderStyleCWProxyImpl implements _$LoaderStyleCWProxy {
const _$LoaderStyleCWProxyImpl(this._value);
final LoaderStyle _value;
@override
LoaderStyle colors(MultiColor? colors) => this(colors: colors);
@override
LoaderStyle stroke(double? stroke) => this(stroke: stroke);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `LoaderStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// LoaderStyle(...).copyWith(id: 12, name: "My name")
/// ````
LoaderStyle call({
Object? colors = const $CopyWithPlaceholder(),
Object? stroke = const $CopyWithPlaceholder(),
}) {
return LoaderStyle(
colors: colors == const $CopyWithPlaceholder()
? _value.colors
// ignore: cast_nullable_to_non_nullable
: colors as MultiColor?,
stroke: stroke == const $CopyWithPlaceholder()
? _value.stroke
// ignore: cast_nullable_to_non_nullable
: stroke as double?,
);
}
}
extension $LoaderStyleCopyWith on LoaderStyle {
/// Returns a callable class that can be used as follows: `instanceOfLoaderStyle.copyWith(...)` or like so:`instanceOfLoaderStyle.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$LoaderStyleCWProxy get copyWith => _$LoaderStyleCWProxyImpl(this);
}

View File

@ -14,9 +14,12 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:copy_with_extension/copy_with_extension.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart'; import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'rich_text_builder_style.g.dart';
@CopyWith()
class RichTextBuilderStyle extends ThemeStyle<RichTextBuilderStyle> { class RichTextBuilderStyle extends ThemeStyle<RichTextBuilderStyle> {
const RichTextBuilderStyle({ const RichTextBuilderStyle({
this.defaultStyle, this.defaultStyle,
@ -66,18 +69,4 @@ class RichTextBuilderStyle extends ThemeStyle<RichTextBuilderStyle> {
@override @override
RichTextBuilderStyle mergeWith(RichTextBuilderStyle? other) => RichTextBuilderStyle mergeWith(RichTextBuilderStyle? other) =>
RichTextBuilderStyle.merge(this, other)!; RichTextBuilderStyle.merge(this, other)!;
@override
RichTextBuilderStyle? lerpWith(RichTextBuilderStyle? other, double t) =>
RichTextBuilderStyle.lerp(this, other, t);
@override
RichTextBuilderStyle copyWith({
TextStyle? defaultStyle,
Map<String, TextStyle>? styles,
}) =>
RichTextBuilderStyle(
defaultStyle: defaultStyle ?? this.defaultStyle,
styles: styles ?? this.styles,
);
} }

View File

@ -0,0 +1,71 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'rich_text_builder_style.dart';
// **************************************************************************
// CopyWithGenerator
// **************************************************************************
abstract class _$RichTextBuilderStyleCWProxy {
RichTextBuilderStyle defaultStyle(TextStyle? defaultStyle);
RichTextBuilderStyle styles(Map<String, TextStyle>? styles);
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RichTextBuilderStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// RichTextBuilderStyle(...).copyWith(id: 12, name: "My name")
/// ````
RichTextBuilderStyle call({
TextStyle? defaultStyle,
Map<String, TextStyle>? styles,
});
}
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfRichTextBuilderStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfRichTextBuilderStyle.copyWith.fieldName(...)`
class _$RichTextBuilderStyleCWProxyImpl
implements _$RichTextBuilderStyleCWProxy {
const _$RichTextBuilderStyleCWProxyImpl(this._value);
final RichTextBuilderStyle _value;
@override
RichTextBuilderStyle defaultStyle(TextStyle? defaultStyle) =>
this(defaultStyle: defaultStyle);
@override
RichTextBuilderStyle styles(Map<String, TextStyle>? styles) =>
this(styles: styles);
@override
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `RichTextBuilderStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
///
/// Usage
/// ```dart
/// RichTextBuilderStyle(...).copyWith(id: 12, name: "My name")
/// ````
RichTextBuilderStyle call({
Object? defaultStyle = const $CopyWithPlaceholder(),
Object? styles = const $CopyWithPlaceholder(),
}) {
return RichTextBuilderStyle(
defaultStyle: defaultStyle == const $CopyWithPlaceholder()
? _value.defaultStyle
// ignore: cast_nullable_to_non_nullable
: defaultStyle as TextStyle?,
styles: styles == const $CopyWithPlaceholder()
? _value.styles
// ignore: cast_nullable_to_non_nullable
: styles as Map<String, TextStyle>?,
);
}
}
extension $RichTextBuilderStyleCopyWith on RichTextBuilderStyle {
/// Returns a callable class that can be used as follows: `instanceOfRichTextBuilderStyle.copyWith(...)` or like so:`instanceOfRichTextBuilderStyle.copyWith.fieldName(...)`.
// ignore: library_private_types_in_public_api
_$RichTextBuilderStyleCWProxy get copyWith =>
_$RichTextBuilderStyleCWProxyImpl(this);
}

View File

@ -20,7 +20,7 @@ import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
part 'text_input_style.g.dart'; part 'text_input_style.g.dart';
@CopyWith() @CopyWith()
class TextInputStyle { class TextInputStyle extends ThemeStyle<TextInputStyle> {
TextInputStyle({ TextInputStyle({
this.labelStyle, this.labelStyle,
this.hintStyle, this.hintStyle,
@ -99,4 +99,8 @@ class TextInputStyle {
iconColor: Color.lerp(a.iconColor, b.iconColor, t), iconColor: Color.lerp(a.iconColor, b.iconColor, t),
); );
} }
@override
TextInputStyle? mergeWith(TextInputStyle? other) =>
TextInputStyle.merge(this, other);
} }

View File

@ -18,11 +18,5 @@ abstract class ThemeStyle<T> {
const ThemeStyle(); const ThemeStyle();
/// Merges non-null `other` attributes in `this` and returns a copy. /// Merges non-null `other` attributes in `this` and returns a copy.
T mergeWith(T? other); T? mergeWith(T? other);
/// Used for interpolation.
T? lerpWith(T? other, double t);
/// Copy with (mandatory for mergeWith, needs to be simple and ignore `null`)
T copyWith();
} }

View File

@ -67,7 +67,7 @@ class FileSelectionButtonScreen
FileSelectionButtonStyle _resolve(BuildContext context, ButtonState state) { FileSelectionButtonStyle _resolve(BuildContext context, ButtonState state) {
final FileSelectionButtonThemeResolver resolver = themeResolver ?? final FileSelectionButtonThemeResolver resolver = themeResolver ??
FileSelectionButtonThemeResolver( FileSelectionButtonThemeResolver(
customStyleFn: (context, extensionValue, {extra}) { customStyleFn: (context, {extra}) {
FileSelectionButtonStyle? style; FileSelectionButtonStyle? style;
switch (extra?.state) { switch (extra?.state) {
case ControlState.disabled: case ControlState.disabled:

View File

@ -73,19 +73,17 @@ class FileSelectionButtonThemeResolver extends ThemeResolver<
@override @override
final FileSelectionButtonStyle? Function( final FileSelectionButtonStyle? Function(
BuildContext context, BuildContext context, {
FileSelectionButtonStyle? extensionValue, {
ButtonState? extra, ButtonState? extra,
}) customStyleFn; }) customStyleFn;
@override @override
FileSelectionButtonStyle? computeExtensionValueFn( FileSelectionButtonStyle? computeExtensionValueFn(
BuildContext context, BuildContext context,
FileSelectionButtonStyle defaultValue,
FileSelectionButtonThemeExtension themeExtension, { FileSelectionButtonThemeExtension themeExtension, {
ButtonState? extra, ButtonState? extra,
}) { }) {
FileSelectionButtonStyle? style = defaultValue; FileSelectionButtonStyle? style;
switch (extra?.state) { switch (extra?.state) {
case ControlState.disabled: case ControlState.disabled:
style = themeExtension.disabledStyle; style = themeExtension.disabledStyle;

View File

@ -61,7 +61,7 @@ class FlatButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
FlatButtonStyle _resolve(BuildContext context, ControlState state) { FlatButtonStyle _resolve(BuildContext context, ControlState state) {
final FlatButtonThemeResolver resolver = themeResolver ?? final FlatButtonThemeResolver resolver = themeResolver ??
FlatButtonThemeResolver( FlatButtonThemeResolver(
customStyleFn: (context, extensionValue, {extra}) { customStyleFn: (context, {extra}) {
switch (extra) { switch (extra) {
case ControlState.disabled: case ControlState.disabled:
return disabledStyle; return disabledStyle;

View File

@ -69,15 +69,13 @@ class FlatButtonThemeResolver extends ThemeResolver<FlatButtonStyle,
@override @override
final FlatButtonStyle? Function( final FlatButtonStyle? Function(
BuildContext context, BuildContext context, {
FlatButtonStyle? extensionValue, {
ControlState? extra, ControlState? extra,
}) customStyleFn; }) customStyleFn;
@override @override
FlatButtonStyle? computeExtensionValueFn( FlatButtonStyle? computeExtensionValueFn(
BuildContext context, BuildContext context,
FlatButtonStyle defaultValue,
FlatButtonThemeExtension themeExtension, { FlatButtonThemeExtension themeExtension, {
ControlState? extra, ControlState? extra,
}) { }) {

View File

@ -67,15 +67,13 @@ class SimpleIconButtonThemeResolver extends ThemeResolver<SimpleIconButtonStyle,
@override @override
final SimpleIconButtonStyle? Function( final SimpleIconButtonStyle? Function(
BuildContext context, BuildContext context, {
SimpleIconButtonStyle? extensionValue, {
ControlState? extra, ControlState? extra,
}) customStyleFn; }) customStyleFn;
@override @override
SimpleIconButtonStyle? computeExtensionValueFn( SimpleIconButtonStyle? computeExtensionValueFn(
BuildContext context, BuildContext context,
SimpleIconButtonStyle defaultValue,
SimpleIconButtonThemeExtension themeExtension, { SimpleIconButtonThemeExtension themeExtension, {
ControlState? extra, ControlState? extra,
}) { }) {

View File

@ -55,7 +55,7 @@ class SimpleIconButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
SimpleIconButtonStyle _resolve(BuildContext context, ControlState state) { SimpleIconButtonStyle _resolve(BuildContext context, ControlState state) {
final SimpleIconButtonThemeResolver resolver = themeResolver ?? final SimpleIconButtonThemeResolver resolver = themeResolver ??
SimpleIconButtonThemeResolver( SimpleIconButtonThemeResolver(
customStyleFn: (context, extensionValue, {extra}) { customStyleFn: (context, {extra}) {
switch (extra) { switch (extra) {
case ControlState.disabled: case ControlState.disabled:
return disabledStyle; return disabledStyle;

View File

@ -63,7 +63,7 @@ class SymbolButtonScreen
SymbolButtonStyle _resolve(BuildContext context, ButtonState state) { SymbolButtonStyle _resolve(BuildContext context, ButtonState state) {
final SymbolButtonThemeResolver resolver = themeResolver ?? final SymbolButtonThemeResolver resolver = themeResolver ??
SymbolButtonThemeResolver( SymbolButtonThemeResolver(
customStyleFn: (context, extensionValue, {extra}) { customStyleFn: (context, {extra}) {
SymbolButtonStyle? style; SymbolButtonStyle? style;
switch (extra?.state) { switch (extra?.state) {
case ControlState.disabled: case ControlState.disabled:

View File

@ -69,19 +69,17 @@ class SymbolButtonThemeResolver extends ThemeResolver<SymbolButtonStyle,
@override @override
final SymbolButtonStyle? Function( final SymbolButtonStyle? Function(
BuildContext context, BuildContext context, {
SymbolButtonStyle? extensionValue, {
ButtonState? extra, ButtonState? extra,
}) customStyleFn; }) customStyleFn;
@override @override
SymbolButtonStyle? computeExtensionValueFn( SymbolButtonStyle? computeExtensionValueFn(
BuildContext context, BuildContext context,
SymbolButtonStyle defaultValue,
SymbolButtonThemeExtension themeExtension, { SymbolButtonThemeExtension themeExtension, {
ButtonState? extra, ButtonState? extra,
}) { }) {
SymbolButtonStyle? style = defaultValue; SymbolButtonStyle? style;
switch (extra?.state) { switch (extra?.state) {
case ControlState.disabled: case ControlState.disabled:
style = themeExtension.disabledStyle; style = themeExtension.disabledStyle;

View File

@ -45,16 +45,6 @@ class Loader extends LoaderComponent with $LoaderCWMixin {
LoaderStyle _resolve(BuildContext context) { LoaderStyle _resolve(BuildContext context) {
final LoaderThemeResolver resolver = themeResolver ?? final LoaderThemeResolver resolver = themeResolver ??
LoaderThemeResolver( LoaderThemeResolver(
computeExtensionValueFn: (
context,
defaultValue,
themeExtension, {
extra,
}) =>
LoaderStyle(
colors: themeExtension.colors,
stroke: themeExtension.stroke,
),
customStyleFn: (context, {extra}) => LoaderStyle( customStyleFn: (context, {extra}) => LoaderStyle(
colors: colors, colors: colors,
stroke: stroke, stroke: stroke,

View File

@ -21,7 +21,6 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
class LoaderThemeResolver class LoaderThemeResolver
extends ThemeResolver<LoaderStyle, LoaderThemeExtension, void> { extends ThemeResolver<LoaderStyle, LoaderThemeExtension, void> {
const LoaderThemeResolver({ const LoaderThemeResolver({
required this.computeExtensionValueFn,
required this.customStyleFn, required this.customStyleFn,
}); });
@ -42,12 +41,18 @@ class LoaderThemeResolver
@override @override
final LoaderStyle? Function( final LoaderStyle? Function(
BuildContext context, BuildContext context, {
LoaderStyle defaultValue,
LoaderThemeExtension themeExtension, {
void extra, void extra,
}) computeExtensionValueFn; }) customStyleFn;
@override @override
final LoaderStyle? Function(BuildContext context, {void extra}) customStyleFn; LoaderStyle? computeExtensionValueFn(
BuildContext context,
LoaderThemeExtension themeExtension, {
void extra,
}) =>
LoaderStyle(
colors: themeExtension.colors,
stroke: themeExtension.stroke,
);
} }

View File

@ -42,16 +42,6 @@ class RichTextBuilder extends RichTextBuilderComponent
RichTextBuilderStyle _resolve(BuildContext context) { RichTextBuilderStyle _resolve(BuildContext context) {
final RichTextBuilderThemeResolver resolver = themeResolver ?? final RichTextBuilderThemeResolver resolver = themeResolver ??
RichTextBuilderThemeResolver( RichTextBuilderThemeResolver(
computeExtensionValueFn: (
context,
defaultValue,
themeExtension, {
extra,
}) =>
RichTextBuilderStyle(
defaultStyle: themeExtension.defaultStyle,
styles: themeExtension.styles,
),
customStyleFn: (context, {extra}) => RichTextBuilderStyle( customStyleFn: (context, {extra}) => RichTextBuilderStyle(
defaultStyle: defaultStyle, defaultStyle: defaultStyle,
styles: styles, styles: styles,

View File

@ -21,7 +21,6 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
class RichTextBuilderThemeResolver extends ThemeResolver<RichTextBuilderStyle, class RichTextBuilderThemeResolver extends ThemeResolver<RichTextBuilderStyle,
RichTextBuilderThemeExtension, void> { RichTextBuilderThemeExtension, void> {
const RichTextBuilderThemeResolver({ const RichTextBuilderThemeResolver({
required this.computeExtensionValueFn,
required this.customStyleFn, required this.customStyleFn,
}); });
@ -37,13 +36,18 @@ class RichTextBuilderThemeResolver extends ThemeResolver<RichTextBuilderStyle,
@override @override
final RichTextBuilderStyle? Function( final RichTextBuilderStyle? Function(
BuildContext context, BuildContext context, {
RichTextBuilderStyle defaultValue,
RichTextBuilderThemeExtension themeExtension, {
void extra, void extra,
}) computeExtensionValueFn; }) customStyleFn;
@override @override
final RichTextBuilderStyle? Function(BuildContext context, {void extra}) RichTextBuilderStyle? computeExtensionValueFn(
customStyleFn; BuildContext context,
RichTextBuilderThemeExtension themeExtension, {
void extra,
}) =>
RichTextBuilderStyle(
defaultStyle: themeExtension.defaultStyle,
styles: themeExtension.styles,
);
} }

View File

@ -195,7 +195,7 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
TextInputStyle _resolve(BuildContext context, TextInputState state) { TextInputStyle _resolve(BuildContext context, TextInputState state) {
final resolver = TextInputThemeResolver( final resolver = TextInputThemeResolver(
customStyleFn: (context, extensionValue, {extra}) { customStyleFn: (context, {extra}) {
TextInputStyle? textInputStyle; TextInputStyle? textInputStyle;
switch (extra?.controlState) { switch (extra?.controlState) {
case ControlState.focused: case ControlState.focused:
@ -230,10 +230,7 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
break; break;
} }
return TextInputStyle.merge( return TextInputStyle.merge(textInputStyle, style);
extensionValue,
TextInputStyle.merge(textInputStyle, style),
);
}, },
); );

View File

@ -28,8 +28,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
@override @override
final TextInputStyle? Function( final TextInputStyle? Function(
BuildContext context, BuildContext context, {
TextInputStyle extensionValue, {
TextInputState? extra, TextInputState? extra,
}) customStyleFn; }) customStyleFn;
@ -126,7 +125,6 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
@override @override
TextInputStyle? computeExtensionValueFn( TextInputStyle? computeExtensionValueFn(
BuildContext context, BuildContext context,
TextInputStyle defaultValue,
TextInputThemeExtension themeExtension, { TextInputThemeExtension themeExtension, {
TextInputState? extra, TextInputState? extra,
}) { }) {
@ -164,9 +162,6 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
break; break;
} }
return TextInputStyle.merge( return TextInputStyle.merge(textInputStyle, style);
defaultValue,
TextInputStyle.merge(textInputStyle, style),
);
} }
} }