Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Scrollviews no longer work together after 3.10 #127017

Closed
2 tasks done
MousyBusiness opened this issue May 17, 2023 · 15 comments · Fixed by #147341
Closed
2 tasks done

[BUG] Scrollviews no longer work together after 3.10 #127017

MousyBusiness opened this issue May 17, 2023 · 15 comments · Fixed by #147341
Assignees
Labels
a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now f: gestures flutter/packages/flutter/gestures repository. f: scrolling Viewports, list views, slivers, etc. found in release: 3.10 Found to occur in 3.10 found in release: 3.11 Found to occur in 3.11 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team

Comments

@MousyBusiness
Copy link

MousyBusiness commented May 17, 2023

Is there an existing issue for this?

Steps to reproduce

  1. flutter downgrade 3.7.12
  2. run application and observe the scroll behaviour
  3. flutter upgrade
  4. run the application and observe how the scroll views no longer work

Expected results

Scrollview to behave as they did in 3.7.12

Actual results

Scrollviews no long work correctly

Code sample

import 'dart:math';

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      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> {
  TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    super.initState();

    _controller.text = """Tweak directional focus traversal by @gspencergoog in 116230
[framework] make ImageFiltered a repaint boundary by @jonahwilliams in 116385
[CP] Fix Snackbar TalkBack regression by @esouthren in 116417
Add widget of the week videos by @tvolkert in 116451
Speed up first asset load by encoding asset manifest in binary rather than JSON by @andrewkolos in 113637
Improve Flex layout comment by @loic-sharma in 116004
Do not parse stack traces in _findResponsibleMethod on Web platforms that use a different format by @jason-simmons in 115500
Support theming CupertinoSwitchs by @guidezpl in 116510
Fix MenuAnchor padding by @gspencergoog in 116573
Add ListenableBuilder with examples by @gspencergoog in 116543
Time picker precursors by @gspencergoog in 116450
Date picker special labeling for currentDate with localization and te… by @harperl-lgtm in 116433
Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations by @chunhtai in 110730
Revert “Speed up first asset load by encoding asset manifest in binary rather than JSON” by @CaseyHillers in 116662
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 115776
Revert “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116675
LookupBoundary by @goderbauer in 116429
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116676
Fix wrong position of TabBarIndicator when it’s label size and has label padding by @zmtzawqlp in 116398
Add CupertinoSliverNavigationBar large title magnification on over scroll by @ivirtex in 110127
Update text field input width when there are prefix/suffix icons by @hangyujin in 116690
Add Material 3 support for ListTile - Part 1 by @TahaTesser in 116194
MediaQuery as InheritedModel by @moffatman in 114459
Add LookupBoundary to Material by @goderbauer in 116736
Floating cursor cleanup by @moffatman in 116746
Revert “Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations” by @CaseyHillers in 116839
More gracefully handle license loading failures by @Hixie in 87841
Taboo the word “simply” from our API documentation. by @Hixie in 116061
Fix NavigationBar ripple for non-default NavigationDestinationLabelBehavior by @TahaTesser in 116888
Add LookupBoundary to Overlay by @goderbauer in 116741
[framework] make opacity widget create a repaint boundary by @j""";
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      _recomputeLongestLine();
      setState(() {});
    });
  }

  String _longestLine = '';

  void _recomputeLongestLine() {
    _longestLine = '';
    final _lines = _controller.text.split('\n');
    final buf = <String>[];

    for (var k = 0; k < _lines.length; k++) {
      buf.add((k + 1).toString());
    }
    // Find longest line
    _longestLine = '';
    for (var line in _lines) {
      if (line.length > _longestLine.length) _longestLine = line;
    }

    print("Longest: ${_longestLine}");
  }

  Widget _buildLongestLinePlaceHolder(double minWidth) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        maxHeight: 0,
        minWidth: max(minWidth, 0),
      ),
      child: Padding(
        padding: const EdgeInsets.only(right: 16),
        child: Text(_longestLine, style: TextStyle(fontSize: 16)),
      ), // Add extra padding
    );
  }

  Widget _wrapInHorizontalScrollView({required Widget child}) {
    return LayoutBuilder(builder: (context, constraints) {
      return SingleChildScrollView(
        clipBehavior: Clip.none,
        scrollDirection: Axis.horizontal,
        child: IntrinsicWidth(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              _buildLongestLinePlaceHolder(constraints.maxWidth),
              child,
            ],
          ),
        ),
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Container(
          height: 600,
          width: 600,
          color: Colors.yellowAccent,
          child: SingleChildScrollView(
            physics: const ClampingScrollPhysics(),
            child: _wrapInHorizontalScrollView(
              child: TextField(
                scrollPhysics: const NeverScrollableScrollPhysics(),
                scrollPadding: EdgeInsets.zero,
                controller: _controller,
                keyboardType: TextInputType.multiline,
                decoration: null,
                maxLines: null,
                enabled: true,
                onChanged: (t) {},
                readOnly: false,
                clipBehavior: Clip.none,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

No response

Flutter Doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.0, on macOS 13.2.1 22D68 darwin-arm64)
[!] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1)
[✓] VS Code (version 1.78.0)
[✓] Connected device (2 available)
[✓] Network resources
@danagbemava-nc danagbemava-nc added the in triage Presently being triaged by the triage team label May 17, 2023
@danagbemava-nc
Copy link
Member

Hi @MousyBusiness, what platform(s) are you experiencing this issue on? Can you also share a recording of what the expected behavior is and what you're experiencing?

Thank you

@danagbemava-nc danagbemava-nc added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 17, 2023
@minhx3
Copy link

minhx3 commented May 19, 2023

I am facing the same problem, in version 3.7.12 SingleScrollView auto scrolling up when keyboard focus is from 3.10.0 onwards not working

@MousyBusiness
Copy link
Author

MousyBusiness commented May 21, 2023

@danagbemava-nc The testing was done on iPad. The video would not be extremely obvious what is happen, as the scroll view simply doesn't work. The expected behaviour is that horizontal and vertical scrolling combined enables the user to pan the text in the x and y axis

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 21, 2023
@danagbemava-nc
Copy link
Member

Thanks for the details. I can reproduce the issue but only on iOS.

I tested on macOS, chrome & android and these devices worked just fine. On iOS, this failed on the current stable & master whether or not impeller was used but it worked just fine on stable 3.7.12.

A few recordings

iOS

stable 3.7.12 current stable & master
PXL_20230522_073625404.ACTIVE.TS.mp4
PXL_20230522_072824987.TS.mp4

macOS (Chrome has a similar behavior)

Screen.Recording.2023-05-22.at.07.24.21.mov

android

screen-20230522-073801.mp4
flutter doctor -v
[!] Flutter (Channel unknown, 3.7.12, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB)
    ! Flutter version 3.7.12 on channel unknown at /Users/nexus/dev/sdks/flutter_rc/flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter_rc/flutter. Consider adding /Users/nexus/dev/sdks/flutter_rc/flutter/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter_rc/flutter. Consider adding /Users/nexus/dev/sdks/flutter_rc/flutter/bin to the front of your path.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/docs/get-started/install.
    • Framework revision 4d9e56e694 (5 weeks ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.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/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/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)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.1.1
    • Dart plugin version 231.9065

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9011.34/IntelliJ IDEA.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
    • 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.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (3 available)
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 16.4.1 20E252
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 113.0.5672.126
    ! Error: Dean’s iPad is busy: Fetching debug symbols for Dean’s iPad. Xcode will continue when Dean’s iPad is finished. (code -10)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 1 category.
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB)
    • Flutter version 3.10.1 on channel stable at /Users/nexus/dev/sdks/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d3d8effc68 (5 days ago), 2023-05-16 17:59:05 -0700
    • Engine revision b4fb11214d
    • Dart version 3.0.1
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/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)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.1.1
    • Dart plugin version 231.9065

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9011.34/IntelliJ IDEA.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
    • 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.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (4 available)
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 16.4.1 20E252
    • Nexus (mobile)       • 00008020-001875E83A38002E • ios            • iOS 16.4.1 20E252
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 113.0.5672.126

[✓] Network resources
    • All expected network resources are available.

• No issues found!
[!] Flutter (Channel master, 3.11.0-10.0.pre.44, on macOS 13.3.1 22E772610a darwin-arm64, locale en-GB)
    • Flutter version 3.11.0-10.0.pre.44 on channel master at /Users/nexus/dev/sdks/flutters
    ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutter/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutters. Consider adding /Users/nexus/dev/sdks/flutters/bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ab573048e7 (2 days ago), 2023-05-20 11:32:26 -0400
    • Engine revision aac0919568
    • Dart version 3.1.0 (build 3.1.0-129.0.dev)
    • DevTools version 2.23.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/nexus/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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.3)
    • Xcode at /Applications/Xcode-14.3.0.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9971841/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)

[✓] Android Studio (version 2022.2)
    • Android Studio at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/222.4459.24.2221.9862592/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)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/nexus/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 73.1.1
    • Dart plugin version 231.9065

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.2)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9011.34/IntelliJ IDEA.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.1)
    • IntelliJ at /Users/nexus/Library/Application Support/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.8770.65/IntelliJ IDEA.app
    • 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.78.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.64.0

[✓] Connected device (3 available)
    • Dean’s iPad (mobile) • 00008103-000825C811E3401E • ios            • iOS 16.4.1 20E252
    • macOS (desktop)      • macos                     • darwin-arm64   • macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)         • chrome                    • web-javascript • Google Chrome 113.0.5672.126

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.

@danagbemava-nc danagbemava-nc added c: regression It was better in the past than it is now platform-ios iOS applications specifically framework flutter/packages/flutter repository. See also f: labels. f: scrolling Viewports, list views, slivers, etc. has reproducible steps The issue has been confirmed reproducible and is ready to work on found in release: 3.10 Found to occur in 3.10 found in release: 3.11 Found to occur in 3.11 and removed in triage Presently being triaged by the triage team labels May 22, 2023
@ChristineWasike
Copy link

I am facing the same problem, in version 3.7.12 SingleScrollView auto scrolling up when keyboard focus is from 3.10.0 onwards not working

I'm facing the exact same issue.

@ChristineWasike
Copy link

Thanks for the details. I can reproduce the issue but only on iOS.

I tested on macOS, chrome & android and these devices worked just fine. On iOS, this failed on the current stable & master whether or not impeller was used but it worked just fine on stable 3.7.12.

A few recordings
flutter doctor -v

@danagbemava-nc is it possible to know how soon this issue will be resolved?
I'm using this function for a chat in the app. Initially, the keyboard would push up the chat text field but with this, the text field remains fixed behind the keyboard.

@Piinks
Copy link
Contributor

Piinks commented May 26, 2023

@Renzo-Olivares since this is a TextField, could some of the cases for nested scrolling and text fields that you've been working on be related?

@Piinks Piinks added a: text input Entering text in a text field or keyboard related problems f: gestures flutter/packages/flutter/gestures repository. and removed c: regression It was better in the past than it is now labels May 26, 2023
@Renzo-Olivares
Copy link
Contributor

Renzo-Olivares commented May 26, 2023

@Piinks it is unfortunately. A similar issue was reported in #124421 and I have a temporary workaround / explanation of the context of the issue here #124421 (comment). A similar workaround also works in this case by wrapping the SingleChildScrollView in a MediaQuery that gives a slightly lower touch slop then the one TextField has so it can beat it in the GestureArena.

I think I actually misspoke in that original explanation when I said the default touchSlop for touch devices is 8.0 it is actually 18.0.

From further investigation it looks like the following is happening.

LongPressGestureRecognizer, HorizontalDragGestureRecognizer and TapAndHorizontalDragGestureRecognizer all enter the GestureArena.

A drag happens:

LongPressGestureRecognizer is rejected because the drag moves past the origin position. This leaves TapAndHorizontalDragGesturerRecognizer and HorizontalDragGestureRecognizer to fight in the arena where both their thresholds for a drag are 18.0.

TapAndHorizontalDragGestureRecognizer receives the PointerEvent first so whenever a PointerEvent is dispatched that moves past the drag threshold TapAndHorizontalDragGestureRecognizer will be first one to get a chance to accept it.

The workaround, described works around this issue by giving HorizontalDragGestureRecognizer a lower touchSlop, so it can accept before TapAndHorizontalDragGestureRecognizer.

import 'dart:math';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      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> {
  TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    super.initState();

    _controller.text = """Tweak directional focus traversal by @gspencergoog in 116230
[framework] make ImageFiltered a repaint boundary by @jonahwilliams in 116385
[CP] Fix Snackbar TalkBack regression by @esouthren in 116417
Add widget of the week videos by @tvolkert in 116451
Speed up first asset load by encoding asset manifest in binary rather than JSON by @andrewkolos in 113637
Improve Flex layout comment by @loic-sharma in 116004
Do not parse stack traces in _findResponsibleMethod on Web platforms that use a different format by @jason-simmons in 115500
Support theming CupertinoSwitchs by @guidezpl in 116510
Fix MenuAnchor padding by @gspencergoog in 116573
Add ListenableBuilder with examples by @gspencergoog in 116543
Time picker precursors by @gspencergoog in 116450
Date picker special labeling for currentDate with localization and te… by @harperl-lgtm in 116433
Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations by @chunhtai in 110730
Revert “Speed up first asset load by encoding asset manifest in binary rather than JSON” by @CaseyHillers in 116662
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 115776
Revert “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116675
LookupBoundary by @goderbauer in 116429
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116676
Fix wrong position of TabBarIndicator when it’s label size and has label padding by @zmtzawqlp in 116398
Add CupertinoSliverNavigationBar large title magnification on over scroll by @ivirtex in 110127
Update text field input width when there are prefix/suffix icons by @hangyujin in 116690
Add Material 3 support for ListTile - Part 1 by @TahaTesser in 116194
MediaQuery as InheritedModel by @moffatman in 114459
Add LookupBoundary to Material by @goderbauer in 116736
Floating cursor cleanup by @moffatman in 116746
Revert “Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations” by @CaseyHillers in 116839
More gracefully handle license loading failures by @Hixie in 87841
Taboo the word “simply” from our API documentation. by @Hixie in 116061
Fix NavigationBar ripple for non-default NavigationDestinationLabelBehavior by @TahaTesser in 116888
Add LookupBoundary to Overlay by @goderbauer in 116741
[framework] make opacity widget create a repaint boundary by @j""";
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      _recomputeLongestLine();
      setState(() {});
    });
  }

  String _longestLine = '';

  void _recomputeLongestLine() {
    _longestLine = '';
    final _lines = _controller.text.split('\n');
    final buf = <String>[];

    for (var k = 0; k < _lines.length; k++) {
      buf.add((k + 1).toString());
    }
    // Find longest line
    _longestLine = '';
    for (var line in _lines) {
      if (line.length > _longestLine.length) _longestLine = line;
    }

    print("Longest: ${_longestLine}");
  }

  Widget _buildLongestLinePlaceHolder(double minWidth) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        maxHeight: 0,
        minWidth: max(minWidth, 0),
      ),
      child: Padding(
        padding: const EdgeInsets.only(right: 16),
        child: Text(_longestLine, style: TextStyle(fontSize: 16)),
      ), // Add extra padding
    );
  }

  Widget _wrapInHorizontalScrollView({required Widget child}) {
    return LayoutBuilder(builder: (context, constraints) {
      return MediaQuery(
        data: const MediaQueryData(
          gestureSettings: DeviceGestureSettings(touchSlop: 8.0)
        ),
        child: SingleChildScrollView(
          clipBehavior: Clip.none,
          scrollDirection: Axis.horizontal,
          child: IntrinsicWidth(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                _buildLongestLinePlaceHolder(constraints.maxWidth),
                child,
              ],
            ),
          ),
        ),
      );
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Container(
          height: 600,
          width: 600,
          color: Colors.yellowAccent,
          child: SingleChildScrollView(
            physics: const ClampingScrollPhysics(),
            child: _wrapInHorizontalScrollView(
              child: TextField(
                scrollPhysics: const NeverScrollableScrollPhysics(),
                scrollPadding: EdgeInsets.zero,
                controller: _controller,
                keyboardType: TextInputType.multiline,
                decoration: null,
                maxLines: null,
                enabled: true,
                onChanged: (t) {},
                readOnly: false,
                clipBehavior: Clip.none,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

@Piinks Piinks added c: regression It was better in the past than it is now P2 Important issues not at the top of the work list labels May 26, 2023
@MousyBusiness
Copy link
Author

@Renzo-Olivares This workaround fixes the nested scrolling, but it still has another issue which is that a parent gesture detector doesn't get onScale events in the horizontal axis (vertical works).

@Renzo-Olivares
Copy link
Contributor

@MousyBusiness do you have a reproducible example I can test out?

@MousyBusiness
Copy link
Author

MousyBusiness commented Jun 13, 2023

Try this @Renzo-Olivares. I've clamped the scrollviews and put them into a gesture detector with a transform for a bit of visual feedback. You'll notice that when touching the yellow text, you can move vertically, but you cannot move horizontally. This behaviour did not exist in 3.7.12

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    super.initState();

    _controller.text = """Tweak directional focus traversal by @gspencergoog in 116230
[framework] make ImageFiltered a repaint boundary by @jonahwilliams in 116385
[CP] Fix Snackbar TalkBack regression by @esouthren in 116417
Add widget of the week videos by @tvolkert in 116451
Speed up first asset load by encoding asset manifest in binary rather than JSON by @andrewkolos in 113637
Improve Flex layout comment by @loic-sharma in 116004
Do not parse stack traces in _findResponsibleMethod on Web platforms that use a different format by @jason-simmons in 115500
Support theming CupertinoSwitchs by @guidezpl in 116510
Fix MenuAnchor padding by @gspencergoog in 116573
Add ListenableBuilder with examples by @gspencergoog in 116543
Time picker precursors by @gspencergoog in 116450
Date picker special labeling for currentDate with localization and te… by @harperl-lgtm in 116433
Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations by @chunhtai in 110730
Revert “Speed up first asset load by encoding asset manifest in binary rather than JSON” by @CaseyHillers in 116662
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 115776
Revert “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116675
LookupBoundary by @goderbauer in 116429
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116676
Fix wrong position of TabBarIndicator when it’s label size and has label padding by @zmtzawqlp in 116398
Add CupertinoSliverNavigationBar large title magnification on over scroll by @ivirtex in 110127
Update text field input width when there are prefix/suffix icons by @hangyujin in 116690
Add Material 3 support for ListTile - Part 1 by @TahaTesser in 116194
MediaQuery as InheritedModel by @moffatman in 114459
Add LookupBoundary to Material by @goderbauer in 116736
Floating cursor cleanup by @moffatman in 116746
Revert “Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations” by @CaseyHillers in 116839
More gracefully handle license loading failures by @Hixie in 87841
Taboo the word “simply” from our API documentation. by @Hixie in 116061
Fix NavigationBar ripple for non-default NavigationDestinationLabelBehavior by @TahaTesser in 116888
Add LookupBoundary to Overlay by @goderbauer in 116741
Revert “Speed up first asset load by encoding asset manifest in binary rather than JSON” by @CaseyHillers in 116662
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 115776
Revert “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116675
LookupBoundary by @goderbauer in 116429
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116676
Fix wrong position of TabBarIndicator when it’s label size and has label padding by @zmtzawqlp in 116398
Add CupertinoSliverNavigationBar large title magnification on over scroll by @ivirtex in 110127
Update text field input width when there are prefix/suffix icons by @hangyujin in 116690
Add Material 3 support for ListTile - Part 1 by @TahaTesser in 116194
MediaQuery as InheritedModel by @moffatman in 114459
Add LookupBoundary to Material by @goderbauer in 116736
Floating cursor cleanup by @moffatman in 116746
Revert “Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations” by @CaseyHillers in 116839
More gracefully handle license loading failures by @Hixie in 87841
Taboo the word “simply” from our API documentation. by @Hixie in 116061
Fix NavigationBar ripple for non-default NavigationDestinationLabelBehavior by @TahaTesser in 116888
Add LookupBoundary to Overlay by @goderbauer in 116741
[framework] make opacity widget create a repaint boundary by @j""";
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      _recomputeLongestLine();
      setState(() {});
    });
  }

  String _longestLine = '';

  void _recomputeLongestLine() {
    _longestLine = '';
    final _lines = _controller.text.split('\n');
    final buf = <String>[];

    for (var k = 0; k < _lines.length; k++) {
      buf.add((k + 1).toString());
    }
    // Find longest line
    _longestLine = '';
    for (var line in _lines) {
      if (line.length > _longestLine.length) _longestLine = line;
    }

    print("Longest: ${_longestLine}");
  }

  Widget _buildLongestLinePlaceHolder(double minWidth) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        maxHeight: 0,
        minWidth: max(minWidth, 0),
      ),
      child: Padding(
        padding: const EdgeInsets.only(right: 16),
        child: Text(_longestLine, style: TextStyle(fontSize: 16)),
      ), // Add extra padding
    );
  }

  Widget _wrapInHorizontalScrollView({required Widget child}) {
    return LayoutBuilder(builder: (context, constraints) {
      return MediaQuery(
        data: const MediaQueryData(gestureSettings: DeviceGestureSettings(touchSlop: 8.0)),
        child: SingleChildScrollView(
          physics: const NeverScrollableScrollPhysics(),
          clipBehavior: Clip.none,
          scrollDirection: Axis.horizontal,
          child: IntrinsicWidth(
            child: Column(
              mainAxisSize: MainAxisSize.min,
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                _buildLongestLinePlaceHolder(constraints.maxWidth),
                child,
              ],
            ),
          ),
        ),
      );
    });
  }

  Offset _lastFocalPoint = Offset.zero;
  Matrix4 matrix = Matrix4.identity();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: GestureDetector(
        onScaleStart: (d) {
          _lastFocalPoint = d.focalPoint;
          print("Scale start");
        },
        onScaleUpdate: (d) {
          print("Scale update");
          Offset delta = d.focalPoint - _lastFocalPoint;
          final m1 = Matrix4.identity()
            ..translate(delta.dx, delta.dy)
            ..multiply(matrix);
          matrix = m1;
          _lastFocalPoint = d.focalPoint;
          setState(() {});
        },
        onScaleEnd: (_) {
          print("Scale end");
        },
        child: Container(
          width: double.infinity,
          height: double.infinity,
          color: Colors.red.withOpacity(0.1),
          child: Stack(
            children: [
              Transform(
                transform: matrix,
                child: Container(
                  height: 600,
                  width: 600,
                  color: Colors.yellowAccent,
                  child: SingleChildScrollView(
                    physics: const NeverScrollableScrollPhysics(),
                    child: _wrapInHorizontalScrollView(
                      child: TextField(
                        scrollPhysics: const NeverScrollableScrollPhysics(),
                        scrollPadding: EdgeInsets.zero,
                        controller: _controller,
                        keyboardType: TextInputType.multiline,
                        decoration: null,
                        maxLines: null,
                        enabled: true,
                        onChanged: (t) {},
                        readOnly: false,
                        clipBehavior: Clip.none,
                      ),
                    ),
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}

@MousyBusiness
Copy link
Author

MousyBusiness commented Jun 13, 2023

@Renzo-Olivares it actually still happens if you remove both scroll views.

The source of the event absorb seems to be these lines in TextField (line 1477):

            child: _selectionGestureDetectorBuilder.buildGestureDetector(
              behavior: HitTestBehavior.translucent,
              child: child,
            ),

Specifically the drag selection in text_selection.dart (line 2852):

  Widget buildGestureDetector({
    Key? key,
    HitTestBehavior? behavior,
    required Widget child,
  }) {
    return TextSelectionGestureDetector(
      key: key,
      onTapDown: onTapDown,
      onForcePressStart: delegate.forcePressEnabled ? onForcePressStart : null,
      onForcePressEnd: delegate.forcePressEnabled ? onForcePressEnd : null,
      onSecondaryTap: onSecondaryTap,
      onSecondaryTapDown: onSecondaryTapDown,
      onSingleTapUp: onSingleTapUp,
      onSingleTapCancel: onSingleTapCancel,
      onSingleLongTapStart: onSingleLongTapStart,
      onSingleLongTapMoveUpdate: onSingleLongTapMoveUpdate,
      onSingleLongTapEnd: onSingleLongTapEnd,
      onDoubleTapDown: onDoubleTapDown,
      onTripleTapDown: onTripleTapDown,
      onDragSelectionStart: onDragSelectionStart, // HERE
      onDragSelectionUpdate: onDragSelectionUpdate, // HERE
      onDragSelectionEnd: onDragSelectionEnd, // HERE
      behavior: behavior,
      child: child,
    );
  }

@Renzo-Olivares
Copy link
Contributor

Renzo-Olivares commented Jun 20, 2023

@MousyBusiness sorry for the late reply. The workaround I posted should still work in this case. You just have to move the added MediaQuery widget to encapsulate the GestureDetector that contains the scaling so the ScaleGestureRecognizer can also beat the TextFields TapAndHorizontalDragGestureRecognizer. Let me know if that works for you.

import 'dart:math';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      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> {
  TextEditingController _controller = TextEditingController();

  @override
  void initState() {
    super.initState();

    _controller.text = """Tweak directional focus traversal by @gspencergoog in 116230
[framework] make ImageFiltered a repaint boundary by @jonahwilliams in 116385
[CP] Fix Snackbar TalkBack regression by @esouthren in 116417
Add widget of the week videos by @tvolkert in 116451
Speed up first asset load by encoding asset manifest in binary rather than JSON by @andrewkolos in 113637
Improve Flex layout comment by @loic-sharma in 116004
Do not parse stack traces in _findResponsibleMethod on Web platforms that use a different format by @jason-simmons in 115500
Support theming CupertinoSwitchs by @guidezpl in 116510
Fix MenuAnchor padding by @gspencergoog in 116573
Add ListenableBuilder with examples by @gspencergoog in 116543
Time picker precursors by @gspencergoog in 116450
Date picker special labeling for currentDate with localization and te… by @harperl-lgtm in 116433
Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations by @chunhtai in 110730
Revert “Speed up first asset load by encoding asset manifest in binary rather than JSON” by @CaseyHillers in 116662
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 115776
Revert “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116675
LookupBoundary by @goderbauer in 116429
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116676
Fix wrong position of TabBarIndicator when it’s label size and has label padding by @zmtzawqlp in 116398
Add CupertinoSliverNavigationBar large title magnification on over scroll by @ivirtex in 110127
Update text field input width when there are prefix/suffix icons by @hangyujin in 116690
Add Material 3 support for ListTile - Part 1 by @TahaTesser in 116194
MediaQuery as InheritedModel by @moffatman in 114459
Add LookupBoundary to Material by @goderbauer in 116736
Floating cursor cleanup by @moffatman in 116746
Revert “Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations” by @CaseyHillers in 116839
More gracefully handle license loading failures by @Hixie in 87841
Taboo the word “simply” from our API documentation. by @Hixie in 116061
Fix NavigationBar ripple for non-default NavigationDestinationLabelBehavior by @TahaTesser in 116888
Add LookupBoundary to Overlay by @goderbauer in 116741
Revert “Speed up first asset load by encoding asset manifest in binary rather than JSON” by @CaseyHillers in 116662
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 115776
Revert “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116675
LookupBoundary by @goderbauer in 116429
Reland “Use semantics label for backbutton and closebutton for Android” by @chunhtai in 116676
Fix wrong position of TabBarIndicator when it’s label size and has label padding by @zmtzawqlp in 116398
Add CupertinoSliverNavigationBar large title magnification on over scroll by @ivirtex in 110127
Update text field input width when there are prefix/suffix icons by @hangyujin in 116690
Add Material 3 support for ListTile - Part 1 by @TahaTesser in 116194
MediaQuery as InheritedModel by @moffatman in 114459
Add LookupBoundary to Material by @goderbauer in 116736
Floating cursor cleanup by @moffatman in 116746
Revert “Adds API in semanticsconfiguration to decide how to merge child semanticsConfigurations” by @CaseyHillers in 116839
More gracefully handle license loading failures by @Hixie in 87841
Taboo the word “simply” from our API documentation. by @Hixie in 116061
Fix NavigationBar ripple for non-default NavigationDestinationLabelBehavior by @TahaTesser in 116888
Add LookupBoundary to Overlay by @goderbauer in 116741
[framework] make opacity widget create a repaint boundary by @j""";
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      _recomputeLongestLine();
      setState(() {});
    });
  }

  String _longestLine = '';

  void _recomputeLongestLine() {
    _longestLine = '';
    final _lines = _controller.text.split('\n');
    final buf = <String>[];

    for (var k = 0; k < _lines.length; k++) {
      buf.add((k + 1).toString());
    }
    // Find longest line
    _longestLine = '';
    for (var line in _lines) {
      if (line.length > _longestLine.length) _longestLine = line;
    }

    print("Longest: ${_longestLine}");
  }

  Widget _buildLongestLinePlaceHolder(double minWidth) {
    return ConstrainedBox(
      constraints: BoxConstraints(
        maxHeight: 0,
        minWidth: max(minWidth, 0),
      ),
      child: Padding(
        padding: const EdgeInsets.only(right: 16),
        child: Text(_longestLine, style: TextStyle(fontSize: 16)),
      ), // Add extra padding
    );
  }

  Widget _wrapInHorizontalScrollView({required Widget child}) {
    return LayoutBuilder(builder: (context, constraints) {
      return SingleChildScrollView(
        physics: const NeverScrollableScrollPhysics(),
        clipBehavior: Clip.none,
        scrollDirection: Axis.horizontal,
        child: IntrinsicWidth(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              _buildLongestLinePlaceHolder(constraints.maxWidth),
              child,
            ],
          ),
        ),
      );
    });
  }

  Offset _lastFocalPoint = Offset.zero;
  Matrix4 matrix = Matrix4.identity();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: MediaQuery(
        data: const MediaQueryData(gestureSettings: DeviceGestureSettings(touchSlop: 8.0)),
        child: GestureDetector(
          onScaleStart: (d) {
            _lastFocalPoint = d.focalPoint;
            print("Scale start");
          },
          onScaleUpdate: (d) {
            print("Scale update");
            Offset delta = d.focalPoint - _lastFocalPoint;
            final m1 = Matrix4.identity()
              ..translate(delta.dx, delta.dy)
              ..multiply(matrix);
            matrix = m1;
            _lastFocalPoint = d.focalPoint;
            setState(() {});
          },
          onScaleEnd: (_) {
            print("Scale end");
          },
          child: Container(
            width: double.infinity,
            height: double.infinity,
            color: Colors.red.withOpacity(0.1),
            child: Stack(
              children: [
                Transform(
                  transform: matrix,
                  child: Container(
                    height: 600,
                    width: 600,
                    color: Colors.yellowAccent,
                    child: SingleChildScrollView(
                      physics: const NeverScrollableScrollPhysics(),
                      child: _wrapInHorizontalScrollView(
                        child: TextField(
                          scrollPhysics: const NeverScrollableScrollPhysics(),
                          scrollPadding: EdgeInsets.zero,
                          controller: _controller,
                          keyboardType: TextInputType.multiline,
                          decoration: null,
                          maxLines: null,
                          enabled: true,
                          onChanged: (t) {},
                          readOnly: false,
                          clipBehavior: Clip.none,
                        ),
                      ),
                    ),
                  ),
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}

@urusai88
Copy link

@Renzo-Olivares this workaround is very dirty but works! Thanks you!

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
a: text input Entering text in a text field or keyboard related problems c: regression It was better in the past than it is now f: gestures flutter/packages/flutter/gestures repository. f: scrolling Viewports, list views, slivers, etc. found in release: 3.10 Found to occur in 3.10 found in release: 3.11 Found to occur in 3.11 framework flutter/packages/flutter repository. See also f: labels. has reproducible steps The issue has been confirmed reproducible and is ready to work on P2 Important issues not at the top of the work list platform-ios iOS applications specifically r: fixed Issue is closed as already fixed in a newer version team-ios Owned by iOS platform team triaged-ios Triaged by iOS platform team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants