FCheckboxStyle.inherit constructor
Creates a FCheckboxStyle that inherits its properties.
Implementation
factory FCheckboxStyle.inherit({required FColors colors, required FStyle style}) {
final label = FLabelStyles.inherit(style: style).horizontalStyle;
return FCheckboxStyle(
tappableStyle: style.tappableStyle.copyWith(animationTween: FTappableAnimations.none),
focusedOutlineStyle: style.focusedOutlineStyle.copyWith(borderRadius: BorderRadius.circular(4)),
iconStyle: FWidgetStateMap({
WidgetState.selected & WidgetState.error: IconThemeData(color: colors.errorForeground, size: 14),
WidgetState.selected & ~WidgetState.disabled: IconThemeData(color: colors.primaryForeground, size: 14),
WidgetState.selected & WidgetState.disabled: IconThemeData(
color: colors.disable(colors.primaryForeground),
size: 14,
),
}),
decoration: FWidgetStateMap({
// Error
WidgetState.error & WidgetState.selected: BoxDecoration(borderRadius: style.borderRadius, color: colors.error),
WidgetState.error: BoxDecoration(
borderRadius: style.borderRadius,
border: Border.all(color: colors.error, width: 0.6),
color: colors.background,
),
// Disabled
WidgetState.disabled & WidgetState.selected: BoxDecoration(
borderRadius: style.borderRadius,
color: colors.disable(colors.primary),
),
WidgetState.disabled: BoxDecoration(
borderRadius: style.borderRadius,
border: Border.all(color: colors.disable(colors.primary), width: 0.6),
color: colors.disable(colors.background),
),
// Enabled
WidgetState.selected: BoxDecoration(borderRadius: style.borderRadius, color: colors.primary),
WidgetState.any: BoxDecoration(
borderRadius: style.borderRadius,
border: Border.all(color: colors.primary, width: 0.6),
color: colors.background,
),
}),
labelTextStyle: style.formFieldStyle.labelTextStyle,
descriptionTextStyle: style.formFieldStyle.descriptionTextStyle,
errorTextStyle: style.formFieldStyle.errorTextStyle,
labelPadding: label.labelPadding,
descriptionPadding: label.descriptionPadding,
errorPadding: label.errorPadding,
childPadding: label.childPadding,
);
}