Skip to content

StretchingOverscrollIndicator: frozen overscroll animation #146277

@gilnobrega

Description

@gilnobrega

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:

  • Content looks stretched.
  • Red container does not look like a square.

Code sample

Code sample
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<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  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: <Widget>[
                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<void> _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
Screen.Recording.2024-04-04.at.16.07.43.mov

Logs

Logs

Flutter Doctor output

Doctor output
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.found in release: 3.19Found to occur in 3.19found in release: 3.22Found to occur in 3.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework teamwaiting for PR to land (fixed)A fix is in flight

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions