@@ -29,9 +29,7 @@ class TabBarTheme with Diagnosticable {
29
29
/// Creates a tab bar theme that can be used with [ThemeData.tabBarTheme] .
30
30
const TabBarTheme ({
31
31
this .indicator,
32
- this .indicatorColor,
33
32
this .indicatorSize,
34
- this .dividerColor,
35
33
this .labelColor,
36
34
this .labelPadding,
37
35
this .labelStyle,
@@ -45,15 +43,9 @@ class TabBarTheme with Diagnosticable {
45
43
/// Overrides the default value for [TabBar.indicator] .
46
44
final Decoration ? indicator;
47
45
48
- /// Overrides the default value for [TabBar.indicatorColor] .
49
- final Color ? indicatorColor;
50
-
51
46
/// Overrides the default value for [TabBar.indicatorSize] .
52
47
final TabBarIndicatorSize ? indicatorSize;
53
48
54
- /// Overrides the default value for [TabBar.dividerColor] .
55
- final Color ? dividerColor;
56
-
57
49
/// Overrides the default value for [TabBar.labelColor] .
58
50
final Color ? labelColor;
59
51
@@ -88,9 +80,7 @@ class TabBarTheme with Diagnosticable {
88
80
/// new values.
89
81
TabBarTheme copyWith ({
90
82
Decoration ? indicator,
91
- Color ? indicatorColor,
92
83
TabBarIndicatorSize ? indicatorSize,
93
- Color ? dividerColor,
94
84
Color ? labelColor,
95
85
EdgeInsetsGeometry ? labelPadding,
96
86
TextStyle ? labelStyle,
@@ -102,9 +92,7 @@ class TabBarTheme with Diagnosticable {
102
92
}) {
103
93
return TabBarTheme (
104
94
indicator: indicator ?? this .indicator,
105
- indicatorColor: indicatorColor ?? this .indicatorColor,
106
95
indicatorSize: indicatorSize ?? this .indicatorSize,
107
- dividerColor: dividerColor ?? this .dividerColor,
108
96
labelColor: labelColor ?? this .labelColor,
109
97
labelPadding: labelPadding ?? this .labelPadding,
110
98
labelStyle: labelStyle ?? this .labelStyle,
@@ -132,15 +120,13 @@ class TabBarTheme with Diagnosticable {
132
120
assert (t != null );
133
121
return TabBarTheme (
134
122
indicator: Decoration .lerp (a.indicator, b.indicator, t),
135
- indicatorColor: Color .lerp (a.indicatorColor, b.indicatorColor, t),
136
123
indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,
137
- dividerColor: Color .lerp (a.dividerColor, b.dividerColor, t),
138
124
labelColor: Color .lerp (a.labelColor, b.labelColor, t),
139
125
labelPadding: EdgeInsetsGeometry .lerp (a.labelPadding, b.labelPadding, t),
140
126
labelStyle: TextStyle .lerp (a.labelStyle, b.labelStyle, t),
141
127
unselectedLabelColor: Color .lerp (a.unselectedLabelColor, b.unselectedLabelColor, t),
142
128
unselectedLabelStyle: TextStyle .lerp (a.unselectedLabelStyle, b.unselectedLabelStyle, t),
143
- overlayColor: MaterialStateProperty . lerp < Color ?> (a.overlayColor, b.overlayColor, t, Color .lerp ),
129
+ overlayColor: _LerpColors (a.overlayColor, b.overlayColor, t),
144
130
splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,
145
131
mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor,
146
132
);
@@ -149,9 +135,7 @@ class TabBarTheme with Diagnosticable {
149
135
@override
150
136
int get hashCode => Object .hash (
151
137
indicator,
152
- indicatorColor,
153
138
indicatorSize,
154
- dividerColor,
155
139
labelColor,
156
140
labelPadding,
157
141
labelStyle,
@@ -172,9 +156,7 @@ class TabBarTheme with Diagnosticable {
172
156
}
173
157
return other is TabBarTheme
174
158
&& other.indicator == indicator
175
- && other.indicatorColor == indicatorColor
176
159
&& other.indicatorSize == indicatorSize
177
- && other.dividerColor == dividerColor
178
160
&& other.labelColor == labelColor
179
161
&& other.labelPadding == labelPadding
180
162
&& other.labelStyle == labelStyle
@@ -185,3 +167,39 @@ class TabBarTheme with Diagnosticable {
185
167
&& other.mouseCursor == mouseCursor;
186
168
}
187
169
}
170
+
171
+
172
+ @immutable
173
+ class _LerpColors implements MaterialStateProperty <Color ?> {
174
+ const _LerpColors (this .a, this .b, this .t);
175
+
176
+ final MaterialStateProperty <Color ?>? a;
177
+ final MaterialStateProperty <Color ?>? b;
178
+ final double t;
179
+
180
+ @override
181
+ Color ? resolve (Set <MaterialState > states) {
182
+ final Color ? resolvedA = a? .resolve (states);
183
+ final Color ? resolvedB = b? .resolve (states);
184
+ return Color .lerp (resolvedA, resolvedB, t);
185
+ }
186
+
187
+ @override
188
+ int get hashCode {
189
+ return Object .hash (a, b, t);
190
+ }
191
+
192
+ @override
193
+ bool operator == (Object other) {
194
+ if (identical (this , other)) {
195
+ return true ;
196
+ }
197
+ if (other.runtimeType != runtimeType) {
198
+ return false ;
199
+ }
200
+ return other is _LerpColors
201
+ && other.a == a
202
+ && other.b == b
203
+ && other.t == t;
204
+ }
205
+ }
0 commit comments