@@ -29,7 +29,9 @@ class TabBarTheme with Diagnosticable {
2929 /// Creates a tab bar theme that can be used with [ThemeData.tabBarTheme] .
3030 const TabBarTheme ({
3131 this .indicator,
32+ this .indicatorColor,
3233 this .indicatorSize,
34+ this .dividerColor,
3335 this .labelColor,
3436 this .labelPadding,
3537 this .labelStyle,
@@ -43,9 +45,15 @@ class TabBarTheme with Diagnosticable {
4345 /// Overrides the default value for [TabBar.indicator] .
4446 final Decoration ? indicator;
4547
48+ /// Overrides the default value for [TabBar.indicatorColor] .
49+ final Color ? indicatorColor;
50+
4651 /// Overrides the default value for [TabBar.indicatorSize] .
4752 final TabBarIndicatorSize ? indicatorSize;
4853
54+ /// Overrides the default value for [TabBar.dividerColor] .
55+ final Color ? dividerColor;
56+
4957 /// Overrides the default value for [TabBar.labelColor] .
5058 final Color ? labelColor;
5159
@@ -80,7 +88,9 @@ class TabBarTheme with Diagnosticable {
8088 /// new values.
8189 TabBarTheme copyWith ({
8290 Decoration ? indicator,
91+ Color ? indicatorColor,
8392 TabBarIndicatorSize ? indicatorSize,
93+ Color ? dividerColor,
8494 Color ? labelColor,
8595 EdgeInsetsGeometry ? labelPadding,
8696 TextStyle ? labelStyle,
@@ -92,7 +102,9 @@ class TabBarTheme with Diagnosticable {
92102 }) {
93103 return TabBarTheme (
94104 indicator: indicator ?? this .indicator,
105+ indicatorColor: indicatorColor ?? this .indicatorColor,
95106 indicatorSize: indicatorSize ?? this .indicatorSize,
107+ dividerColor: dividerColor ?? this .dividerColor,
96108 labelColor: labelColor ?? this .labelColor,
97109 labelPadding: labelPadding ?? this .labelPadding,
98110 labelStyle: labelStyle ?? this .labelStyle,
@@ -120,13 +132,15 @@ class TabBarTheme with Diagnosticable {
120132 assert (t != null );
121133 return TabBarTheme (
122134 indicator: Decoration .lerp (a.indicator, b.indicator, t),
135+ indicatorColor: Color .lerp (a.indicatorColor, b.indicatorColor, t),
123136 indicatorSize: t < 0.5 ? a.indicatorSize : b.indicatorSize,
137+ dividerColor: Color .lerp (a.dividerColor, b.dividerColor, t),
124138 labelColor: Color .lerp (a.labelColor, b.labelColor, t),
125139 labelPadding: EdgeInsetsGeometry .lerp (a.labelPadding, b.labelPadding, t),
126140 labelStyle: TextStyle .lerp (a.labelStyle, b.labelStyle, t),
127141 unselectedLabelColor: Color .lerp (a.unselectedLabelColor, b.unselectedLabelColor, t),
128142 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 ),
130144 splashFactory: t < 0.5 ? a.splashFactory : b.splashFactory,
131145 mouseCursor: t < 0.5 ? a.mouseCursor : b.mouseCursor,
132146 );
@@ -135,7 +149,9 @@ class TabBarTheme with Diagnosticable {
135149 @override
136150 int get hashCode => Object .hash (
137151 indicator,
152+ indicatorColor,
138153 indicatorSize,
154+ dividerColor,
139155 labelColor,
140156 labelPadding,
141157 labelStyle,
@@ -156,7 +172,9 @@ class TabBarTheme with Diagnosticable {
156172 }
157173 return other is TabBarTheme
158174 && other.indicator == indicator
175+ && other.indicatorColor == indicatorColor
159176 && other.indicatorSize == indicatorSize
177+ && other.dividerColor == dividerColor
160178 && other.labelColor == labelColor
161179 && other.labelPadding == labelPadding
162180 && other.labelStyle == labelStyle
@@ -167,39 +185,3 @@ class TabBarTheme with Diagnosticable {
167185 && other.mouseCursor == mouseCursor;
168186 }
169187}
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