lerp static method
Linearly interpolate between two time picker themes.
The argument t
must not be null.
Implementation
static ZeroTimePickerStyle lerp(
ZeroTimePickerStyle? a, ZeroTimePickerStyle? b, double t) {
// Workaround since BorderSide's lerp does not allow for null arguments.
BorderSide? lerpedBorderSide;
if (a?.dayPeriodBorderSide == null && b?.dayPeriodBorderSide == null) {
lerpedBorderSide = null;
} else if (a?.dayPeriodBorderSide == null) {
lerpedBorderSide = b?.dayPeriodBorderSide;
} else if (b?.dayPeriodBorderSide == null) {
lerpedBorderSide = a?.dayPeriodBorderSide;
} else {
lerpedBorderSide =
BorderSide.lerp(a!.dayPeriodBorderSide!, b!.dayPeriodBorderSide!, t);
}
return ZeroTimePickerStyle(
backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
hourMinute: HourMinuteControlStyle.lerp(a?.hourMinute, b?.hourMinute, t),
dayPeriodTextColor:
Color.lerp(a?.dayPeriodTextColor, b?.dayPeriodTextColor, t),
dayPeriodColor: Color.lerp(a?.dayPeriodColor, b?.dayPeriodColor, t),
dialHandColor: Color.lerp(a?.dialHandColor, b?.dialHandColor, t),
dialBackgroundColor:
Color.lerp(a?.dialBackgroundColor, b?.dialBackgroundColor, t),
dialTextColor: Color.lerp(a?.dialTextColor, b?.dialTextColor, t),
entryModeIconColor:
Color.lerp(a?.entryModeIconColor, b?.entryModeIconColor, t),
dayPeriodTextStyle:
TextStyle.lerp(a?.dayPeriodTextStyle, b?.dayPeriodTextStyle, t),
helpTextStyle: TextStyle.lerp(a?.helpTextStyle, b?.helpTextStyle, t),
shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
dayPeriodShape: ShapeBorder.lerp(a?.dayPeriodShape, b?.dayPeriodShape, t)
as OutlinedBorder?,
dayPeriodBorderSide: lerpedBorderSide,
textfieldStyle: t < 0.5 ? a?.textfieldStyle : b?.textfieldStyle,
);
}