-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Hi!
I recorded this GIF doing the horizontal resizing (to have a smaller image) but it generates the same effect when maximize the window.
You can see that the scroll keeps changing its size and the content keeps moving.
This happens when the scroll offset is at the end.
In horizontal resizing, it is understandable because it must generate multiple events. But it gets really weird when maximizing the window (should be only one event) and seeing the entire content slowly move to the side.
I've also noticed that the scroll offset is updated numerous times when maximizing the window as if trying to adjust until it succeeds. Updates before the last one are also with offset values greater than the maximum allowed. This also happens when resizing horizontally.
Steps to Reproduce
- move scroll to the end
- maximize the window
Code
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final ScrollController _scrollController = ScrollController();
@override
void initState() {
_scrollController.addListener(_scrollListener);
super.initState();
}
@override
void dispose() {
_scrollController.dispose();
super.dispose();
}
void _scrollListener() {
// offset bigger than maxScrollExtent?
print(
'offset: ${_scrollController.offset} / maxScrollExtent: ${_scrollController.position.maxScrollExtent}');
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Theme(
data: ThemeData(
scrollbarTheme: ScrollbarThemeData(
thumbVisibility: MaterialStateProperty.all(true),
thumbColor: MaterialStateProperty.all(Colors.red))),
child: Scrollbar(
controller: _scrollController,
child: SingleChildScrollView(
controller: _scrollController,
scrollDirection: Axis.horizontal,
child:
const SizedBox(width: 2000, child: Placeholder())))));
}
}Prints from the listener
...
offset: 82.05680889386778 / maxScrollExtent: 80
offset: 81.76819620001922 / maxScrollExtent: 80
offset: 81.51992893399559 / maxScrollExtent: 80
offset: 81.30657864605345 / maxScrollExtent: 80
offset: 81.12319587706092 / maxScrollExtent: 80
offset: 80 / maxScrollExtent: 80
flutter doctor -v
[✓] Flutter (Channel stable, 3.0.1, on Ubuntu 20.04.4 LTS 5.13.0-48-generic, locale en_US.UTF-8)
• Flutter version 3.0.1 at /cadu/desenv/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision fb57da5f94 (3 weeks ago), 2022-05-19 15:50:29 -0700
• Engine revision caaafc5604
• Dart version 2.17.1
• DevTools version 2.12.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /home/cadu/Android/Sdk
• Platform android-32, build-tools 32.0.0
• ANDROID_SDK_ROOT = /home/cadu/Android/Sdk
• Java binary at: /cadu/desenv/android-studio/jre/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 10.0.0-4ubuntu1
• cmake version 3.16.3
• ninja version 1.10.0
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.2)
• Android Studio at /cadu/desenv/android-studio
• Flutter plugin version 67.1.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] IntelliJ IDEA Community Edition (version 2021.2)
• IntelliJ at /cadu/desenv/idea-IC-211.7628.21
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.67.2)
• VS Code at /usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• moto g 9 plus (mobile) • 0069365263 • android-arm64 • Android 11 (API 30)
• Linux (desktop) • linux • linux-x64 • Ubuntu 20.04.4 LTS 5.13.0-48-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 102.0.5005.61
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
