Repository navigation
Description
When a scrollable widget with a scrollbar contains another scrollable widget with a scrollbar, the inner scrollbar is rendered incorrectly.
If the inner scrollbar is set implicitly (i.e. the inner scrollable widget is not wrapped into a Scrollbar widget), then the primary scrollbar is replaced with the inner scrollbar (which is kind of expected behaviour), but it always appears at the top of the screen regardless of the actual position of the inner scrollable widget.
Edit: An inner scrollbar of a non-immediate ancestor of the Scrollbar widget being set implicitly is actually not an expected behaviour.
If the inner scrollbar is set explicitly (i.e. the inner scrollable widget is wrapped into a Scrollbar widget), then the inner scrollbar does appear inside the inner widget, as expected, but the primary scrollbar still gets replaced with the inner scrollbar at the top of the screen and both scrollbars are displayed simultaneously.
I observed this behaviour both in iOS and in Android.
Here’s a sample code to reproduce the issue:
import 'package:flutter/material.dart';
void main() {
runApp(SampleWidget());
}
class SampleWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Scrollbar(
child: ListView(
children: [
SizedBox(height: 100.0),
TextField(
minLines: 3,
maxLines: 5,
),
SizedBox(height: 100.0),
Scrollbar(
child: TextField(
minLines: 3,
maxLines: 5,
),
),
SizedBox(height: 1000.0),
],
),
),
),
),
);
}
}flutter doctor -v
[✓] Flutter (Channel stable, 1.20.4, on Mac OS X 10.15.6 19G2021, locale en-UK)
• Flutter version 1.20.4 at /Users/denis/Projects/src/flutter
• Framework revision fba99f6cf9 (9 days ago), 2020-09-14 15:32:52 -0700
• Engine revision d1bc06f032
• Dart version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/denis/Library/Android/sdk
• Platform android-30, build-tools 29.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.0)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.0, Build version 12A7209
• CocoaPods version 1.10.0.beta.2
[✓] Android Studio (version 4.0)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 48.1.2
• Dart plugin version 193.7361
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.2.2)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 49.0.4
• Dart plugin version 202.7319.5
[✓] Connected device (2 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• iPhone 11 Pro Max (mobile) • 1AE78A39-B65D-44FE-94D4-9358DAB8039E • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-1 (simulator)
• No issues found!
Activity
pedromassangocode commentedon Sep 23, 2020
I was able to reproduce this with the latest master version of Flutter.
flutter doctor -v
denis-evteev commentedon Sep 23, 2020
It seems that the
Scrollbarwidget shows scrollbars for all nested scrollable widgets and there seems to be no way to alter that (incorrect) behaviour.Because of that, in the following sample app a horizontal scrollbar appears not only for a
ListView, but also for all nestedPageViews:The
Scrollbarwidget should display scrollbars for its direct child widget only.[-]Nested scrollbar render issue[/-][+]The `Scrollbar` widget incorrectly renders scrollbars for all descendant widgets[/+]HansMuller commentedon Sep 24, 2020
CC @Piinks
yjbanov commentedon Sep 24, 2020
This does not look web-specific. Removing the platform-web label, but feel free to put it back if this is indeed web-specific.
Piinks commentedon Dec 8, 2020
I think this is a duplicate of #36474
@xu-baolin is also working on solving this/both in #71843
I am going to close this as a dupe, follow the other issue for the latest updates - it looks like there has been more discussion there. If you feel this issue is different from #36474, let us know and we will re-open! :)
github-actions commentedon Aug 9, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.