@@ -397,8 +397,6 @@ class _IndicatorPainter extends CustomPainter {
397
397
required this .indicatorPadding,
398
398
required this .labelPaddings,
399
399
this .dividerColor,
400
- this .dividerHeight,
401
- required this .width,
402
400
}) : super (repaint: controller.animation) {
403
401
if (old != null ) {
404
402
saveTabOffsets (old._currentTabOffsets, old._currentTextDirection);
@@ -410,10 +408,8 @@ class _IndicatorPainter extends CustomPainter {
410
408
final TabBarIndicatorSize ? indicatorSize;
411
409
final EdgeInsetsGeometry indicatorPadding;
412
410
final List <GlobalKey > tabKeys;
413
- final List <EdgeInsetsGeometry > labelPaddings;
414
411
final Color ? dividerColor;
415
- final double ? dividerHeight;
416
- final double width;
412
+ final List <EdgeInsetsGeometry > labelPaddings;
417
413
418
414
// _currentTabOffsets and _currentTextDirection are set each time TabBar
419
415
// layout is completed. These values can be null when TabBar contains no
@@ -506,10 +502,8 @@ class _IndicatorPainter extends CustomPainter {
506
502
textDirection: _currentTextDirection,
507
503
);
508
504
if (dividerColor != null ) {
509
- final Paint dividerPaint = Paint ()..color = dividerColor! ..strokeWidth = dividerHeight! ;
510
- final Offset dividerP1 = Offset (- width, size.height - (dividerPaint.strokeWidth / 2 ));
511
- final Offset dividerP2 = Offset (width, size.height - (dividerPaint.strokeWidth / 2 ));
512
- canvas.drawLine (dividerP1, dividerP2, dividerPaint);
505
+ final Paint dividerPaint = Paint ()..color = dividerColor! ..strokeWidth = 1 ;
506
+ canvas.drawLine (Offset (0 , size.height), Offset (size.width, size.height), dividerPaint);
513
507
}
514
508
_painter! .paint (canvas, _currentRect! .topLeft, configuration);
515
509
}
@@ -724,7 +718,6 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
724
718
this .indicator,
725
719
this .indicatorSize,
726
720
this .dividerColor,
727
- this .dividerHeight,
728
721
this .labelColor,
729
722
this .labelStyle,
730
723
this .labelPadding,
@@ -775,7 +768,6 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
775
768
this .indicator,
776
769
this .indicatorSize,
777
770
this .dividerColor,
778
- this .dividerHeight,
779
771
this .labelColor,
780
772
this .labelStyle,
781
773
this .labelPadding,
@@ -903,13 +895,6 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
903
895
/// [ColorScheme.surfaceVariant] will be used, otherwise divider will not be drawn.
904
896
final Color ? dividerColor;
905
897
906
- /// The height of the divider.
907
- ///
908
- /// If null and [ThemeData.useMaterial3] is true, [TabBarTheme.dividerHeight] is used.
909
- /// If that is also null and [ThemeData.useMaterial3] is true, 1.0 will be used.
910
- /// Otherwise divider will not be drawn.
911
- final double ? dividerHeight;
912
-
913
898
/// The color of selected tab labels.
914
899
///
915
900
/// If null, then [TabBarTheme.labelColor] is used. If that is also null and
@@ -1169,8 +1154,8 @@ class _TabBarState extends State<TabBar> {
1169
1154
TabBarTheme get _defaults {
1170
1155
if (Theme .of (context).useMaterial3) {
1171
1156
return widget._isPrimary
1172
- ? _TabsPrimaryDefaultsM3 (context, widget.isScrollable)
1173
- : _TabsSecondaryDefaultsM3 (context, widget.isScrollable);
1157
+ ? _TabsPrimaryDefaultsM3 (context, widget.isScrollable)
1158
+ : _TabsSecondaryDefaultsM3 (context, widget.isScrollable);
1174
1159
} else {
1175
1160
return _TabsDefaultsM2 (context, widget.isScrollable);
1176
1161
}
@@ -1284,10 +1269,8 @@ class _TabBarState extends State<TabBar> {
1284
1269
indicatorPadding: widget.indicatorPadding,
1285
1270
tabKeys: _tabKeys,
1286
1271
old: _indicatorPainter,
1287
- labelPaddings: _labelPaddings,
1288
1272
dividerColor: theme.useMaterial3 ? widget.dividerColor ?? tabBarTheme.dividerColor ?? _defaults.dividerColor : null ,
1289
- dividerHeight: theme.useMaterial3 ? widget.dividerHeight ?? tabBarTheme.dividerHeight ?? _defaults.dividerHeight : null ,
1290
- width: MediaQuery .sizeOf (context).width,
1273
+ labelPaddings: _labelPaddings,
1291
1274
);
1292
1275
}
1293
1276
@@ -1492,7 +1475,6 @@ class _TabBarState extends State<TabBar> {
1492
1475
Widget build (BuildContext context) {
1493
1476
assert (debugCheckHasMaterialLocalizations (context));
1494
1477
assert (_debugScheduleCheckHasValidTabsCount ());
1495
- final ThemeData theme = Theme .of (context);
1496
1478
final TabBarTheme tabBarTheme = TabBarTheme .of (context);
1497
1479
final TabAlignment effectiveTabAlignment = widget.tabAlignment ?? tabBarTheme.tabAlignment ?? _defaults.tabAlignment! ;
1498
1480
assert (_debugTabAlignmentIsValid (effectiveTabAlignment));
@@ -1645,17 +1627,6 @@ class _TabBarState extends State<TabBar> {
1645
1627
child: tabBar,
1646
1628
),
1647
1629
);
1648
- if (theme.useMaterial3) {
1649
- final AlignmentGeometry effectiveAlignment = switch (effectiveTabAlignment) {
1650
- TabAlignment .center => Alignment .center,
1651
- TabAlignment .start || TabAlignment .startOffset || TabAlignment .fill => AlignmentDirectional .centerStart,
1652
- };
1653
- tabBar = Align (
1654
- heightFactor: 1.0 ,
1655
- alignment: effectiveAlignment,
1656
- child: tabBar,
1657
- );
1658
- }
1659
1630
} else if (widget.padding != null ) {
1660
1631
tabBar = Padding (
1661
1632
padding: widget.padding! ,
@@ -2206,9 +2177,6 @@ class _TabsPrimaryDefaultsM3 extends TabBarTheme {
2206
2177
@override
2207
2178
Color ? get dividerColor => _colors.surfaceVariant;
2208
2179
2209
- @override
2210
- double ? get dividerHeight => 1.0 ;
2211
-
2212
2180
@override
2213
2181
Color ? get indicatorColor => _colors.primary;
2214
2182
@@ -2256,7 +2224,7 @@ class _TabsPrimaryDefaultsM3 extends TabBarTheme {
2256
2224
InteractiveInkFeatureFactory ? get splashFactory => Theme .of (context).splashFactory;
2257
2225
2258
2226
@override
2259
- TabAlignment ? get tabAlignment => isScrollable ? TabAlignment .startOffset : TabAlignment .fill;
2227
+ TabAlignment ? get tabAlignment => isScrollable ? TabAlignment .start : TabAlignment .fill;
2260
2228
2261
2229
static double indicatorWeight = 3.0 ;
2262
2230
}
@@ -2273,9 +2241,6 @@ class _TabsSecondaryDefaultsM3 extends TabBarTheme {
2273
2241
@override
2274
2242
Color ? get dividerColor => _colors.surfaceVariant;
2275
2243
2276
- @override
2277
- double ? get dividerHeight => 1.0 ;
2278
-
2279
2244
@override
2280
2245
Color ? get indicatorColor => _colors.primary;
2281
2246
@@ -2323,7 +2288,7 @@ class _TabsSecondaryDefaultsM3 extends TabBarTheme {
2323
2288
InteractiveInkFeatureFactory ? get splashFactory => Theme .of (context).splashFactory;
2324
2289
2325
2290
@override
2326
- TabAlignment ? get tabAlignment => isScrollable ? TabAlignment .startOffset : TabAlignment .fill;
2291
+ TabAlignment ? get tabAlignment => isScrollable ? TabAlignment .start : TabAlignment .fill;
2327
2292
}
2328
2293
2329
2294
// END GENERATED TOKEN PROPERTIES - Tabs
0 commit comments