cake_wallet/lib/themes/extensions/dashboard_gradient_theme.dart

42 lines
1.4 KiB
Dart
Raw Normal View History

2023-07-03 12:26:43 +00:00
import 'package:flutter/material.dart';
class DashboardGradientTheme extends ThemeExtension<DashboardGradientTheme> {
final Color firstGradientColor;
final Color secondGradientColor;
final Color thirdGradientColor;
DashboardGradientTheme(
{required this.firstGradientColor,
required this.secondGradientColor,
required this.thirdGradientColor});
@override
Object get type => DashboardGradientTheme;
@override
DashboardGradientTheme copyWith(
{Color? firstGradientColor,
Color? secondGradientColor,
Color? thirdGradientColor}) =>
DashboardGradientTheme(
firstGradientColor: firstGradientColor ?? this.firstGradientColor,
secondGradientColor: secondGradientColor ?? this.secondGradientColor,
thirdGradientColor: thirdGradientColor ?? this.thirdGradientColor);
@override
DashboardGradientTheme lerp(ThemeExtension<DashboardGradientTheme>? other, double t) {
if (other is! DashboardGradientTheme) {
return this;
}
return DashboardGradientTheme(
firstGradientColor:
Color.lerp(firstGradientColor, other.firstGradientColor, t)!,
secondGradientColor:
Color.lerp(secondGradientColor, other.secondGradientColor, t)!,
thirdGradientColor:
Color.lerp(thirdGradientColor, other.thirdGradientColor, t)!);
}
}