Implementation
static SfAIAssistViewThemeData? lerp(
SfAIAssistViewThemeData? a, SfAIAssistViewThemeData? b, double t) {
if (a == null && b == null) {
return null;
}
return SfAIAssistViewThemeData(
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,
requestAvatarBackgroundColor: Color.lerp(
a.requestAvatarBackgroundColor, b.requestAvatarBackgroundColor, t),
responseAvatarBackgroundColor: Color.lerp(
a.responseAvatarBackgroundColor, b.responseAvatarBackgroundColor, t),
requestBubbleContentBackgroundColor: Color.lerp(
a.requestBubbleContentBackgroundColor,
b.requestBubbleContentBackgroundColor,
t),
responseBubbleContentBackgroundColor: Color.lerp(
a.responseBubbleContentBackgroundColor,
b.responseBubbleContentBackgroundColor,
t),
editorTextStyle: TextStyle.lerp(a.editorTextStyle, b.editorTextStyle, t),
requestContentTextStyle: TextStyle.lerp(
a.requestContentTextStyle, b.requestContentTextStyle, t),
responseContentTextStyle: TextStyle.lerp(
a.responseContentTextStyle, b.responseContentTextStyle, t),
requestPrimaryHeaderTextStyle: TextStyle.lerp(
a.requestPrimaryHeaderTextStyle, b.requestPrimaryHeaderTextStyle, t),
responsePrimaryHeaderTextStyle: TextStyle.lerp(
a.responsePrimaryHeaderTextStyle,
b.responsePrimaryHeaderTextStyle,
t),
requestSecondaryHeaderTextStyle: TextStyle.lerp(
a.requestSecondaryHeaderTextStyle,
b.requestSecondaryHeaderTextStyle,
t),
responseSecondaryHeaderTextStyle: TextStyle.lerp(
a.responseSecondaryHeaderTextStyle,
b.responseSecondaryHeaderTextStyle,
t),
suggestionItemTextStyle: WidgetStateProperty.lerp<TextStyle?>(
a.suggestionItemTextStyle,
b.suggestionItemTextStyle,
t,
TextStyle.lerp,
),
requestBubbleContentShape: ShapeBorder.lerp(
a.requestBubbleContentShape, b.requestBubbleContentShape, t),
responseBubbleContentShape: ShapeBorder.lerp(
a.responseBubbleContentShape, b.responseBubbleContentShape, 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,
),
responseToolbarBackgroundColor: Color.lerp(
a.responseToolbarBackgroundColor,
b.responseToolbarBackgroundColor,
t),
responseToolbarBackgroundShape: ShapeBorder.lerp(
a.responseToolbarBackgroundShape,
b.responseToolbarBackgroundShape,
t),
responseToolbarItemBackgroundColor: WidgetStateProperty.lerp<Color?>(
a.responseToolbarItemBackgroundColor,
b.responseToolbarItemBackgroundColor,
t,
Color.lerp,
),
responseToolbarItemShape: WidgetStateProperty.lerp<ShapeBorder?>(
a.responseToolbarItemShape,
b.responseToolbarItemShape,
t,
ShapeBorder.lerp,
),
);
}