diff --git a/packages/remix/lib/src/components/checkbox/checkbox.dart b/packages/remix/lib/src/components/checkbox/checkbox.dart index bc3f6d950..a69460a66 100644 --- a/packages/remix/lib/src/components/checkbox/checkbox.dart +++ b/packages/remix/lib/src/components/checkbox/checkbox.dart @@ -14,7 +14,7 @@ part 'checkbox_widget.dart'; @MixableSpec() base class CheckboxSpec extends Spec with _$CheckboxSpec, Diagnosticable { - final FlexSpec layout; + final FlexBoxSpec flexContainer; final BoxSpec indicatorContainer; final IconSpec indicatorIcon; final TextSpec label; @@ -27,13 +27,13 @@ base class CheckboxSpec extends Spec const CheckboxSpec({ BoxSpec? indicatorContainer, IconSpec? indicatorIcon, - FlexSpec? layout, + FlexBoxSpec? flexContainer, TextSpec? label, super.modifiers, super.animated, }) : indicatorContainer = indicatorContainer ?? const BoxSpec(), indicatorIcon = indicatorIcon ?? const IconSpec(), - layout = layout ?? const FlexSpec(), + flexContainer = flexContainer ?? const FlexBoxSpec(), label = label ?? const TextSpec(); @override diff --git a/packages/remix/lib/src/components/checkbox/checkbox.g.dart b/packages/remix/lib/src/components/checkbox/checkbox.g.dart index 2e3b72c80..b8fab4cbc 100644 --- a/packages/remix/lib/src/components/checkbox/checkbox.g.dart +++ b/packages/remix/lib/src/components/checkbox/checkbox.g.dart @@ -35,7 +35,7 @@ mixin _$CheckboxSpec on Spec { CheckboxSpec copyWith({ BoxSpec? indicatorContainer, IconSpec? indicatorIcon, - FlexSpec? layout, + FlexBoxSpec? flexContainer, TextSpec? label, WidgetModifiersData? modifiers, AnimatedData? animated, @@ -43,7 +43,7 @@ mixin _$CheckboxSpec on Spec { return CheckboxSpec( indicatorContainer: indicatorContainer ?? _$this.indicatorContainer, indicatorIcon: indicatorIcon ?? _$this.indicatorIcon, - layout: layout ?? _$this.layout, + flexContainer: flexContainer ?? _$this.flexContainer, label: label ?? _$this.label, modifiers: modifiers ?? _$this.modifiers, animated: animated ?? _$this.animated, @@ -63,7 +63,7 @@ mixin _$CheckboxSpec on Spec { /// /// - [BoxSpec.lerp] for [indicatorContainer]. /// - [IconSpec.lerp] for [indicatorIcon]. - /// - [FlexSpec.lerp] for [layout]. + /// - [FlexBoxSpec.lerp] for [flexContainer]. /// - [TextSpec.lerp] for [label]. /// For [modifiers] and [animated], the interpolation is performed using a step function. @@ -80,7 +80,7 @@ mixin _$CheckboxSpec on Spec { indicatorContainer: _$this.indicatorContainer.lerp(other.indicatorContainer, t), indicatorIcon: _$this.indicatorIcon.lerp(other.indicatorIcon, t), - layout: _$this.layout.lerp(other.layout, t), + flexContainer: _$this.flexContainer.lerp(other.flexContainer, t), label: _$this.label.lerp(other.label, t), modifiers: other.modifiers, animated: t < 0.5 ? _$this.animated : other.animated, @@ -95,7 +95,7 @@ mixin _$CheckboxSpec on Spec { List get props => [ _$this.indicatorContainer, _$this.indicatorIcon, - _$this.layout, + _$this.flexContainer, _$this.label, _$this.modifiers, _$this.animated, @@ -109,8 +109,8 @@ mixin _$CheckboxSpec on Spec { defaultValue: null)); properties.add(DiagnosticsProperty('indicatorIcon', _$this.indicatorIcon, defaultValue: null)); - properties - .add(DiagnosticsProperty('layout', _$this.layout, defaultValue: null)); + properties.add(DiagnosticsProperty('flexContainer', _$this.flexContainer, + defaultValue: null)); properties .add(DiagnosticsProperty('label', _$this.label, defaultValue: null)); properties.add( @@ -131,13 +131,13 @@ base class CheckboxSpecAttribute extends SpecAttribute with Diagnosticable { final BoxSpecAttribute? indicatorContainer; final IconSpecAttribute? indicatorIcon; - final FlexSpecAttribute? layout; + final FlexBoxSpecAttribute? flexContainer; final TextSpecAttribute? label; const CheckboxSpecAttribute({ this.indicatorContainer, this.indicatorIcon, - this.layout, + this.flexContainer, this.label, super.modifiers, super.animated, @@ -156,7 +156,7 @@ base class CheckboxSpecAttribute extends SpecAttribute return CheckboxSpec( indicatorContainer: indicatorContainer?.resolve(mix), indicatorIcon: indicatorIcon?.resolve(mix), - layout: layout?.resolve(mix), + flexContainer: flexContainer?.resolve(mix), label: label?.resolve(mix), modifiers: modifiers?.resolve(mix), animated: animated?.resolve(mix) ?? mix.animation, @@ -180,7 +180,8 @@ base class CheckboxSpecAttribute extends SpecAttribute other.indicatorContainer, indicatorIcon: indicatorIcon?.merge(other.indicatorIcon) ?? other.indicatorIcon, - layout: layout?.merge(other.layout) ?? other.layout, + flexContainer: + flexContainer?.merge(other.flexContainer) ?? other.flexContainer, label: label?.merge(other.label) ?? other.label, modifiers: modifiers?.merge(other.modifiers) ?? other.modifiers, animated: animated?.merge(other.animated) ?? other.animated, @@ -195,7 +196,7 @@ base class CheckboxSpecAttribute extends SpecAttribute List get props => [ indicatorContainer, indicatorIcon, - layout, + flexContainer, label, modifiers, animated, @@ -208,7 +209,8 @@ base class CheckboxSpecAttribute extends SpecAttribute defaultValue: null)); properties.add(DiagnosticsProperty('indicatorIcon', indicatorIcon, defaultValue: null)); - properties.add(DiagnosticsProperty('layout', layout, defaultValue: null)); + properties.add(DiagnosticsProperty('flexContainer', flexContainer, + defaultValue: null)); properties.add(DiagnosticsProperty('label', label, defaultValue: null)); properties .add(DiagnosticsProperty('modifiers', modifiers, defaultValue: null)); @@ -230,8 +232,8 @@ class CheckboxSpecUtility /// Utility for defining [CheckboxSpecAttribute.indicatorIcon] late final indicatorIcon = IconSpecUtility((v) => only(indicatorIcon: v)); - /// Utility for defining [CheckboxSpecAttribute.layout] - late final layout = FlexSpecUtility((v) => only(layout: v)); + /// Utility for defining [CheckboxSpecAttribute.flexContainer] + late final flexContainer = FlexBoxSpecUtility((v) => only(flexContainer: v)); /// Utility for defining [CheckboxSpecAttribute.label] late final label = TextSpecUtility((v) => only(label: v)); @@ -255,7 +257,7 @@ class CheckboxSpecUtility T only({ BoxSpecAttribute? indicatorContainer, IconSpecAttribute? indicatorIcon, - FlexSpecAttribute? layout, + FlexBoxSpecAttribute? flexContainer, TextSpecAttribute? label, WidgetModifiersDataDto? modifiers, AnimatedDataDto? animated, @@ -263,7 +265,7 @@ class CheckboxSpecUtility return builder(CheckboxSpecAttribute( indicatorContainer: indicatorContainer, indicatorIcon: indicatorIcon, - layout: layout, + flexContainer: flexContainer, label: label, modifiers: modifiers, animated: animated, diff --git a/packages/remix/lib/src/components/checkbox/checkbox_style.dart b/packages/remix/lib/src/components/checkbox/checkbox_style.dart index f4ce858ee..3b54b61f5 100644 --- a/packages/remix/lib/src/components/checkbox/checkbox_style.dart +++ b/packages/remix/lib/src/components/checkbox/checkbox_style.dart @@ -31,7 +31,7 @@ class CheckboxStyle extends SpecStyle { ..style.fontWeight.w500() ..textHeightBehavior.heightToFirstAscent.off(); - final layoutStyle = $.layout.chain + final flexContainerStyle = $.flexContainer.flex.chain ..crossAxisAlignment.center() ..mainAxisAlignment.start() ..mainAxisSize.min() @@ -47,7 +47,7 @@ class CheckboxStyle extends SpecStyle { ...containerStyle, ...indicatorStyle, labelStyle, - layoutStyle, + flexContainerStyle, disabledStyle, ]); } @@ -64,6 +64,7 @@ class CheckboxDarkStyle extends CheckboxStyle { super.makeStyle(spec).call(), $.indicatorContainer.border.all.color.white(), $.indicatorIcon.color.black(), + $.label.style.color.white(), spec.on.selected( $.indicatorContainer.color.white(), $.indicatorIcon.color.black(), diff --git a/packages/remix/lib/src/components/checkbox/checkbox_theme.dart b/packages/remix/lib/src/components/checkbox/checkbox_theme.dart index 8a2962de3..338fe6090 100644 --- a/packages/remix/lib/src/components/checkbox/checkbox_theme.dart +++ b/packages/remix/lib/src/components/checkbox/checkbox_theme.dart @@ -13,17 +13,12 @@ class FortalezaCheckboxStyle extends CheckboxStyle { final baseStyle = super.makeStyle(spec); final baseOverrides = Style( + $.indicatorIcon.wrap.scale(0.5), $.indicatorContainer.chain ..border.all.width(0) ..border.all.style.none(), - $.indicatorContainer.chain - ..wrap.opacity(0) - ..wrap.scale(0.5), $.label.style.color.$neutral(12), - spec.on.selected( - $.indicatorContainer.wrap.opacity(1), - $.indicatorContainer.wrap.scale(1), - ), + spec.on.selected($.indicatorIcon.wrap.scale(0.9)), ); final surfaceVariant = Style( diff --git a/packages/remix/lib/src/components/checkbox/checkbox_widget.dart b/packages/remix/lib/src/components/checkbox/checkbox_widget.dart index b2a8f00f8..ca8d6a668 100644 --- a/packages/remix/lib/src/components/checkbox/checkbox_widget.dart +++ b/packages/remix/lib/src/components/checkbox/checkbox_widget.dart @@ -93,11 +93,11 @@ class _CheckboxState extends State { builder: (context) { final spec = CheckboxSpec.of(context); + final FlexContainerLayout = spec.flexContainer; final ContainerWidget = spec.indicatorContainer; - final ContainerLayout = spec.layout; final IconWidget = spec.indicatorIcon; - return ContainerLayout( + return FlexContainerLayout( direction: Axis.horizontal, children: [ ContainerWidget(