From 4be45e950dd72ea16e1d0b3387972b9913eefbca Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Tue, 21 Mar 2023 18:44:12 -0500 Subject: [PATCH] Remove indicator from scrolling tab bars (#123057) Remove indicator from scrolling tab bars --- packages/flutter/lib/src/material/tabs.dart | 18 +++++++++++------- packages/flutter/test/material/tabs_test.dart | 7 +++++++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 0958253b66e..13b768aa572 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -1441,13 +1441,17 @@ class _TabBarState extends State { if (widget.isScrollable) { _scrollController ??= _TabBarScrollController(this); - tabBar = SingleChildScrollView( - dragStartBehavior: widget.dragStartBehavior, - scrollDirection: Axis.horizontal, - controller: _scrollController, - padding: widget.padding, - physics: widget.physics, - child: tabBar, + tabBar = ScrollConfiguration( + // The scrolling tabs should not show an overscroll indicator. + behavior: ScrollConfiguration.of(context).copyWith(overscroll: false), + child: SingleChildScrollView( + dragStartBehavior: widget.dragStartBehavior, + scrollDirection: Axis.horizontal, + controller: _scrollController, + padding: widget.padding, + physics: widget.physics, + child: tabBar, + ), ); } else if (widget.padding != null) { tabBar = Padding( diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index 2c8e58187b2..e6080a1c012 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -1351,6 +1351,13 @@ void main() { expect(controller.indexIsChanging, false); }); + testWidgets('Scrollable TabBar does not have overscroll indicator', (WidgetTester tester) async { + final List tabs = ['A', 'B', 'C']; + + await tester.pumpWidget(buildFrame(tabs: tabs, value: 'A', isScrollable: true)); + expect(find.byType(GlowingOverscrollIndicator), findsNothing); + }); + testWidgets('TabBar should not throw when animation is disabled in controller', (WidgetTester tester) async { // Regression test for https://github.com/flutter/flutter/issues/102600 final List tabs = ['A'];