Remove indicator from scrolling tab bars (#123057)

Remove indicator from scrolling tab bars
This commit is contained in:
Kate Lovett 2023-03-21 18:44:12 -05:00 committed by GitHub
parent c40dd27681
commit 4be45e950d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 7 deletions

View File

@ -1441,13 +1441,17 @@ class _TabBarState extends State<TabBar> {
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(

View File

@ -1351,6 +1351,13 @@ void main() {
expect(controller.indexIsChanging, false);
});
testWidgets('Scrollable TabBar does not have overscroll indicator', (WidgetTester tester) async {
final List<String> tabs = <String>['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<String> tabs = <String>['A'];