flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
166.39k stars 27.57k forks source link

`StretchingOverscrollIndicator`: frozen overscroll animation #146277

Closed gilnobrega closed 7 months ago

gilnobrega commented 7 months ago

Steps to reproduce

This bug is not easy to reproduce but I observed it on different devices. It only happens with a certain combination of screen size, text scale, and keyboard height.

How I reproduced it:

  1. Set up a Pixel 6 Pro emulator (Android 13.0) with default settings and GBoard keyboard
  2. Set keyboard height to "Extra-tall"
  3. Run the code sample below
  4. Tap on the 'Press me' button and wait
  5. Tap it again if needed

Expected results

Overscroll animation does not freeze and finishes animating. Content is not stretched. Red container looks like a square.

Actual results

Overscroll animation may freeze. When this happens:

Code sample

Code sample ```dart import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; void main() { runApp(const MyApp()); } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, brightness: Brightness.light, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } } class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State createState() => _MyHomePageState(); } class _MyHomePageState extends State { final _focusNode1 = FocusNode(); final _focusNode2 = FocusNode(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: Align( alignment: Alignment.bottomCenter, child: MediaQuery( data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), child: SingleChildScrollView( child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ const SizedBox(height: 350), Container( width: 50, color: Colors.red, height: 50, ), TextButton( onPressed: _onPressed, child: const Text('Press me'), ), _TestFormField( focusNode: _focusNode1, type: TextInputType.emailAddress), _TestFormField( focusNode: _focusNode2, type: TextInputType.phone), const SizedBox( height: 51.5, ), ], ), ), ), ), ); } Future _onPressed() async { await Clipboard.setData(const ClipboardData(text: '')); _focusNode2.requestFocus(); await Future.delayed(const Duration(milliseconds: 1000)); _focusNode1.requestFocus(); await Future.delayed(const Duration(milliseconds: 1000)); _focusNode2.requestFocus(); await Future.delayed(const Duration(milliseconds: 1000)); _focusNode2.requestFocus(); } } class _TestFormField extends StatelessWidget { const _TestFormField({this.type, this.focusNode}); final TextInputType? type; final FocusNode? focusNode; @override Widget build(BuildContext context) { return TextFormField( focusNode: focusNode, initialValue: '123456789', keyboardType: type, ); } } ```

Screenshots or Video

Screenshots / Video demonstration Screenshot 2024-04-04 at 15 58 22 https://github.com/flutter/flutter/assets/82336674/68d2c447-691a-4d91-a074-9b85999be275

Logs

Logs ```console ```

Flutter Doctor output

Doctor output ```console flutter doctor -v [!] Flutter (Channel master, 3.22.0-4.0.pre.36, on macOS 14.4.1 23E224 darwin-arm64, locale en-GB) • Flutter version 3.22.0-4.0.pre.36 on channel master at /Users/gilnobrega/fvm/versions/custom_local ! Warning: `dart` on your path resolves to /opt/homebrew/Cellar/dart/2.17.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/gilnobrega/fvm/versions/custom_local. Consider adding /Users/gilnobrega/fvm/versions/custom_local/bin to the front of your path. ! Upstream repository https://github.com/gilnobrega/flutter.git is not a standard remote. Set environment variable "FLUTTER_GIT_URL" to https://github.com/gilnobrega/flutter.git to dismiss this error. • Framework revision ac2ca9347c (6 hours ago), 2024-04-04 05:09:20 -0400 • Engine revision 4303dc0d7a • Dart version 3.5.0 (build 3.5.0-18.0.dev) • DevTools version 2.34.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/gilnobrega/Library/Android/sdk • Platform android-34, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) • All Android licenses accepted. [!] Xcode - develop for iOS and macOS (Xcode 14.0) • Xcode at /Applications/Xcode-beta.app/Contents/Developer • Build 14A5294e ! CocoaPods 1.12.1 out of date (1.13.0 is recommended). CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side. Without CocoaPods, plugins will not work on iOS or macOS. For more info, see https://flutter.dev/platform-plugins To upgrade see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods for instructions. [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2022.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694) [✓] VS Code (version 1.84.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.77.20231101 [✓] Connected device (4 available) • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.4.1 23E224 darwin-arm64 • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.4.1 23E224 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.106 [✓] Network resources • All expected network resources are available. ```
huycozy commented 7 months ago

Thanks for the report. Even though there is no option to set keyboard height on Gboard app on my device (it means I'm using the default settings), the issue also appears. It's reproduced on Flutter stable channel 3.19.5 as well.

flutter doctor -v (stable and master) ```bash [✓] Flutter (Channel stable, 3.19.5, on macOS 14.1 23B74 darwin-x64, locale en-VN) • Flutter version 3.19.5 on channel stable at /Users/huynq/Documents/GitHub/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 300451adae (8 days ago), 2024-03-27 21:54:07 -0500 • Engine revision e76c956498 • Dart version 3.3.3 • DevTools version 2.31.1 [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 • android-studio-dir = /Applications/Android Studio.app/ • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) [✓] VS Code (version 1.87.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 14.1 23B74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.106 [✓] Network resources • All expected network resources are available. • No issues found! ``` ```bash [!] Flutter (Channel master, 3.22.0-5.0.pre.27, on macOS 14.1 23B74 darwin-x64, locale en-VN) • Flutter version 3.22.0-5.0.pre.27 on channel master at /Users/huynq/Documents/GitHub/flutter_master ! Warning: `flutter` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path. ! Warning: `dart` on your path resolves to /Users/huynq/Documents/GitHub/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/huynq/Documents/GitHub/flutter_master. Consider adding /Users/huynq/Documents/GitHub/flutter_master/bin to the front of your path. • Upstream repository https://github.com/flutter/flutter.git • Framework revision 9c6fcdac6f (3 hours ago), 2024-04-05 02:19:12 +0200 • Engine revision d44462a42d • Dart version 3.5.0 (build 3.5.0-18.0.dev) • DevTools version 2.34.1 • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades. [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) • Android SDK at /Users/huynq/Library/Android/sdk • Platform android-34, build-tools 34.0.0 • ANDROID_HOME = /Users/huynq/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 15.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15C500b • CocoaPods version 1.15.2 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2023.2) • Android Studio at /Applications/Android Studio.app/Contents • 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 • android-studio-dir = /Applications/Android Studio.app/ • Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874) [✓] VS Code (version 1.87.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.84.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-x64 • macOS 14.1 23B74 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.106 [✓] Network resources • All expected network resources are available. ! Doctor found issues in 1 category. ```
github-actions[bot] commented 6 months ago

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 -v and a minimal reproduction of the issue.