master #81
@ -35,59 +35,55 @@ abstract class ThemeResolver<S extends ThemeStyle<S>, T, E> {
|
||||
/// {@macro theme_resolver}
|
||||
const ThemeResolver();
|
||||
|
||||
S? Function(BuildContext context, S extensionValue, {E? extra})
|
||||
get customStyleFn;
|
||||
S? Function(BuildContext context, {E? extra}) get customStyleFn;
|
||||
|
||||
/// Compute default value from Flutter Theme or with hardcoded values.
|
||||
S computeDefaultValue(BuildContext context, {E? extra});
|
||||
|
||||
S? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
S defaultValue,
|
||||
T themeExtension, {
|
||||
E? extra,
|
||||
});
|
||||
|
||||
/// Compute values from the extension if found
|
||||
S? _computeExtensionValue(
|
||||
BuildContext context,
|
||||
S defaultValue, {
|
||||
BuildContext context, {
|
||||
E? extra,
|
||||
}) {
|
||||
final themeExtension = Theme.of(context).extension<T>();
|
||||
if (themeExtension != null) {
|
||||
return computeExtensionValueFn(
|
||||
context,
|
||||
defaultValue,
|
||||
themeExtension,
|
||||
extra: extra,
|
||||
);
|
||||
}
|
||||
return defaultValue;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Compute custom value
|
||||
S? _computeCustomValue(
|
||||
BuildContext context,
|
||||
S previousPhaseValue, {
|
||||
BuildContext context, {
|
||||
E? extra,
|
||||
}) {
|
||||
final customStyle = customStyleFn(
|
||||
context,
|
||||
previousPhaseValue,
|
||||
extra: extra,
|
||||
);
|
||||
if (customStyle != null) {
|
||||
return customStyle;
|
||||
}
|
||||
return previousPhaseValue;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Choose most suitable style for a given context.
|
||||
S negotiate(BuildContext context, {E? extra}) {
|
||||
S style = computeDefaultValue(context, extra: extra);
|
||||
style = _computeExtensionValue(context, style, extra: extra) ?? style;
|
||||
style = _computeCustomValue(context, style, extra: extra) ?? style;
|
||||
style =
|
||||
style.mergeWith(_computeExtensionValue(context, extra: extra)) ?? style;
|
||||
style =
|
||||
style.mergeWith(_computeCustomValue(context, extra: extra)) ?? style;
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
@ -16,10 +16,13 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_ui_components/src/core/utils/multi_color.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> {
|
||||
const FileSelectionButtonStyle({
|
||||
this.title,
|
||||
@ -106,35 +109,4 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
|
||||
@override
|
||||
FileSelectionButtonStyle mergeWith(FileSelectionButtonStyle? 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,
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -16,10 +16,13 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_ui_components/src/core/utils/multi_color.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> {
|
||||
const FlatButtonStyle({
|
||||
this.label,
|
||||
@ -98,30 +101,4 @@ class FlatButtonStyle extends ButtonStyle<FlatButtonStyle> {
|
||||
@override
|
||||
FlatButtonStyle mergeWith(FlatButtonStyle? 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,
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -16,10 +16,13 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_ui_components/src/core/utils/multi_color.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> {
|
||||
const SimpleIconButtonStyle({
|
||||
this.dimension,
|
||||
@ -98,30 +101,4 @@ class SimpleIconButtonStyle extends ButtonStyle<SimpleIconButtonStyle> {
|
||||
@override
|
||||
SimpleIconButtonStyle mergeWith(SimpleIconButtonStyle? 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,
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -16,10 +16,13 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:wyatt_ui_components/src/core/utils/multi_color.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> {
|
||||
const SymbolButtonStyle({
|
||||
this.label,
|
||||
@ -106,32 +109,4 @@ class SymbolButtonStyle extends ButtonStyle<SymbolButtonStyle> {
|
||||
@override
|
||||
SymbolButtonStyle mergeWith(SymbolButtonStyle? 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,
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -16,8 +16,11 @@
|
||||
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:copy_with_extension/copy_with_extension.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
part 'loader_style.g.dart';
|
||||
|
||||
@CopyWith()
|
||||
class LoaderStyle extends ThemeStyle<LoaderStyle> {
|
||||
const LoaderStyle({
|
||||
this.colors,
|
||||
@ -67,20 +70,6 @@ class LoaderStyle extends ThemeStyle<LoaderStyle> {
|
||||
@override
|
||||
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
|
||||
String toString() => 'LoaderStyle($colors, $stroke)';
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -14,9 +14,12 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// 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:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
part 'rich_text_builder_style.g.dart';
|
||||
|
||||
@CopyWith()
|
||||
class RichTextBuilderStyle extends ThemeStyle<RichTextBuilderStyle> {
|
||||
const RichTextBuilderStyle({
|
||||
this.defaultStyle,
|
||||
@ -66,18 +69,4 @@ class RichTextBuilderStyle extends ThemeStyle<RichTextBuilderStyle> {
|
||||
@override
|
||||
RichTextBuilderStyle mergeWith(RichTextBuilderStyle? 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,
|
||||
);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
@ -20,7 +20,7 @@ import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
part 'text_input_style.g.dart';
|
||||
|
||||
@CopyWith()
|
||||
class TextInputStyle {
|
||||
class TextInputStyle extends ThemeStyle<TextInputStyle> {
|
||||
TextInputStyle({
|
||||
this.labelStyle,
|
||||
this.hintStyle,
|
||||
@ -99,4 +99,8 @@ class TextInputStyle {
|
||||
iconColor: Color.lerp(a.iconColor, b.iconColor, t),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
TextInputStyle? mergeWith(TextInputStyle? other) =>
|
||||
TextInputStyle.merge(this, other);
|
||||
}
|
||||
|
@ -18,11 +18,5 @@ abstract class ThemeStyle<T> {
|
||||
const ThemeStyle();
|
||||
|
||||
/// Merges non-null `other` attributes in `this` and returns a copy.
|
||||
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();
|
||||
T? mergeWith(T? other);
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ class FileSelectionButtonScreen
|
||||
FileSelectionButtonStyle _resolve(BuildContext context, ButtonState state) {
|
||||
final FileSelectionButtonThemeResolver resolver = themeResolver ??
|
||||
FileSelectionButtonThemeResolver(
|
||||
customStyleFn: (context, extensionValue, {extra}) {
|
||||
customStyleFn: (context, {extra}) {
|
||||
FileSelectionButtonStyle? style;
|
||||
switch (extra?.state) {
|
||||
case ControlState.disabled:
|
||||
|
@ -73,19 +73,17 @@ class FileSelectionButtonThemeResolver extends ThemeResolver<
|
||||
|
||||
@override
|
||||
final FileSelectionButtonStyle? Function(
|
||||
BuildContext context,
|
||||
FileSelectionButtonStyle? extensionValue, {
|
||||
BuildContext context, {
|
||||
ButtonState? extra,
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
FileSelectionButtonStyle defaultValue,
|
||||
FileSelectionButtonThemeExtension themeExtension, {
|
||||
ButtonState? extra,
|
||||
}) {
|
||||
FileSelectionButtonStyle? style = defaultValue;
|
||||
FileSelectionButtonStyle? style;
|
||||
switch (extra?.state) {
|
||||
case ControlState.disabled:
|
||||
style = themeExtension.disabledStyle;
|
||||
|
@ -61,7 +61,7 @@ class FlatButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
|
||||
FlatButtonStyle _resolve(BuildContext context, ControlState state) {
|
||||
final FlatButtonThemeResolver resolver = themeResolver ??
|
||||
FlatButtonThemeResolver(
|
||||
customStyleFn: (context, extensionValue, {extra}) {
|
||||
customStyleFn: (context, {extra}) {
|
||||
switch (extra) {
|
||||
case ControlState.disabled:
|
||||
return disabledStyle;
|
||||
|
@ -69,15 +69,13 @@ class FlatButtonThemeResolver extends ThemeResolver<FlatButtonStyle,
|
||||
|
||||
@override
|
||||
final FlatButtonStyle? Function(
|
||||
BuildContext context,
|
||||
FlatButtonStyle? extensionValue, {
|
||||
BuildContext context, {
|
||||
ControlState? extra,
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
FlatButtonStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
FlatButtonStyle defaultValue,
|
||||
FlatButtonThemeExtension themeExtension, {
|
||||
ControlState? extra,
|
||||
}) {
|
||||
|
@ -67,15 +67,13 @@ class SimpleIconButtonThemeResolver extends ThemeResolver<SimpleIconButtonStyle,
|
||||
|
||||
@override
|
||||
final SimpleIconButtonStyle? Function(
|
||||
BuildContext context,
|
||||
SimpleIconButtonStyle? extensionValue, {
|
||||
BuildContext context, {
|
||||
ControlState? extra,
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
SimpleIconButtonStyle defaultValue,
|
||||
SimpleIconButtonThemeExtension themeExtension, {
|
||||
ControlState? extra,
|
||||
}) {
|
||||
|
@ -55,7 +55,7 @@ class SimpleIconButtonScreen extends CubitScreen<ButtonCubit, ButtonState> {
|
||||
SimpleIconButtonStyle _resolve(BuildContext context, ControlState state) {
|
||||
final SimpleIconButtonThemeResolver resolver = themeResolver ??
|
||||
SimpleIconButtonThemeResolver(
|
||||
customStyleFn: (context, extensionValue, {extra}) {
|
||||
customStyleFn: (context, {extra}) {
|
||||
switch (extra) {
|
||||
case ControlState.disabled:
|
||||
return disabledStyle;
|
||||
|
@ -63,7 +63,7 @@ class SymbolButtonScreen
|
||||
SymbolButtonStyle _resolve(BuildContext context, ButtonState state) {
|
||||
final SymbolButtonThemeResolver resolver = themeResolver ??
|
||||
SymbolButtonThemeResolver(
|
||||
customStyleFn: (context, extensionValue, {extra}) {
|
||||
customStyleFn: (context, {extra}) {
|
||||
SymbolButtonStyle? style;
|
||||
switch (extra?.state) {
|
||||
case ControlState.disabled:
|
||||
|
@ -69,19 +69,17 @@ class SymbolButtonThemeResolver extends ThemeResolver<SymbolButtonStyle,
|
||||
|
||||
@override
|
||||
final SymbolButtonStyle? Function(
|
||||
BuildContext context,
|
||||
SymbolButtonStyle? extensionValue, {
|
||||
BuildContext context, {
|
||||
ButtonState? extra,
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
SymbolButtonStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
SymbolButtonStyle defaultValue,
|
||||
SymbolButtonThemeExtension themeExtension, {
|
||||
ButtonState? extra,
|
||||
}) {
|
||||
SymbolButtonStyle? style = defaultValue;
|
||||
SymbolButtonStyle? style;
|
||||
switch (extra?.state) {
|
||||
case ControlState.disabled:
|
||||
style = themeExtension.disabledStyle;
|
||||
|
@ -45,16 +45,6 @@ class Loader extends LoaderComponent with $LoaderCWMixin {
|
||||
LoaderStyle _resolve(BuildContext context) {
|
||||
final LoaderThemeResolver resolver = themeResolver ??
|
||||
LoaderThemeResolver(
|
||||
computeExtensionValueFn: (
|
||||
context,
|
||||
defaultValue,
|
||||
themeExtension, {
|
||||
extra,
|
||||
}) =>
|
||||
LoaderStyle(
|
||||
colors: themeExtension.colors,
|
||||
stroke: themeExtension.stroke,
|
||||
),
|
||||
customStyleFn: (context, {extra}) => LoaderStyle(
|
||||
colors: colors,
|
||||
stroke: stroke,
|
||||
|
@ -21,7 +21,6 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||
class LoaderThemeResolver
|
||||
extends ThemeResolver<LoaderStyle, LoaderThemeExtension, void> {
|
||||
const LoaderThemeResolver({
|
||||
required this.computeExtensionValueFn,
|
||||
required this.customStyleFn,
|
||||
});
|
||||
|
||||
@ -42,12 +41,18 @@ class LoaderThemeResolver
|
||||
|
||||
@override
|
||||
final LoaderStyle? Function(
|
||||
BuildContext context,
|
||||
LoaderStyle defaultValue,
|
||||
LoaderThemeExtension themeExtension, {
|
||||
BuildContext context, {
|
||||
void extra,
|
||||
}) computeExtensionValueFn;
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
final LoaderStyle? Function(BuildContext context, {void extra}) customStyleFn;
|
||||
LoaderStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
LoaderThemeExtension themeExtension, {
|
||||
void extra,
|
||||
}) =>
|
||||
LoaderStyle(
|
||||
colors: themeExtension.colors,
|
||||
stroke: themeExtension.stroke,
|
||||
);
|
||||
}
|
||||
|
@ -42,16 +42,6 @@ class RichTextBuilder extends RichTextBuilderComponent
|
||||
RichTextBuilderStyle _resolve(BuildContext context) {
|
||||
final RichTextBuilderThemeResolver resolver = themeResolver ??
|
||||
RichTextBuilderThemeResolver(
|
||||
computeExtensionValueFn: (
|
||||
context,
|
||||
defaultValue,
|
||||
themeExtension, {
|
||||
extra,
|
||||
}) =>
|
||||
RichTextBuilderStyle(
|
||||
defaultStyle: themeExtension.defaultStyle,
|
||||
styles: themeExtension.styles,
|
||||
),
|
||||
customStyleFn: (context, {extra}) => RichTextBuilderStyle(
|
||||
defaultStyle: defaultStyle,
|
||||
styles: styles,
|
||||
|
@ -21,7 +21,6 @@ import 'package:wyatt_ui_kit/wyatt_ui_kit.dart';
|
||||
class RichTextBuilderThemeResolver extends ThemeResolver<RichTextBuilderStyle,
|
||||
RichTextBuilderThemeExtension, void> {
|
||||
const RichTextBuilderThemeResolver({
|
||||
required this.computeExtensionValueFn,
|
||||
required this.customStyleFn,
|
||||
});
|
||||
|
||||
@ -37,13 +36,18 @@ class RichTextBuilderThemeResolver extends ThemeResolver<RichTextBuilderStyle,
|
||||
|
||||
@override
|
||||
final RichTextBuilderStyle? Function(
|
||||
BuildContext context,
|
||||
RichTextBuilderStyle defaultValue,
|
||||
RichTextBuilderThemeExtension themeExtension, {
|
||||
BuildContext context, {
|
||||
void extra,
|
||||
}) computeExtensionValueFn;
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
final RichTextBuilderStyle? Function(BuildContext context, {void extra})
|
||||
customStyleFn;
|
||||
RichTextBuilderStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
RichTextBuilderThemeExtension themeExtension, {
|
||||
void extra,
|
||||
}) =>
|
||||
RichTextBuilderStyle(
|
||||
defaultStyle: themeExtension.defaultStyle,
|
||||
styles: themeExtension.styles,
|
||||
);
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
|
||||
|
||||
TextInputStyle _resolve(BuildContext context, TextInputState state) {
|
||||
final resolver = TextInputThemeResolver(
|
||||
customStyleFn: (context, extensionValue, {extra}) {
|
||||
customStyleFn: (context, {extra}) {
|
||||
TextInputStyle? textInputStyle;
|
||||
switch (extra?.controlState) {
|
||||
case ControlState.focused:
|
||||
@ -230,10 +230,7 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
|
||||
break;
|
||||
}
|
||||
|
||||
return TextInputStyle.merge(
|
||||
extensionValue,
|
||||
TextInputStyle.merge(textInputStyle, style),
|
||||
);
|
||||
return TextInputStyle.merge(textInputStyle, style);
|
||||
},
|
||||
);
|
||||
|
||||
|
@ -28,8 +28,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
|
||||
@override
|
||||
final TextInputStyle? Function(
|
||||
BuildContext context,
|
||||
TextInputStyle extensionValue, {
|
||||
BuildContext context, {
|
||||
TextInputState? extra,
|
||||
}) customStyleFn;
|
||||
|
||||
@ -126,7 +125,6 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
@override
|
||||
TextInputStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
TextInputStyle defaultValue,
|
||||
TextInputThemeExtension themeExtension, {
|
||||
TextInputState? extra,
|
||||
}) {
|
||||
@ -164,9 +162,6 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
break;
|
||||
}
|
||||
|
||||
return TextInputStyle.merge(
|
||||
defaultValue,
|
||||
TextInputStyle.merge(textInputStyle, style),
|
||||
);
|
||||
return TextInputStyle.merge(textInputStyle, style);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user