@@ -29,7 +29,9 @@ 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,
32
33
this .indicatorSize,
34
+ this .dividerColor,
33
35
this .labelColor,
34
36
this .labelPadding,
35
37
this .labelStyle,
@@ -43,9 +45,15 @@ class TabBarTheme with Diagnosticable {
43
45
/// Overrides the default value for [TabBar.indicator] .
44
46
final Decoration ? indicator;
45
47
48
+ /// Overrides the default value for [TabBar.indicatorColor] .
49
+ final Color ? indicatorColor;
50
+
46
51
/// Overrides the default value for [TabBar.indicatorSize] .
47
52
final TabBarIndicatorSize ? indicatorSize;
48
53
54
+ /// Overrides the default value for [TabBar.dividerColor] .
55
+ final Color ? dividerColor;
56
+
49
57
/// Overrides the default value for [TabBar.labelColor] .
50
58
final Color ? labelColor;
51
59
@@ -80,7 +88,9 @@ class TabBarTheme with Diagnosticable {
80
88
/// new values.
81
89
TabBarTheme copyWith ({
82
90
Decoration ? indicator,
91
+ Color ? indicatorColor,
83
92
TabBarIndicatorSize ? indicatorSize,
93
+ Color ? dividerColor,
84
94
Color ? labelColor,
85
95
EdgeInsetsGeometry ? labelPadding,
86
96
TextStyle ? labelStyle,
@@ -92,7 +102,9 @@ class TabBarTheme with Diagnosticable {
92
102
}) {
93
103
return TabBarTheme (
94
104
indicator: indicator ?? this .indicator,
105
+ indicatorColor: indicatorColor ?? this .indicatorColor,
95
106
indicatorSize: indicatorSize ?? this .indicatorSize,
107
+ dividerColor: dividerColor ?? this .dividerColor,
96
108
labelColor: labelColor ?? this .labelColor,
97
109
labelPadding: labelPadding ?? this .labelPadding,
98
110
labelStyle: labelStyle ?? this .labelStyle,
@@ -120,13 +132,15 @@ class TabBarTheme with Diagnosticable {
120
132
assert (t != null );
121
133
return TabBarTheme (
122
134
indicator: Decoration .lerp (a.indicator, b.indicator, t),
135
+ indicatorColor: Color .lerp (a.indicatorColor, b.indicatorColor, t),
123
136
indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,
137
+ dividerColor: Color .lerp (a.dividerColor, b.dividerColor, t),
124
138
labelColor: Color .lerp (a.labelColor, b.labelColor, t),
125
139
labelPadding: EdgeInsetsGeometry .lerp (a.labelPadding, b.labelPadding, t),
126
140
labelStyle: TextStyle .lerp (a.labelStyle, b.labelStyle, t),
127
141
unselectedLabelColor: Color .lerp (a.unselectedLabelColor, b.unselectedLabelColor, t),
128
142
unselectedLabelStyle: TextStyle .lerp (a.unselectedLabelStyle, b.unselectedLabelStyle, t),
129
- overlayColor: _LerpColors (a.overlayColor, b.overlayColor, t),
143
+ overlayColor: MaterialStateProperty . lerp < Color ?> (a.overlayColor, b.overlayColor, t, Color .lerp ),
130
144
splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,
131
145
mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor,
132
146
);
@@ -135,7 +149,9 @@ class TabBarTheme with Diagnosticable {
135
149
@override
136
150
int get hashCode => Object .hash (
137
151
indicator,
152
+ indicatorColor,
138
153
indicatorSize,
154
+ dividerColor,
139
155
labelColor,
140
156
labelPadding,
141
157
labelStyle,
@@ -156,7 +172,9 @@ class TabBarTheme with Diagnosticable {
156
172
}
157
173
return other is TabBarTheme
158
174
&& other.indicator == indicator
175
+ && other.indicatorColor == indicatorColor
159
176
&& other.indicatorSize == indicatorSize
177
+ && other.dividerColor == dividerColor
160
178
&& other.labelColor == labelColor
161
179
&& other.labelPadding == labelPadding
162
180
&& other.labelStyle == labelStyle
@@ -167,39 +185,3 @@ class TabBarTheme with Diagnosticable {
167
185
&& other.mouseCursor == mouseCursor;
168
186
}
169
187
}
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