2023-08-17 15:28:31 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
class PickerTheme extends ThemeExtension<PickerTheme> {
|
|
|
|
final Color dividerColor;
|
|
|
|
final Color? searchIconColor;
|
|
|
|
final Color searchBackgroundFillColor;
|
|
|
|
final Color searchTextColor;
|
|
|
|
final Color? searchHintColor;
|
2023-08-22 18:49:37 +00:00
|
|
|
final Color? searchBorderColor;
|
2023-08-17 15:28:31 +00:00
|
|
|
|
|
|
|
PickerTheme(
|
|
|
|
{required this.dividerColor,
|
|
|
|
this.searchIconColor,
|
|
|
|
required this.searchBackgroundFillColor,
|
|
|
|
required this.searchTextColor,
|
2023-08-22 18:49:37 +00:00
|
|
|
this.searchHintColor,
|
|
|
|
this.searchBorderColor});
|
2023-08-17 15:28:31 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
PickerTheme copyWith(
|
|
|
|
{Color? dividerColor,
|
|
|
|
Color? searchIconColor,
|
|
|
|
Color? searchBackgroundFillColor,
|
|
|
|
Color? searchTextColor,
|
2023-08-22 18:49:37 +00:00
|
|
|
Color? searchHintColor,
|
|
|
|
Color? searchBorderColor}) =>
|
2023-08-17 15:28:31 +00:00
|
|
|
PickerTheme(
|
|
|
|
dividerColor: dividerColor ?? this.dividerColor,
|
|
|
|
searchIconColor: searchIconColor ?? this.searchIconColor,
|
2023-08-22 18:49:37 +00:00
|
|
|
searchBackgroundFillColor: searchBackgroundFillColor ?? this.searchBackgroundFillColor,
|
2023-08-17 15:28:31 +00:00
|
|
|
searchTextColor: searchTextColor ?? this.searchTextColor,
|
2023-08-22 18:49:37 +00:00
|
|
|
searchHintColor: searchHintColor ?? this.searchHintColor,
|
|
|
|
searchBorderColor: searchBorderColor ?? this.searchBorderColor);
|
2023-08-17 15:28:31 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
PickerTheme lerp(ThemeExtension<PickerTheme>? other, double t) {
|
|
|
|
if (other is! PickerTheme) {
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
return PickerTheme(
|
2023-08-22 18:49:37 +00:00
|
|
|
dividerColor: Color.lerp(dividerColor, other.dividerColor, t) ?? dividerColor,
|
|
|
|
searchIconColor: Color.lerp(searchIconColor, other.searchIconColor, t) ?? searchIconColor,
|
|
|
|
searchBackgroundFillColor:
|
|
|
|
Color.lerp(searchBackgroundFillColor, other.searchBackgroundFillColor, t) ??
|
|
|
|
searchBackgroundFillColor,
|
|
|
|
searchTextColor: Color.lerp(searchTextColor, other.searchTextColor, t) ?? searchTextColor,
|
|
|
|
searchHintColor: Color.lerp(searchHintColor, other.searchHintColor, t) ?? searchHintColor,
|
|
|
|
searchBorderColor:
|
|
|
|
Color.lerp(searchBorderColor, other.searchBorderColor, t) ?? searchBorderColor);
|
2023-08-17 15:28:31 +00:00
|
|
|
}
|
|
|
|
}
|