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.81k stars 27.65k forks source link

Vertical incline scrolling didn't work all the time in nested scrolling approach #81818

Open ashok-kuvaraja opened 3 years ago

ashok-kuvaraja commented 3 years ago

Hi Team, I need to provide nested scrolling support for my application. In that, I couldn't able to do vertical incline scrolling all the time. Please do the needful.

Steps to Reproduce

  1. Find the code snippets below
    
    import 'package:flutter/material.dart';

class NestedScrollDemo extends StatefulWidget { NestedScrollDemo({Key? key}) : super(key: key);

@override _NestedScrollDemoState createState() => _NestedScrollDemoState(); }

class _NestedScrollDemoState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Nested scroll demo'), ), body: SingleChildScrollView( scrollDirection: Axis.vertical, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Column( children: List.generate(30, (index) => _buildRow(index)), ), ), ), ); } }

Widget _buildRow(int rowIndex) { return Row( children: List.generate( 6, (colIndex) => Container( alignment: Alignment.center, decoration: BoxDecoration( border: Border.all(color: Colors.grey.withOpacity(0.45), width: 1.0)), child: Text('Row $rowIndex'), width: 100, height: 50, ), ), ); }

2. Demo video

https://user-images.githubusercontent.com/60499432/116987616-e76ef500-acec-11eb-8577-4fbee08196e0.mp4

**Expected results:** Scrolling should be worked all the time.

**Actual results:** Scrolling did not work randomly.

<details>
  <summary>Logs</summary>

Analyzing example... No issues found! (ran in 19.5s)

[√] Flutter (Channel stable, 2.0.3, on Microsoft Windows [Version 10.0.18363.1440], locale en-US) • Flutter version 2.0.3 at C:\src\flutter • Framework revision 4d7946a68d (7 weeks ago), 2021-03-18 17:24:33 -0700 • Engine revision 3459eb2436 • Dart version 2.12.2

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\AshokKuvaraja\AppData\Local\Android\sdk • Platform android-30, build-tools 30.0.3 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop for Windows (Visual Studio Professional 2019 16.4.5) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional • Visual Studio Professional 2019 version 16.4.29806.167 • Windows 10 SDK version 10.0.18362.0

[√] Android Studio (version 3.3) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 34.0.1 • Dart plugin version 182.5215 • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[√] VS Code, 64-bit edition (version 1.55.1) • VS Code at C:\Program Files\Microsoft VS Code • Flutter extension version 3.21.0

[√] Connected device (4 available) • Moto G 5S (mobile) • ZY3228D7NG • android-arm • Android 7.1.1 (API 25) • AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.18363.1440] • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93

• No issues found!



</details>
TahaTesser commented 3 years ago

Hi @ashok-kuvaraja Thanks for filing the issue and the details, I just tried to reproduce on the stable on iOS and android , I can scroll vertically without noticeable issues

flutter doctor -v ```console [✓] Flutter (Channel stable, 2.0.6, on macOS 11.3 20E232 darwin-x64, locale en-GB) • Flutter version 2.0.6 at /Users/tahatesser/Code/flutter_stable • Framework revision 1d9032c7e1 (5 days ago), 2021-04-29 17:37:58 -0700 • Engine revision 05e680e202 • Dart version 2.12.3 [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at /Volumes/Extreme/SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = /Volumes/Extreme/SDK • 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-6915495) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer • Xcode 12.5, Build version 12E262 • CocoaPods version 1.10.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 4.1) • 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 1.8.0_242-release-1644-b3-6915495) [✓] VS Code (version 1.55.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.22.0 [✓] Connected device (3 available) • Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator) • macOS (desktop) • macos • darwin-x64 • macOS 11.3 20E232 darwin-x64 • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93 • No issues found! ```

Can you please upgrade to the latest stable and try again flutter channel stable flutter upgrade --force flutter doctor -v

If the problem persists, please provide the exact reproducible steps Thank you

ashok-kuvaraja commented 3 years ago

Hi @TahaTesser ,

Still, I am facing the issue, When I try to do vertical fling from left center to top right angle (vertical incline).

  1. Run the sample.
  2. Do vertical fling from Row 5 first cell to top-right in vertical incline direction.
  3. I did not get scrolling all the time.
  4. Find the vertical fling direction image of what I did below.
TahaTesser commented 3 years ago

Hi @ashok-kuvaraja Thanks for the details, I just tried the code sample on a physical, I can see it sometimes struggling to scroll when using the same incline as you. Instead, the layout scrolls horizontally.

code sample ```dart import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Material App', home: NestedScrollDemo(), ); } } class NestedScrollDemo extends StatefulWidget { NestedScrollDemo({Key? key}) : super(key: key); @override _NestedScrollDemoState createState() => _NestedScrollDemoState(); } class _NestedScrollDemoState extends State { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Nested scroll demo'), ), body: SingleChildScrollView( scrollDirection: Axis.vertical, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Column( children: List.generate(30, (index) => _buildRow(index)), ), ), ), ); } } Widget _buildRow(int rowIndex) { return Row( children: List.generate( 6, (colIndex) => Container( alignment: Alignment.center, decoration: BoxDecoration( border: Border.all(color: Colors.grey.withOpacity(0.45), width: 1.0)), child: Text('Row $rowIndex'), width: 100, height: 50, ), ), ); } ```
flutter doctor -v ```console [✓] Flutter (Channel stable, 2.0.6, on Microsoft Windows [Version 10.0.19042.928], locale en-US) • Flutter version 2.0.6 at C:\Users\Taha\Code\flutter_stable • Framework revision 1d9032c7e1 (5 days ago), 2021-04-29 17:37:58 -0700 • Engine revision 05e680e202 • Dart version 2.12.3 [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Taha\Code\SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = C:\Users\Taha\Code\SDK • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) ✗ Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details. [✓] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.4) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.9.31205.134 • Windows 10 SDK version 10.0.19041.0 [✓] Android Studio (version 4.1.0) • Android Studio at C:\Users\Taha\Code\android-studio • 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 1.8.0_242-release-1644-b01) [✓] IntelliJ IDEA Community Edition (version 2021.1) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.3 • 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.55.2) • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.22.0 [✓] Connected device (4 available) • IN2011 (mobile) • c9d8ee0c • android-arm64 • Android 11 (API 30) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.928] • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93 • Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.51 ! Doctor found issues in 1 category. ``` ```console [✓] Flutter (Channel master, 2.3.0-1.0.pre.227, on Microsoft Windows [Version 10.0.19042.928], locale en-US) • Flutter version 2.3.0-1.0.pre.227 at C:\Users\Taha\Code\flutter_master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 7f1d1414cc (19 hours ago), 2021-05-04 06:17:19 -0700 • Engine revision 378e4dbc41 • Dart version 2.14.0 (build 2.14.0-48.0.dev) [!] Android toolchain - develop for Android devices (Android SDK version 30.0.3) • Android SDK at C:\Users\Taha\Code\SDK • Platform android-30, build-tools 30.0.3 • ANDROID_HOME = C:\Users\Taha\Code\SDK • Java binary at: C:\Users\Taha\Code\android-studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01) ✗ Android license status unknown. Run `flutter doctor --android-licenses` to accept the SDK licenses. See https://flutter.dev/docs/get-started/install/windows#android-setup for more details. [✓] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.9.4) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.9.31205.134 • Windows 10 SDK version 10.0.19041.0 [✓] Android Studio (version 4.1.0) • Android Studio at C:\Users\Taha\Code\android-studio • 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 1.8.0_242-release-1644-b01) [✓] IntelliJ IDEA Community Edition (version 2021.1) • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.3 • 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.55.2) • VS Code at C:\Users\Taha\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.22.0 [✓] Connected device (4 available) • IN2011 (mobile) • c9d8ee0c • android-arm64 • Android 11 (API 30) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19042.928] • Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.93 • Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.51 ! Doctor found issues in 1 category. ```
dam-ease commented 1 year ago

I am able to reproduce this issue on the latest master and stable channels. Code Sample

flutter doctor -v ```bash [✓] Flutter (Channel master, 3.11.0-2.0.pre.55, on macOS 13.3 22E252 darwin-arm64, locale en-NG) • Flutter version 3.11.0-2.0.pre.55 on channel master at /Users/dammya/fvm/versions/master • Upstream repository https://github.com/flutter/flutter.git • Framework revision 835b892d7f (4 days ago), 2023-05-07 01:30:22 +0530 • Engine revision 23f730efbf • Dart version 3.1.0 (build 3.1.0-83.0.dev) • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/dammya/Library/Android/sdk • Platform android-33, build-tools 32.1.0-rc1 • ANDROID_HOME = /Users/dammya/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2022.3.2) • IntelliJ at /Applications/IntelliJ IDEA CE.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.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.50.0 [✓] VS Code (version 1.78.0) • VS Code at /Users/dammya/.Trash/Visual Studio Code 20.07.05.app/Contents • Flutter extension version 3.50.0 [✓] Connected device (5 available) • TECNO LC6a (mobile) • 044882598G014637 • android-arm • Android 9 (API 28) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • iPhone 14 Pro Max (mobile) • D7F3302D-D66F-4B89-B8CF-DBEE1CDB5449 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3 22E252 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92 [✓] Network resources • All expected network resources are available. • No issues found! ``` ```bash [✓] Flutter (Channel stable, 3.10.0, on macOS 13.3 22E252 darwin-arm64, locale en-NG) • Flutter version 3.10.0 on channel stable at /Users/dammya/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision 84a1e904f4 (2 days ago), 2023-05-09 07:41:44 -0700 • Engine revision d44b5a94c9 • Dart version 3.0.0 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/dammya/Library/Android/sdk • Platform android-33, build-tools 32.1.0-rc1 • ANDROID_HOME = /Users/dammya/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E222b • CocoaPods version 1.11.3 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.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 11.0.12+0-b1504.28-7817840) [✓] IntelliJ IDEA Community Edition (version 2022.3.2) • IntelliJ at /Applications/IntelliJ IDEA CE.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.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.50.0 [✓] VS Code (version 1.78.0) • VS Code at /Users/dammya/.Trash/Visual Studio Code 20.07.05.app/Contents • Flutter extension version 3.50.0 [✓] Connected device (5 available) • TECNO LC6a (mobile) • 044882598G014637 • android-arm • Android 9 (API 28) • sdk gphone arm64 (mobile) • emulator-5554 • android-arm64 • Android 11 (API 30) (emulator) • iPhone 14 Pro Max (mobile) • D7F3302D-D66F-4B89-B8CF-DBEE1CDB5449 • ios • com.apple.CoreSimulator.SimRuntime.iOS-16-4 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 13.3 22E252 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 113.0.5672.92 [✓] Network resources • All expected network resources are available. • No issues found! ```