Skip to content

Commit

Permalink
checkbox
Browse files Browse the repository at this point in the history
  • Loading branch information
tilucasoli committed Nov 14, 2024
1 parent ef1d96c commit 5995f55
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 31 deletions.
6 changes: 3 additions & 3 deletions packages/remix/lib/src/components/checkbox/checkbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ part 'checkbox_widget.dart';
@MixableSpec()
base class CheckboxSpec extends Spec<CheckboxSpec>
with _$CheckboxSpec, Diagnosticable {
final FlexSpec layout;
final FlexBoxSpec flexContainer;
final BoxSpec indicatorContainer;
final IconSpec indicatorIcon;
final TextSpec label;
Expand All @@ -27,13 +27,13 @@ base class CheckboxSpec extends Spec<CheckboxSpec>
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
Expand Down
36 changes: 19 additions & 17 deletions packages/remix/lib/src/components/checkbox/checkbox.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CheckboxStyle extends SpecStyle<CheckboxSpecUtility> {
..style.fontWeight.w500()
..textHeightBehavior.heightToFirstAscent.off();

final layoutStyle = $.layout.chain
final flexContainerStyle = $.flexContainer.flex.chain
..crossAxisAlignment.center()
..mainAxisAlignment.start()
..mainAxisSize.min()
Expand All @@ -47,7 +47,7 @@ class CheckboxStyle extends SpecStyle<CheckboxSpecUtility> {
...containerStyle,
...indicatorStyle,
labelStyle,
layoutStyle,
flexContainerStyle,
disabledStyle,
]);
}
Expand All @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ class _CheckboxState extends State<Checkbox> {
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(
Expand Down

0 comments on commit 5995f55

Please sign in to comment.