FCheckboxStyle.inherit constructor
Creates a FCheckboxStyle that inherits its properties.
Implementation
factory FCheckboxStyle.inherit({required FColors colors, required FStyle style, required bool touch}) {
final FLabelStyles(:horizontalLeadingStyle, :horizontalTrailingStyle) = FLabelStyles.inherit(style: style);
final (size, iconSize) = switch (touch) {
true => (20.0, 18.0),
false => (16.0, 14.0),
};
return .new(
tappableStyle: style.tappableStyle.copyWith(motion: FTappableMotion.none),
focusedOutlineStyle: style.focusedOutlineStyle.copyWith(borderRadius: .circular(4)),
size: size,
iconStyle: FVariants.from(
IconThemeData(color: colors.primaryForeground, size: iconSize),
variants: {
[.disabled]: .delta(color: colors.disable(colors.primaryForeground)),
//
[.error]: .delta(color: colors.errorForeground),
[.error.and(.disabled)]: .delta(color: colors.disable(colors.errorForeground)),
},
),
decoration: FVariants.from(
ShapeDecoration(
shape: RoundedSuperellipseBorder(
side: BorderSide(color: colors.mutedForeground, width: 0.6),
borderRadius: style.borderRadius.xs2,
),
color: colors.card,
),
variants: {
[.disabled]: .shapeDelta(
shape: RoundedSuperellipseBorder(
side: BorderSide(color: colors.disable(colors.mutedForeground), width: 0.6),
borderRadius: style.borderRadius.xs2,
),
color: colors.disable(colors.card),
),
//
[.selected]: .shapeDelta(
shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.xs2),
color: colors.primary,
),
[.selected.and(.disabled)]: .shapeDelta(
shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.xs2),
color: colors.disable(colors.primary),
),
//
[.error]: .shapeDelta(
shape: RoundedSuperellipseBorder(
side: BorderSide(color: colors.error, width: 0.6),
borderRadius: style.borderRadius.xs2,
),
),
[.error.and(.disabled)]: .shapeDelta(
shape: RoundedSuperellipseBorder(
side: BorderSide(color: colors.disable(colors.error), width: 0.6),
borderRadius: style.borderRadius.xs2,
),
color: colors.disable(colors.card),
),
[.error.and(.selected)]: .shapeDelta(
shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.xs2),
color: colors.error,
),
[.error.and(.disabled).and(.selected)]: .shapeDelta(
shape: RoundedSuperellipseBorder(borderRadius: style.borderRadius.xs2),
color: colors.disable(colors.error),
),
},
),
leadingLabelStyle: horizontalLeadingStyle,
trailingLabelStyle: horizontalTrailingStyle,
);
}