Implementation
static SfChatThemeData? lerp(
SfChatThemeData? a,
SfChatThemeData? b,
double t,
) {
if (a == null && b == null) {
return null;
}
return SfChatThemeData(
actionButtonForegroundColor: Color.lerp(
a!.actionButtonForegroundColor,
b!.actionButtonForegroundColor,
t,
),
actionButtonBackgroundColor: Color.lerp(
a.actionButtonBackgroundColor,
b.actionButtonBackgroundColor,
t,
),
actionButtonFocusColor: Color.lerp(
a.actionButtonFocusColor,
b.actionButtonFocusColor,
t,
),
actionButtonHoverColor: Color.lerp(
a.actionButtonHoverColor,
b.actionButtonHoverColor,
t,
),
actionButtonSplashColor: Color.lerp(
a.actionButtonSplashColor,
b.actionButtonSplashColor,
t,
),
actionButtonDisabledForegroundColor: Color.lerp(
a.actionButtonDisabledForegroundColor,
b.actionButtonDisabledForegroundColor,
t,
),
actionButtonDisabledBackgroundColor: Color.lerp(
a.actionButtonDisabledBackgroundColor,
b.actionButtonDisabledBackgroundColor,
t,
),
actionButtonElevation:
lerpDouble(a.actionButtonElevation, b.actionButtonElevation, t) ??
0.0,
actionButtonFocusElevation:
lerpDouble(
a.actionButtonFocusElevation,
b.actionButtonFocusElevation,
t,
) ??
0.0,
actionButtonHoverElevation:
lerpDouble(
a.actionButtonHoverElevation,
b.actionButtonHoverElevation,
t,
) ??
0.0,
actionButtonDisabledElevation:
lerpDouble(
a.actionButtonDisabledElevation,
b.actionButtonDisabledElevation,
t,
) ??
0.0,
actionButtonHighlightElevation:
lerpDouble(
a.actionButtonHighlightElevation,
b.actionButtonHighlightElevation,
t,
) ??
0.0,
actionButtonShape: ShapeBorder.lerp(
a.actionButtonShape,
b.actionButtonShape,
t,
),
actionButtonMouseCursor:
t < 0.5 ? a.actionButtonMouseCursor : b.actionButtonMouseCursor,
outgoingAvatarBackgroundColor: Color.lerp(
a.outgoingAvatarBackgroundColor,
b.outgoingAvatarBackgroundColor,
t,
),
incomingAvatarBackgroundColor: Color.lerp(
a.incomingAvatarBackgroundColor,
b.incomingAvatarBackgroundColor,
t,
),
outgoingMessageBackgroundColor: Color.lerp(
a.outgoingMessageBackgroundColor,
b.outgoingMessageBackgroundColor,
t,
),
incomingMessageBackgroundColor: Color.lerp(
a.incomingMessageBackgroundColor,
b.incomingMessageBackgroundColor,
t,
),
editorTextStyle: TextStyle.lerp(a.editorTextStyle, b.editorTextStyle, t),
outgoingContentTextStyle: TextStyle.lerp(
a.outgoingContentTextStyle,
b.outgoingContentTextStyle,
t,
),
incomingContentTextStyle: TextStyle.lerp(
a.incomingContentTextStyle,
b.incomingContentTextStyle,
t,
),
outgoingPrimaryHeaderTextStyle: TextStyle.lerp(
a.outgoingPrimaryHeaderTextStyle,
b.outgoingPrimaryHeaderTextStyle,
t,
),
incomingPrimaryHeaderTextStyle: TextStyle.lerp(
a.incomingPrimaryHeaderTextStyle,
b.incomingPrimaryHeaderTextStyle,
t,
),
outgoingSecondaryHeaderTextStyle: TextStyle.lerp(
a.outgoingSecondaryHeaderTextStyle,
b.outgoingSecondaryHeaderTextStyle,
t,
),
incomingSecondaryHeaderTextStyle: TextStyle.lerp(
a.incomingSecondaryHeaderTextStyle,
b.incomingSecondaryHeaderTextStyle,
t,
),
suggestionItemTextStyle: WidgetStateProperty.lerp<TextStyle?>(
a.suggestionItemTextStyle,
b.suggestionItemTextStyle,
t,
TextStyle.lerp,
),
outgoingMessageShape: ShapeBorder.lerp(
a.outgoingMessageShape,
b.outgoingMessageShape,
t,
),
incomingMessageShape: ShapeBorder.lerp(
a.incomingMessageShape,
b.incomingMessageShape,
t,
),
suggestionBackgroundColor: Color.lerp(
a.suggestionBackgroundColor,
b.suggestionBackgroundColor,
t,
),
suggestionBackgroundShape: ShapeBorder.lerp(
a.suggestionBackgroundShape,
b.suggestionBackgroundShape,
t,
),
suggestionItemBackgroundColor: WidgetStateProperty.lerp<Color?>(
a.suggestionItemBackgroundColor,
b.suggestionItemBackgroundColor,
t,
Color.lerp,
),
suggestionItemShape: WidgetStateProperty.lerp<ShapeBorder?>(
a.suggestionItemShape,
b.suggestionItemShape,
t,
ShapeBorder.lerp,
),
);
}