Unverified Commit fbc4e9bc authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Revert "Update MaterialScrollBehavior.buildScrollbar for horizontal axes (#87740)" (#88129)

parent 5b5eaf0e
...@@ -693,13 +693,8 @@ class MaterialApp extends StatefulWidget { ...@@ -693,13 +693,8 @@ class MaterialApp extends StatefulWidget {
/// [GlowingOverscrollIndicator] to [Scrollable] descendants when executing on /// [GlowingOverscrollIndicator] to [Scrollable] descendants when executing on
/// [TargetPlatform.android] and [TargetPlatform.fuchsia]. /// [TargetPlatform.android] and [TargetPlatform.fuchsia].
/// ///
/// The [buildScrollbar] function is called by the [Scrollable] to wrap with a /// When using the desktop platform, if the [Scrollable] widget scrolls in the
/// [Scrollbar] when appropriate. On all platforms, when the Scrollable [Axis] is /// [Axis.vertical], a [Scrollbar] is applied.
/// [Axis.horizontal], an always visible Scrollbar will be applied. This is
/// because horizontal [ScrollView]s have lower discoverability as scrollable
/// content. When the Axis is [Axis.vertical] a Scrollbar is applied on
/// desktop platforms. In this vertical case, [Scrollbar.isAlwaysShown] is not
/// set and will defer to the inherited [ScrollbarTheme].
/// ///
/// See also: /// See also:
/// ///
...@@ -721,11 +716,7 @@ class MaterialScrollBehavior extends ScrollBehavior { ...@@ -721,11 +716,7 @@ class MaterialScrollBehavior extends ScrollBehavior {
// the base class as well. // the base class as well.
switch (axisDirectionToAxis(details.direction)) { switch (axisDirectionToAxis(details.direction)) {
case Axis.horizontal: case Axis.horizontal:
return Scrollbar( return child;
isAlwaysShown: true,
controller: details.controller,
child: child,
);
case Axis.vertical: case Axis.vertical:
switch (getPlatform(context)) { switch (getPlatform(context)) {
case TargetPlatform.linux: case TargetPlatform.linux:
......
...@@ -1308,16 +1308,13 @@ class _TabBarState extends State<TabBar> { ...@@ -1308,16 +1308,13 @@ class _TabBarState extends State<TabBar> {
if (widget.isScrollable) { if (widget.isScrollable) {
_scrollController ??= _TabBarScrollController(this); _scrollController ??= _TabBarScrollController(this);
tabBar = ScrollConfiguration( tabBar = SingleChildScrollView(
behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false), dragStartBehavior: widget.dragStartBehavior,
child: SingleChildScrollView( scrollDirection: Axis.horizontal,
dragStartBehavior: widget.dragStartBehavior, controller: _scrollController,
scrollDirection: Axis.horizontal, padding: widget.padding,
controller: _scrollController, physics: widget.physics,
padding: widget.padding, child: tabBar,
physics: widget.physics,
child: tabBar,
),
); );
} else if (widget.padding != null) { } else if (widget.padding != null) {
tabBar = Padding( tabBar = Padding(
......
...@@ -1557,20 +1557,4 @@ void main() { ...@@ -1557,20 +1557,4 @@ void main() {
), ),
); );
}); });
testWidgets('MaterialScrollBehavior applies always shown Scrollbar to horizontal scrollables', (WidgetTester tester) async {
final ScrollController controller = ScrollController();
await tester.pumpWidget(MaterialApp(
home: SingleChildScrollView(
scrollDirection: Axis.horizontal,
controller: controller,
child: const SizedBox(
width: 4000.0,
height: 4000.0,
),
),
));
await tester.pumpAndSettle();
expect(find.byType(Scrollbar), paints..rect());
});
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment