@@ -6722,30 +6722,6 @@ void main() {
6722
6722
tabAlignment: TabAlignment .center,
6723
6723
));
6724
6724
expect (tester.getSize (find.byType (TabBar )).width, 307.5 );
6725
-
6726
- // Test default tab bar width when the divider color is set to transparent
6727
- // and tabAlignment is set to startOffset.
6728
- await tester.pumpWidget (buildTabBar (
6729
- dividerColor: Colors .transparent,
6730
- tabAlignment: TabAlignment .startOffset,
6731
- ));
6732
- expect (tester.getSize (find.byType (TabBar )).width, 359.5 );
6733
-
6734
- // Test default tab bar width when the divider color is set to transparent
6735
- // and tabAlignment is set to start.
6736
- await tester.pumpWidget (buildTabBar (
6737
- dividerColor: Colors .transparent,
6738
- tabAlignment: TabAlignment .start,
6739
- ));
6740
- expect (tester.getSize (find.byType (TabBar )).width, 307.5 );
6741
-
6742
- // Test default tab bar width when the divider color is set to transparent
6743
- // and tabAlignment is set to center.
6744
- await tester.pumpWidget (buildTabBar (
6745
- dividerColor: Colors .transparent,
6746
- tabAlignment: TabAlignment .center,
6747
- ));
6748
- expect (tester.getSize (find.byType (TabBar )).width, 307.5 );
6749
6725
});
6750
6726
6751
6727
group ('Material 2' , () {
@@ -7250,4 +7226,51 @@ void main() {
7250
7226
expect (find.text ('Page 3' ), findsOneWidget);
7251
7227
expect (scrollable.controller! .position.pixels, equals (0.0 ));
7252
7228
});
7229
+
7230
+ // This is a regression test for https://github.com/flutter/flutter/issues/150316.
7231
+ testWidgets ('Scrollable TabBar wuth transparent divider expands to full width' , (WidgetTester tester) async {
7232
+ Widget buildTabBar ({ Color ? dividerColor, TabAlignment ? tabAlignment }) {
7233
+ return boilerplate (
7234
+ child: Center (
7235
+ child: DefaultTabController (
7236
+ length: 3 ,
7237
+ child: TabBar (
7238
+ dividerColor: dividerColor,
7239
+ tabAlignment: tabAlignment,
7240
+ isScrollable: true ,
7241
+ tabs: const < Widget > [
7242
+ Tab (text: 'Tab 1' ),
7243
+ Tab (text: 'Tab 2' ),
7244
+ Tab (text: 'Tab 3' ),
7245
+ ],
7246
+ ),
7247
+ ),
7248
+ ),
7249
+ );
7250
+ }
7251
+
7252
+ // Test default tab bar width when the divider color is set to transparent
7253
+ // and tabAlignment is set to startOffset.
7254
+ await tester.pumpWidget (buildTabBar (
7255
+ dividerColor: Colors .transparent,
7256
+ tabAlignment: TabAlignment .startOffset,
7257
+ ));
7258
+ expect (tester.getSize (find.byType (TabBar )).width, 800.0 );
7259
+
7260
+ // Test default tab bar width when the divider color is set to transparent
7261
+ // and tabAlignment is set to start.
7262
+ await tester.pumpWidget (buildTabBar (
7263
+ dividerColor: Colors .transparent,
7264
+ tabAlignment: TabAlignment .start,
7265
+ ));
7266
+ expect (tester.getSize (find.byType (TabBar )).width, 800.0 );
7267
+
7268
+ // Test default tab bar width when the divider color is set to transparent
7269
+ // and tabAlignment is set to center.
7270
+ await tester.pumpWidget (buildTabBar (
7271
+ dividerColor: Colors .transparent,
7272
+ tabAlignment: TabAlignment .center,
7273
+ ));
7274
+ expect (tester.getSize (find.byType (TabBar )).width, 800.0 );
7275
+ });
7253
7276
}
0 commit comments