55 lines
1.5 KiB
Dart
55 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:wyatt_ui_kit/wyatt_ui_kit.dart' as ui_kit;
|
|
|
|
class CustomCardColorExtension extends ui_kit.CardThemeExtension {
|
|
const CustomCardColorExtension({
|
|
super.backgroundColors,
|
|
super.secondaryBackgroundColors,
|
|
super.borderColor,
|
|
super.shadowColor,
|
|
super.body,
|
|
super.title,
|
|
super.subtitle,
|
|
});
|
|
|
|
@override
|
|
CustomCardColorExtension copyWith({
|
|
List<Color>? backgroundColors,
|
|
Color? secondaryBackgroundColors,
|
|
List<Color>? borderColor,
|
|
BoxShadow? shadowColor,
|
|
TextStyle? body,
|
|
TextStyle? title,
|
|
TextStyle? subtitle,
|
|
}) =>
|
|
CustomCardColorExtension(
|
|
backgroundColors: backgroundColors ?? this.backgroundColors,
|
|
secondaryBackgroundColors:
|
|
secondaryBackgroundColors ?? this.secondaryBackgroundColors,
|
|
borderColor: borderColor ?? this.borderColor,
|
|
body: body ?? this.body,
|
|
title: title ?? this.title,
|
|
subtitle: subtitle ?? this.subtitle,
|
|
);
|
|
|
|
@override
|
|
ThemeExtension<ui_kit.CardThemeExtension> lerp(
|
|
covariant ThemeExtension<ui_kit.CardThemeExtension>? other,
|
|
double t,
|
|
) {
|
|
if (other is! CustomCardColorExtension) {
|
|
return this;
|
|
}
|
|
return CustomCardColorExtension(
|
|
secondaryBackgroundColors: Color.lerp(
|
|
secondaryBackgroundColors,
|
|
other.secondaryBackgroundColors,
|
|
t,
|
|
),
|
|
body: TextStyle.lerp(body, other.body, t),
|
|
title: TextStyle.lerp(title, other.title, t),
|
|
subtitle: TextStyle.lerp(subtitle, other.subtitle, t),
|
|
);
|
|
}
|
|
}
|