mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Remove indicator from scrolling tab bars (#123057)
Remove indicator from scrolling tab bars
This commit is contained in:
parent
c40dd27681
commit
4be45e950d
@ -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(
|
||||
|
||||
@ -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'];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user