FOtpFieldItemStyles.inherit constructor
FOtpFieldItemStyles.inherit({
- required FColors colors,
- required FTypography typography,
- required FStyle style,
Creates FOtpFieldItemStyles that inherit their properties.
Implementation
factory FOtpFieldItemStyles.inherit({
required FColors colors,
required FTypography typography,
required FStyle style,
}) => FOtpFieldItemStyles(
.from(
FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
border: BorderDirectional(
top: BorderSide(color: colors.border, width: style.borderWidth),
bottom: BorderSide(color: colors.border, width: style.borderWidth),
start: BorderSide(color: colors.border, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
variants: {
// --- default ---
[.start]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
borderRadius: BorderRadiusDirectional.only(
topStart: style.borderRadius.sm.topLeft,
bottomStart: style.borderRadius.sm.bottomLeft,
),
border: BorderDirectional(
top: BorderSide(color: colors.border, width: style.borderWidth),
bottom: BorderSide(color: colors.border, width: style.borderWidth),
start: BorderSide(color: colors.border, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.end]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
borderRadius: BorderRadiusDirectional.only(
topEnd: style.borderRadius.sm.topRight,
bottomEnd: style.borderRadius.sm.bottomRight,
),
border: Border.all(color: colors.border, width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.start.and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
borderRadius: style.borderRadius.sm,
border: Border.all(color: colors.border, width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
// --- focused ---
[.focused]: FOtpFieldItemStyle(
decoration: ShapeDecoration(
color: colors.card,
shape: RoundedSuperellipseBorder(
side: BorderSide(color: colors.foreground, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.focused.and(.start)]: FOtpFieldItemStyle(
decoration: ShapeDecoration(
color: colors.card,
shape: RoundedSuperellipseBorder(
borderRadius: BorderRadiusDirectional.only(
topStart: style.borderRadius.sm.topLeft,
bottomStart: style.borderRadius.sm.bottomLeft,
),
side: BorderSide(color: colors.foreground, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.focused.and(.end)]: FOtpFieldItemStyle(
decoration: ShapeDecoration(
color: colors.card,
shape: RoundedSuperellipseBorder(
borderRadius: BorderRadiusDirectional.only(
topEnd: style.borderRadius.sm.topRight,
bottomEnd: style.borderRadius.sm.bottomRight,
),
side: BorderSide(color: colors.foreground, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.focused.and(.start).and(.end)]: FOtpFieldItemStyle(
decoration: ShapeDecoration(
color: colors.card,
shape: RoundedSuperellipseBorder(
borderRadius: style.borderRadius.sm,
side: BorderSide(color: colors.foreground, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
// --- disabled ---
[.disabled]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
border: BorderDirectional(
top: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
bottom: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
start: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
[.disabled.and(.start)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
borderRadius: BorderRadiusDirectional.only(
topStart: style.borderRadius.sm.topLeft,
bottomStart: style.borderRadius.sm.bottomLeft,
),
border: BorderDirectional(
top: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
bottom: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
start: BorderSide(color: colors.disable(colors.border), width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
[.disabled.and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
borderRadius: BorderRadiusDirectional.only(
topEnd: style.borderRadius.sm.topRight,
bottomEnd: style.borderRadius.sm.bottomRight,
),
border: Border.all(color: colors.disable(colors.border), width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
[.disabled.and(.start).and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
borderRadius: style.borderRadius.sm,
border: Border.all(color: colors.disable(colors.border), width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
// --- error ---
[.error]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
border: BorderDirectional(
top: BorderSide(color: colors.error, width: style.borderWidth),
bottom: BorderSide(color: colors.error, width: style.borderWidth),
start: BorderSide(color: colors.error, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.error.and(.start)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
borderRadius: BorderRadiusDirectional.only(
topStart: style.borderRadius.sm.topLeft,
bottomStart: style.borderRadius.sm.bottomLeft,
),
border: BorderDirectional(
top: BorderSide(color: colors.error, width: style.borderWidth),
bottom: BorderSide(color: colors.error, width: style.borderWidth),
start: BorderSide(color: colors.error, width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.error.and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
borderRadius: BorderRadiusDirectional.only(
topEnd: style.borderRadius.sm.topRight,
bottomEnd: style.borderRadius.sm.bottomRight,
),
border: Border.all(color: colors.error, width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
[.error.and(.start).and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.card,
borderRadius: style.borderRadius.sm,
border: Border.all(color: colors.error, width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.foreground),
),
// --- error + disabled ---
[.error.and(.disabled)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
border: BorderDirectional(
top: BorderSide(color: colors.disable(colors.error), width: style.borderWidth),
bottom: BorderSide(color: colors.disable(colors.error), width: style.borderWidth),
start: BorderSide(color: colors.disable(colors.error), width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
[.error.and(.disabled).and(.start)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
borderRadius: BorderRadiusDirectional.only(
topStart: style.borderRadius.sm.topLeft,
bottomStart: style.borderRadius.sm.bottomLeft,
),
border: BorderDirectional(
top: BorderSide(color: colors.disable(colors.error), width: style.borderWidth),
bottom: BorderSide(color: colors.disable(colors.error), width: style.borderWidth),
start: BorderSide(color: colors.disable(colors.error), width: style.borderWidth),
),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
[.error.and(.disabled).and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
borderRadius: BorderRadiusDirectional.only(
topEnd: style.borderRadius.sm.topRight,
bottomEnd: style.borderRadius.sm.bottomRight,
),
border: Border.all(color: colors.disable(colors.error), width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
[.error.and(.disabled).and(.start).and(.end)]: FOtpFieldItemStyle(
decoration: BoxDecoration(
color: colors.disable(colors.card),
borderRadius: style.borderRadius.sm,
border: Border.all(color: colors.disable(colors.error), width: style.borderWidth),
),
contentTextStyle: typography.sm.copyWith(color: colors.disable(colors.foreground)),
),
},
),
);