Compare commits
8 Commits
4030511f4a
...
133e0e910b
Author | SHA1 | Date | |
---|---|---|---|
133e0e910b | |||
25224469b5 | |||
6537945946 | |||
702164082a | |||
f2b8c03dd7 | |||
51672cc95a | |||
eda643e9b4 | |||
cae4b68046 |
@ -64,12 +64,15 @@ class MultiColor {
|
||||
);
|
||||
} else if (a.isGradient && b.isGradient) {
|
||||
final colors = List<Color>.empty(growable: true);
|
||||
for (int i = 0; i < a.colors.length; i++) {
|
||||
final shortestList =
|
||||
(a.colors.length > b.colors.length) ? b.colors : a.colors;
|
||||
for (int i = 0; i < shortestList.length; i++) {
|
||||
final lerpColor = Color.lerp(a.colors[i], b.colors[i], t);
|
||||
if (lerpColor != null) {
|
||||
colors.add(lerpColor);
|
||||
}
|
||||
}
|
||||
return MultiColor(colors);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
@ -16,13 +16,10 @@
|
||||
|
||||
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,
|
||||
@ -107,6 +104,30 @@ class FileSelectionButtonStyle extends ButtonStyle<FileSelectionButtonStyle> {
|
||||
final TextStyle? subTitle;
|
||||
|
||||
@override
|
||||
FileSelectionButtonStyle mergeWith(FileSelectionButtonStyle? other) =>
|
||||
FileSelectionButtonStyle.merge(this, other)!;
|
||||
FileSelectionButtonStyle? mergeWith(FileSelectionButtonStyle? other) =>
|
||||
FileSelectionButtonStyle.merge(this, other);
|
||||
|
||||
@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,
|
||||
);
|
||||
}
|
||||
|
@ -1,152 +0,0 @@
|
||||
// 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,13 +16,10 @@
|
||||
|
||||
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,
|
||||
@ -99,6 +96,28 @@ class FlatButtonStyle extends ButtonStyle<FlatButtonStyle> {
|
||||
final TextStyle? label;
|
||||
|
||||
@override
|
||||
FlatButtonStyle mergeWith(FlatButtonStyle? other) =>
|
||||
FlatButtonStyle.merge(this, other)!;
|
||||
FlatButtonStyle? mergeWith(FlatButtonStyle? other) =>
|
||||
FlatButtonStyle.merge(this, other);
|
||||
|
||||
@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,
|
||||
);
|
||||
}
|
||||
|
@ -1,137 +0,0 @@
|
||||
// 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,13 +16,10 @@
|
||||
|
||||
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,
|
||||
@ -99,6 +96,28 @@ class SimpleIconButtonStyle extends ButtonStyle<SimpleIconButtonStyle> {
|
||||
final double? dimension;
|
||||
|
||||
@override
|
||||
SimpleIconButtonStyle mergeWith(SimpleIconButtonStyle? other) =>
|
||||
SimpleIconButtonStyle.merge(this, other)!;
|
||||
SimpleIconButtonStyle? mergeWith(SimpleIconButtonStyle? other) =>
|
||||
SimpleIconButtonStyle.merge(this, other);
|
||||
|
||||
@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,
|
||||
);
|
||||
}
|
||||
|
@ -1,141 +0,0 @@
|
||||
// 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,13 +16,10 @@
|
||||
|
||||
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,
|
||||
@ -107,6 +104,30 @@ class SymbolButtonStyle extends ButtonStyle<SymbolButtonStyle> {
|
||||
final double? dimension;
|
||||
|
||||
@override
|
||||
SymbolButtonStyle mergeWith(SymbolButtonStyle? other) =>
|
||||
SymbolButtonStyle.merge(this, other)!;
|
||||
SymbolButtonStyle? mergeWith(SymbolButtonStyle? other) =>
|
||||
SymbolButtonStyle.merge(this, other);
|
||||
|
||||
@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,
|
||||
);
|
||||
}
|
||||
|
@ -1,150 +0,0 @@
|
||||
// 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,11 +16,8 @@
|
||||
|
||||
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,
|
||||
@ -68,7 +65,17 @@ class LoaderStyle extends ThemeStyle<LoaderStyle> {
|
||||
final double? stroke;
|
||||
|
||||
@override
|
||||
LoaderStyle mergeWith(LoaderStyle? other) => LoaderStyle.merge(this, other)!;
|
||||
LoaderStyle? mergeWith(LoaderStyle? other) => LoaderStyle.merge(this, other);
|
||||
|
||||
@override
|
||||
LoaderStyle copyWith({
|
||||
MultiColor? colors,
|
||||
double? stroke,
|
||||
}) =>
|
||||
LoaderStyle(
|
||||
colors: colors ?? this.colors,
|
||||
stroke: stroke ?? this.stroke,
|
||||
);
|
||||
|
||||
@override
|
||||
String toString() => 'LoaderStyle($colors, $stroke)';
|
||||
|
@ -1,67 +0,0 @@
|
||||
// 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);
|
||||
}
|
@ -23,7 +23,7 @@ class RichTextStyleParameter {
|
||||
this.styleName,
|
||||
);
|
||||
|
||||
final TextStyle defaultStyle;
|
||||
final TextStyle? defaultStyle;
|
||||
final Map<String, TextStyle> definedStyle;
|
||||
final String? styleName;
|
||||
|
||||
@ -31,7 +31,7 @@ class RichTextStyleParameter {
|
||||
if (definedStyle.containsKey(styleName)) {
|
||||
return definedStyle[styleName]!;
|
||||
}
|
||||
return defaultStyle;
|
||||
return defaultStyle ?? const TextStyle();
|
||||
}
|
||||
|
||||
RichTextStyleParameter copyWith({
|
||||
|
@ -14,12 +14,9 @@
|
||||
// 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,
|
||||
@ -67,6 +64,16 @@ class RichTextBuilderStyle extends ThemeStyle<RichTextBuilderStyle> {
|
||||
final Map<String, TextStyle>? styles;
|
||||
|
||||
@override
|
||||
RichTextBuilderStyle mergeWith(RichTextBuilderStyle? other) =>
|
||||
RichTextBuilderStyle.merge(this, other)!;
|
||||
RichTextBuilderStyle? mergeWith(RichTextBuilderStyle? other) =>
|
||||
RichTextBuilderStyle.merge(this, other);
|
||||
|
||||
@override
|
||||
RichTextBuilderStyle? copyWith({
|
||||
TextStyle? defaultStyle,
|
||||
Map<String, TextStyle>? styles,
|
||||
}) =>
|
||||
RichTextBuilderStyle(
|
||||
defaultStyle: defaultStyle ?? this.defaultStyle,
|
||||
styles: styles ?? this.styles,
|
||||
);
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
// 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);
|
||||
}
|
@ -14,12 +14,9 @@
|
||||
// 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/material.dart';
|
||||
import 'package:wyatt_ui_components/wyatt_wyatt_ui_components.dart';
|
||||
part 'text_input_style.g.dart';
|
||||
|
||||
@CopyWith()
|
||||
class TextInputStyle extends ThemeStyle<TextInputStyle> {
|
||||
TextInputStyle({
|
||||
this.labelStyle,
|
||||
@ -46,7 +43,7 @@ class TextInputStyle extends ThemeStyle<TextInputStyle> {
|
||||
final Color? suffixIconColor;
|
||||
|
||||
final MultiColor? backgroundColors;
|
||||
final MultiColor? borderColors;
|
||||
final Color? borderColors;
|
||||
final BoxShadow? boxShadow;
|
||||
final BorderRadiusGeometry? radius;
|
||||
final TextStyle? inputStyle;
|
||||
@ -58,19 +55,19 @@ class TextInputStyle extends ThemeStyle<TextInputStyle> {
|
||||
if (a == null) {
|
||||
return b.copyWith();
|
||||
}
|
||||
return a.copyWith(
|
||||
labelStyle: b.labelStyle,
|
||||
hintStyle: b.hintStyle,
|
||||
backgroundColors: b.backgroundColors,
|
||||
borderColors: b.borderColors,
|
||||
boxShadow: b.boxShadow,
|
||||
radius: b.radius,
|
||||
inputStyle: b.inputStyle,
|
||||
iconColor: b.iconColor,
|
||||
prefixStyle: b.prefixStyle,
|
||||
prefixIconColor: b.prefixIconColor,
|
||||
suffixIconColor: b.suffixIconColor,
|
||||
suffixStyle: b.suffixStyle,
|
||||
return b.copyWith(
|
||||
labelStyle: a.labelStyle,
|
||||
hintStyle: a.hintStyle,
|
||||
backgroundColors: a.backgroundColors,
|
||||
borderColors: a.borderColors,
|
||||
boxShadow: a.boxShadow,
|
||||
radius: a.radius,
|
||||
inputStyle: a.inputStyle,
|
||||
iconColor: a.iconColor,
|
||||
prefixStyle: a.prefixStyle,
|
||||
prefixIconColor: a.prefixIconColor,
|
||||
suffixIconColor: a.suffixIconColor,
|
||||
suffixStyle: a.suffixStyle,
|
||||
);
|
||||
}
|
||||
|
||||
@ -89,7 +86,7 @@ class TextInputStyle extends ThemeStyle<TextInputStyle> {
|
||||
backgroundColors:
|
||||
MultiColor.lerp(a.backgroundColors, b.backgroundColors, t),
|
||||
radius: BorderRadiusGeometry.lerp(a.radius, b.radius, t),
|
||||
borderColors: MultiColor.lerp(a.borderColors, b.borderColors, t),
|
||||
borderColors: Color.lerp(a.borderColors, b.borderColors, t),
|
||||
boxShadow: BoxShadow.lerp(a.boxShadow, b.boxShadow, t),
|
||||
inputStyle: TextStyle.lerp(a.inputStyle, b.inputStyle, t),
|
||||
prefixStyle: TextStyle.lerp(a.prefixStyle, b.prefixStyle, t),
|
||||
@ -103,4 +100,34 @@ class TextInputStyle extends ThemeStyle<TextInputStyle> {
|
||||
@override
|
||||
TextInputStyle? mergeWith(TextInputStyle? other) =>
|
||||
TextInputStyle.merge(this, other);
|
||||
|
||||
@override
|
||||
TextInputStyle copyWith({
|
||||
TextStyle? labelStyle,
|
||||
TextStyle? hintStyle,
|
||||
MultiColor? backgroundColors,
|
||||
Color? borderColors,
|
||||
BoxShadow? boxShadow,
|
||||
BorderRadiusGeometry? radius,
|
||||
TextStyle? inputStyle,
|
||||
Color? iconColor,
|
||||
TextStyle? prefixStyle,
|
||||
Color? prefixIconColor,
|
||||
TextStyle? suffixStyle,
|
||||
Color? suffixIconColor,
|
||||
}) =>
|
||||
TextInputStyle(
|
||||
labelStyle: labelStyle ?? this.labelStyle,
|
||||
hintStyle: hintStyle ?? this.hintStyle,
|
||||
backgroundColors: backgroundColors ?? this.backgroundColors,
|
||||
radius: radius ?? this.radius,
|
||||
borderColors: borderColors ?? this.borderColors,
|
||||
boxShadow: boxShadow ?? this.boxShadow,
|
||||
inputStyle: inputStyle ?? this.inputStyle,
|
||||
prefixStyle: prefixStyle ?? this.prefixStyle,
|
||||
suffixStyle: suffixStyle ?? this.suffixStyle,
|
||||
prefixIconColor: prefixIconColor ?? this.prefixIconColor,
|
||||
suffixIconColor: suffixIconColor ?? this.suffixIconColor,
|
||||
iconColor: iconColor ?? this.iconColor,
|
||||
);
|
||||
}
|
||||
|
@ -1,185 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'text_input_style.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// CopyWithGenerator
|
||||
// **************************************************************************
|
||||
|
||||
abstract class _$TextInputStyleCWProxy {
|
||||
TextInputStyle labelStyle(TextStyle? labelStyle);
|
||||
|
||||
TextInputStyle hintStyle(TextStyle? hintStyle);
|
||||
|
||||
TextInputStyle backgroundColors(MultiColor? backgroundColors);
|
||||
|
||||
TextInputStyle borderColors(MultiColor? borderColors);
|
||||
|
||||
TextInputStyle boxShadow(BoxShadow? boxShadow);
|
||||
|
||||
TextInputStyle radius(BorderRadiusGeometry? radius);
|
||||
|
||||
TextInputStyle inputStyle(TextStyle? inputStyle);
|
||||
|
||||
TextInputStyle iconColor(Color? iconColor);
|
||||
|
||||
TextInputStyle prefixStyle(TextStyle? prefixStyle);
|
||||
|
||||
TextInputStyle prefixIconColor(Color? prefixIconColor);
|
||||
|
||||
TextInputStyle suffixStyle(TextStyle? suffixStyle);
|
||||
|
||||
TextInputStyle suffixIconColor(Color? suffixIconColor);
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TextInputStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
/// ```dart
|
||||
/// TextInputStyle(...).copyWith(id: 12, name: "My name")
|
||||
/// ````
|
||||
TextInputStyle call({
|
||||
TextStyle? labelStyle,
|
||||
TextStyle? hintStyle,
|
||||
MultiColor? backgroundColors,
|
||||
MultiColor? borderColors,
|
||||
BoxShadow? boxShadow,
|
||||
BorderRadiusGeometry? radius,
|
||||
TextStyle? inputStyle,
|
||||
Color? iconColor,
|
||||
TextStyle? prefixStyle,
|
||||
Color? prefixIconColor,
|
||||
TextStyle? suffixStyle,
|
||||
Color? suffixIconColor,
|
||||
});
|
||||
}
|
||||
|
||||
/// Proxy class for `copyWith` functionality. This is a callable class and can be used as follows: `instanceOfTextInputStyle.copyWith(...)`. Additionally contains functions for specific fields e.g. `instanceOfTextInputStyle.copyWith.fieldName(...)`
|
||||
class _$TextInputStyleCWProxyImpl implements _$TextInputStyleCWProxy {
|
||||
const _$TextInputStyleCWProxyImpl(this._value);
|
||||
|
||||
final TextInputStyle _value;
|
||||
|
||||
@override
|
||||
TextInputStyle labelStyle(TextStyle? labelStyle) =>
|
||||
this(labelStyle: labelStyle);
|
||||
|
||||
@override
|
||||
TextInputStyle hintStyle(TextStyle? hintStyle) => this(hintStyle: hintStyle);
|
||||
|
||||
@override
|
||||
TextInputStyle backgroundColors(MultiColor? backgroundColors) =>
|
||||
this(backgroundColors: backgroundColors);
|
||||
|
||||
@override
|
||||
TextInputStyle borderColors(MultiColor? borderColors) =>
|
||||
this(borderColors: borderColors);
|
||||
|
||||
@override
|
||||
TextInputStyle boxShadow(BoxShadow? boxShadow) => this(boxShadow: boxShadow);
|
||||
|
||||
@override
|
||||
TextInputStyle radius(BorderRadiusGeometry? radius) => this(radius: radius);
|
||||
|
||||
@override
|
||||
TextInputStyle inputStyle(TextStyle? inputStyle) =>
|
||||
this(inputStyle: inputStyle);
|
||||
|
||||
@override
|
||||
TextInputStyle iconColor(Color? iconColor) => this(iconColor: iconColor);
|
||||
|
||||
@override
|
||||
TextInputStyle prefixStyle(TextStyle? prefixStyle) =>
|
||||
this(prefixStyle: prefixStyle);
|
||||
|
||||
@override
|
||||
TextInputStyle prefixIconColor(Color? prefixIconColor) =>
|
||||
this(prefixIconColor: prefixIconColor);
|
||||
|
||||
@override
|
||||
TextInputStyle suffixStyle(TextStyle? suffixStyle) =>
|
||||
this(suffixStyle: suffixStyle);
|
||||
|
||||
@override
|
||||
TextInputStyle suffixIconColor(Color? suffixIconColor) =>
|
||||
this(suffixIconColor: suffixIconColor);
|
||||
|
||||
@override
|
||||
|
||||
/// This function **does support** nullification of nullable fields. All `null` values passed to `non-nullable` fields will be ignored. You can also use `TextInputStyle(...).copyWith.fieldName(...)` to override fields one at a time with nullification support.
|
||||
///
|
||||
/// Usage
|
||||
/// ```dart
|
||||
/// TextInputStyle(...).copyWith(id: 12, name: "My name")
|
||||
/// ````
|
||||
TextInputStyle call({
|
||||
Object? labelStyle = const $CopyWithPlaceholder(),
|
||||
Object? hintStyle = const $CopyWithPlaceholder(),
|
||||
Object? backgroundColors = const $CopyWithPlaceholder(),
|
||||
Object? borderColors = const $CopyWithPlaceholder(),
|
||||
Object? boxShadow = const $CopyWithPlaceholder(),
|
||||
Object? radius = const $CopyWithPlaceholder(),
|
||||
Object? inputStyle = const $CopyWithPlaceholder(),
|
||||
Object? iconColor = const $CopyWithPlaceholder(),
|
||||
Object? prefixStyle = const $CopyWithPlaceholder(),
|
||||
Object? prefixIconColor = const $CopyWithPlaceholder(),
|
||||
Object? suffixStyle = const $CopyWithPlaceholder(),
|
||||
Object? suffixIconColor = const $CopyWithPlaceholder(),
|
||||
}) {
|
||||
return TextInputStyle(
|
||||
labelStyle: labelStyle == const $CopyWithPlaceholder()
|
||||
? _value.labelStyle
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: labelStyle as TextStyle?,
|
||||
hintStyle: hintStyle == const $CopyWithPlaceholder()
|
||||
? _value.hintStyle
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: hintStyle as TextStyle?,
|
||||
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?,
|
||||
boxShadow: boxShadow == const $CopyWithPlaceholder()
|
||||
? _value.boxShadow
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: boxShadow as BoxShadow?,
|
||||
radius: radius == const $CopyWithPlaceholder()
|
||||
? _value.radius
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: radius as BorderRadiusGeometry?,
|
||||
inputStyle: inputStyle == const $CopyWithPlaceholder()
|
||||
? _value.inputStyle
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: inputStyle as TextStyle?,
|
||||
iconColor: iconColor == const $CopyWithPlaceholder()
|
||||
? _value.iconColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: iconColor as Color?,
|
||||
prefixStyle: prefixStyle == const $CopyWithPlaceholder()
|
||||
? _value.prefixStyle
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: prefixStyle as TextStyle?,
|
||||
prefixIconColor: prefixIconColor == const $CopyWithPlaceholder()
|
||||
? _value.prefixIconColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: prefixIconColor as Color?,
|
||||
suffixStyle: suffixStyle == const $CopyWithPlaceholder()
|
||||
? _value.suffixStyle
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: suffixStyle as TextStyle?,
|
||||
suffixIconColor: suffixIconColor == const $CopyWithPlaceholder()
|
||||
? _value.suffixIconColor
|
||||
// ignore: cast_nullable_to_non_nullable
|
||||
: suffixIconColor as Color?,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
extension $TextInputStyleCopyWith on TextInputStyle {
|
||||
/// Returns a callable class that can be used as follows: `instanceOfTextInputStyle.copyWith(...)` or like so:`instanceOfTextInputStyle.copyWith.fieldName(...)`.
|
||||
// ignore: library_private_types_in_public_api
|
||||
_$TextInputStyleCWProxy get copyWith => _$TextInputStyleCWProxyImpl(this);
|
||||
}
|
@ -19,4 +19,7 @@ abstract class ThemeStyle<T> {
|
||||
|
||||
/// Merges non-null `other` attributes in `this` and returns a copy.
|
||||
T? mergeWith(T? other);
|
||||
|
||||
/// Copy with (mandatory for mergeWith, needs to be simple and ignore `null`)
|
||||
T? copyWith();
|
||||
}
|
||||
|
@ -10,16 +10,16 @@ environment:
|
||||
|
||||
dependencies:
|
||||
flutter: { sdk: flutter }
|
||||
copy_with_extension: ^5.0.0
|
||||
wyatt_component_copy_with_extension:
|
||||
git:
|
||||
url: ssh://git@git.wyatt-studio.fr:993/Wyatt-FOSS/wyatt-packages.git
|
||||
path: packages/wyatt_component_copy_with_extension
|
||||
freezed_annotation: ^2.2.0
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.3.3
|
||||
copy_with_extension_gen: ^5.0.0
|
||||
flutter_test: { sdk: flutter }
|
||||
freezed: ^2.3.2
|
||||
wyatt_analysis:
|
||||
hosted: https://git.wyatt-studio.fr/api/packages/Wyatt-FOSS/pub
|
||||
version: ^2.4.0
|
||||
|
@ -23,7 +23,7 @@ import 'package:wyatt_ui_kit_example/theme/constants.dart';
|
||||
|
||||
class Loaders extends DemoPage {
|
||||
const Loaders({super.key});
|
||||
|
||||
|
||||
@override
|
||||
String get title => 'Loaders';
|
||||
|
||||
@ -64,5 +64,4 @@ class Loaders extends DemoPage {
|
||||
const Gap(20),
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -30,10 +30,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
factory TextInputTheme.light() => TextInputTheme(
|
||||
normalStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor([
|
||||
Color.fromRGBO(221, 224, 227, 1),
|
||||
Color.fromRGBO(202, 204, 212, 1),
|
||||
]),
|
||||
borderColors: const Color.fromRGBO(221, 224, 227, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(55, 65, 81, 1),
|
||||
@ -45,10 +42,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
),
|
||||
focusedStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor([
|
||||
Color.fromRGBO(60, 125, 251, 1),
|
||||
Color.fromRGBO(68, 109, 244, 1),
|
||||
]),
|
||||
borderColors: const Color.fromRGBO(60, 125, 251, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(55, 65, 81, 1),
|
||||
@ -60,10 +54,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
),
|
||||
errorStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor([
|
||||
Color.fromRGBO(251, 94, 60, 1),
|
||||
Color.fromRGBO(244, 68, 100, 1),
|
||||
]),
|
||||
borderColors: const Color.fromRGBO(244, 68, 100, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(244, 68, 100, 1),
|
||||
@ -75,8 +66,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
),
|
||||
disableStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors:
|
||||
const MultiColor.single(Color.fromRGBO(229, 231, 235, 1)),
|
||||
borderColors: const Color.fromRGBO(229, 231, 235, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(156, 163, 175, 1),
|
||||
@ -91,9 +81,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
factory TextInputTheme.dark() => TextInputTheme(
|
||||
normalStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor.single(
|
||||
Color.fromRGBO(96, 101, 106, 1),
|
||||
),
|
||||
borderColors: const Color.fromRGBO(96, 101, 106, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(204, 204, 204, 1),
|
||||
@ -105,10 +93,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
),
|
||||
focusedStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor([
|
||||
Color.fromRGBO(60, 125, 251, 1),
|
||||
Color.fromRGBO(68, 109, 244, 1),
|
||||
]),
|
||||
borderColors: const Color.fromRGBO(60, 125, 251, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(204, 204, 204, 1),
|
||||
@ -120,10 +105,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
),
|
||||
errorStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor([
|
||||
Color.fromRGBO(251, 94, 60, 1),
|
||||
Color.fromRGBO(244, 68, 100, 1),
|
||||
]),
|
||||
borderColors: const Color.fromRGBO(244, 68, 100, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(244, 68, 100, 1),
|
||||
@ -135,9 +117,7 @@ class TextInputTheme extends TextInputThemeExtension {
|
||||
),
|
||||
disableStyle: TextInputStyle(
|
||||
radius: BorderRadius.circular(12),
|
||||
borderColors: const MultiColor.single(
|
||||
Color.fromRGBO(96, 101, 106, 1),
|
||||
),
|
||||
borderColors: const Color.fromRGBO(96, 101, 106, 1),
|
||||
labelStyle: GoogleFonts.montserrat(
|
||||
fontWeight: FontWeight.w300,
|
||||
color: const Color.fromRGBO(96, 101, 106, 1),
|
||||
|
@ -0,0 +1,51 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CardBackground extends StatefulWidget {
|
||||
const CardBackground({super.key, this.background, this.cardKey});
|
||||
|
||||
final Widget? background;
|
||||
final GlobalKey? cardKey;
|
||||
|
||||
@override
|
||||
State<CardBackground> createState() => _CardBackgroundState();
|
||||
}
|
||||
|
||||
class _CardBackgroundState extends State<CardBackground> {
|
||||
Size _cardSize = Size.zero;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.background != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_resizeCard();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant CardBackground oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.background != null) {
|
||||
_resizeCard();
|
||||
}
|
||||
}
|
||||
|
||||
void _resizeCard() {
|
||||
final RenderObject? renderBox =
|
||||
widget.cardKey?.currentContext?.findRenderObject();
|
||||
if (renderBox != null) {
|
||||
setState(() {
|
||||
_cardSize =
|
||||
Size(renderBox.paintBounds.width, renderBox.paintBounds.height);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SizedBox(
|
||||
width: _cardSize.width,
|
||||
height: _cardSize.height,
|
||||
child: Center(child: widget.background),
|
||||
);
|
||||
}
|
@ -15,11 +15,12 @@
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:wyatt_ui_kit/src/components/cards/widgets/card_background.dart';
|
||||
import 'package:wyatt_ui_kit/src/components/gradients/gradient_box_border.dart';
|
||||
import 'package:wyatt_ui_kit/src/domain/card_theme_extension.dart';
|
||||
|
||||
class CardWrapper extends StatefulWidget {
|
||||
const CardWrapper({
|
||||
class CardWrapper extends StatelessWidget {
|
||||
CardWrapper({
|
||||
required this.child,
|
||||
required this.backgroundColors,
|
||||
required this.borderColors,
|
||||
@ -40,54 +41,19 @@ class CardWrapper extends StatefulWidget {
|
||||
final Size? maxSize;
|
||||
final double? padding;
|
||||
|
||||
@override
|
||||
State<CardWrapper> createState() => _CardWrapperState();
|
||||
}
|
||||
|
||||
class _CardWrapperState extends State<CardWrapper> {
|
||||
Size _cardSize = Size.zero;
|
||||
final GlobalKey _key = GlobalKey();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.background != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_resizeCard();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant CardWrapper oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (widget.background != null) {
|
||||
_resizeCard();
|
||||
}
|
||||
}
|
||||
|
||||
void _resizeCard() {
|
||||
final RenderObject? renderBox = _key.currentContext?.findRenderObject();
|
||||
if (renderBox != null) {
|
||||
setState(() {
|
||||
_cardSize =
|
||||
Size(renderBox.paintBounds.width, renderBox.paintBounds.height);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildChild(Widget child) => (widget.background != null)
|
||||
Widget _buildChild(Widget child) => (background != null)
|
||||
? Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: _cardSize.width,
|
||||
height: _cardSize.height,
|
||||
child: Center(child: widget.background),
|
||||
CardBackground(
|
||||
cardKey: _key,
|
||||
background: background,
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(
|
||||
widget.padding ?? 25,
|
||||
padding ?? 25,
|
||||
),
|
||||
child: child,
|
||||
),
|
||||
@ -95,15 +61,14 @@ class _CardWrapperState extends State<CardWrapper> {
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.all(
|
||||
widget.padding ?? 25,
|
||||
padding ?? 25,
|
||||
),
|
||||
child: child,
|
||||
);
|
||||
|
||||
Gradient? _cardGradient(BuildContext context) {
|
||||
if (widget.backgroundColors != null &&
|
||||
widget.backgroundColors!.length >= 2) {
|
||||
return LinearGradient(colors: widget.backgroundColors!);
|
||||
if (backgroundColors != null && backgroundColors!.length >= 2) {
|
||||
return LinearGradient(colors: backgroundColors!);
|
||||
} else {
|
||||
final extensionCardColor =
|
||||
Theme.of(context).extension<CardThemeExtension>();
|
||||
@ -120,9 +85,8 @@ class _CardWrapperState extends State<CardWrapper> {
|
||||
}
|
||||
|
||||
Color? _cardColor(BuildContext context) {
|
||||
if (widget.backgroundColors != null &&
|
||||
widget.backgroundColors!.length == 1) {
|
||||
return widget.backgroundColors!.first;
|
||||
if (backgroundColors != null && backgroundColors!.length == 1) {
|
||||
return backgroundColors!.first;
|
||||
} else {
|
||||
final extensionCardColor =
|
||||
Theme.of(context).extension<CardThemeExtension>();
|
||||
@ -136,16 +100,16 @@ class _CardWrapperState extends State<CardWrapper> {
|
||||
}
|
||||
|
||||
BoxBorder? _boxBorder(BuildContext context) {
|
||||
if (widget.borderColors != null) {
|
||||
if (widget.borderColors!.length >= 2) {
|
||||
if (borderColors != null) {
|
||||
if (borderColors!.length >= 2) {
|
||||
return CustomGradientBoxBorder(
|
||||
gradient: LinearGradient(
|
||||
colors: widget.borderColors!,
|
||||
colors: borderColors!,
|
||||
),
|
||||
);
|
||||
} else if (widget.borderColors!.isNotEmpty) {
|
||||
} else if (borderColors!.isNotEmpty) {
|
||||
return Border.all(
|
||||
color: widget.borderColors!.first,
|
||||
color: borderColors!.first,
|
||||
);
|
||||
}
|
||||
} else {
|
||||
@ -171,8 +135,8 @@ class _CardWrapperState extends State<CardWrapper> {
|
||||
|
||||
List<BoxShadow> _shadow(BuildContext context) {
|
||||
final shadows = List<BoxShadow>.empty(growable: true);
|
||||
if (widget.shadow != null) {
|
||||
shadows.add(widget.shadow!);
|
||||
if (shadow != null) {
|
||||
shadows.add(shadow!);
|
||||
} else {
|
||||
final extensionCardColor =
|
||||
Theme.of(context).extension<CardThemeExtension>();
|
||||
@ -195,17 +159,17 @@ class _CardWrapperState extends State<CardWrapper> {
|
||||
border: _boxBorder(context),
|
||||
boxShadow: _shadow(context),
|
||||
),
|
||||
child: (widget.minSize != null && widget.maxSize != null)
|
||||
child: (minSize != null && maxSize != null)
|
||||
? ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minWidth: widget.minSize!.width,
|
||||
minHeight: widget.minSize!.height,
|
||||
maxWidth: widget.maxSize!.width,
|
||||
maxHeight: widget.maxSize!.height,
|
||||
minWidth: minSize!.width,
|
||||
minHeight: minSize!.height,
|
||||
maxWidth: maxSize!.width,
|
||||
maxHeight: maxSize!.height,
|
||||
),
|
||||
child: _buildChild(widget.child),
|
||||
child: _buildChild(child),
|
||||
)
|
||||
: _buildChild(widget.child),
|
||||
: _buildChild(child),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -59,15 +59,14 @@ class Loader extends LoaderComponent with $LoaderCWMixin {
|
||||
final style = _resolve(context);
|
||||
final dimension =
|
||||
(radius != null) ? radius! * 2 : context.buttonTheme.height;
|
||||
|
||||
return SizedBox.square(
|
||||
dimension: dimension,
|
||||
child: RepaintBoundary(
|
||||
child: CustomPaint(
|
||||
painter: _LoaderPainter(
|
||||
style.colors!,
|
||||
style.colors ?? const MultiColor([]),
|
||||
dimension / 2,
|
||||
style.stroke!,
|
||||
style.stroke ?? 4,
|
||||
flip: flip ?? false,
|
||||
),
|
||||
)
|
||||
|
@ -24,6 +24,12 @@ class LoaderThemeResolver
|
||||
required this.customStyleFn,
|
||||
});
|
||||
|
||||
@override
|
||||
final LoaderStyle? Function(
|
||||
BuildContext context, {
|
||||
void extra,
|
||||
}) customStyleFn;
|
||||
|
||||
/// Values taken from <https://api.flutter.dev/flutter/material/ElevatedButton/defaultStyleOf.html>
|
||||
@override
|
||||
LoaderStyle computeDefaultValue(
|
||||
@ -39,12 +45,6 @@ class LoaderThemeResolver
|
||||
stroke: 4,
|
||||
);
|
||||
|
||||
@override
|
||||
final LoaderStyle? Function(
|
||||
BuildContext context, {
|
||||
void extra,
|
||||
}) customStyleFn;
|
||||
|
||||
@override
|
||||
LoaderStyle? computeExtensionValueFn(
|
||||
BuildContext context,
|
||||
|
@ -59,7 +59,7 @@ class RichTextBuilder extends RichTextBuilderComponent
|
||||
text ?? '',
|
||||
regex,
|
||||
RichTextStyleParameter(
|
||||
style.defaultStyle!,
|
||||
style.defaultStyle,
|
||||
style.styles ?? {},
|
||||
null,
|
||||
),
|
||||
|
@ -273,15 +273,10 @@ class TextInputScreen extends CubitScreen<TextInputCubit, TextInputState> {
|
||||
? style.backgroundColors?.color
|
||||
: null,
|
||||
borderRadius: style.radius ?? BorderRadius.circular(4),
|
||||
border: (style.borderColors?.isGradient ?? false) ||
|
||||
(style.borderColors?.isColor ?? false)
|
||||
border: (style.borderColors != null)
|
||||
? Border.all(
|
||||
width: 1.5,
|
||||
color: (style.borderColors?.isGradient ?? false)
|
||||
? style.borderColors!.colors.first
|
||||
: (style.borderColors?.isColor ?? false)
|
||||
? style.borderColors!.color
|
||||
: Colors.transparent,
|
||||
color: style.borderColors!,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
|
@ -49,8 +49,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
Color? prefixIconColor = Theme.of(context).unselectedWidgetColor;
|
||||
Color? suffixIconColor = Theme.of(context).unselectedWidgetColor;
|
||||
|
||||
MultiColor? borderColors =
|
||||
MultiColor.single(Theme.of(context).unselectedWidgetColor);
|
||||
Color? borderColors = Theme.of(context).unselectedWidgetColor;
|
||||
|
||||
MultiColor? backgroundColors;
|
||||
BoxShadow? boxShadow;
|
||||
@ -68,7 +67,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
suffixStyle?.copyWith(color: Theme.of(context).disabledColor);
|
||||
inputStyle =
|
||||
inputStyle?.copyWith(color: Theme.of(context).disabledColor);
|
||||
borderColors = MultiColor.single(Theme.of(context).disabledColor);
|
||||
borderColors = Theme.of(context).disabledColor;
|
||||
prefixIconColor = Theme.of(context).disabledColor;
|
||||
suffixIconColor = Theme.of(context).disabledColor;
|
||||
|
||||
@ -78,7 +77,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
prefixIconColor = context.colorScheme.primary;
|
||||
suffixIconColor = context.colorScheme.primary;
|
||||
iconColor = context.colorScheme.primary;
|
||||
borderColors = MultiColor.single(context.colorScheme.primary);
|
||||
borderColors = context.colorScheme.primary;
|
||||
labelStyle = labelStyle?.copyWith(color: context.colorScheme.primary);
|
||||
break;
|
||||
case ControlState.hovered:
|
||||
@ -95,7 +94,7 @@ class TextInputThemeResolver extends ThemeResolver<TextInputStyle,
|
||||
case StatusState.error:
|
||||
labelStyle = context.textTheme.labelLarge
|
||||
?.copyWith(color: context.colorScheme.error);
|
||||
borderColors = MultiColor.single(context.colorScheme.error);
|
||||
borderColors = context.colorScheme.error;
|
||||
break;
|
||||
case StatusState.initial:
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user