Skip to content

Scroll views with horzontal scroll axis should scroll by default without pressing shift when on desktop #83065

Closed

Description

@jeremiahlukus

I know this is still on the dev branch i just reporting an issue.

When using PageView on web I am unable to scroll it works fine on mobile but on web it doesn't move.
i think #78558 might have busted the web somehow.

[✓] Flutter (Channel dev, 2.3.0-12.1.pre, on Mac OS X 10.15.7 19H1030 darwin-x64, locale en)

Activity

  1. TahaTesser commented on May 21, 2021

    @TahaTesser
    Contributor

    Hi @jeremiahlukus
    This is not a regression, mouse drags are disabled by default #81569 but you can scroll using mouse

    Since PageView is scrollable horizontally, you need to press Shift + Scroll. For the vertical list, you can just scroll as usual.

    Run the code below, press Shift + Scroll

    minimal code sample
    /// Flutter code sample for PageView
    
    // Here is an example of [PageView]. It creates a centered [Text] in each of the three pages
    // which scroll horizontally.
    
    import 'package:flutter/material.dart';
    
    void main() => runApp(const MyApp());
    
    /// This is the main application widget.
    class MyApp extends StatelessWidget {
      const MyApp({Key? key}) : super(key: key);
    
      static const String _title = 'Flutter Code Sample';
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: _title,
          home: Scaffold(
            appBar: AppBar(title: const Text(_title)),
            body: const MyStatelessWidget(),
          ),
        );
      }
    }
    
    /// This is the stateless widget that the main application instantiates.
    class MyStatelessWidget extends StatelessWidget {
      const MyStatelessWidget({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        final PageController controller = PageController(initialPage: 0);
        return PageView(
          /// [PageView.scrollDirection] defaults to [Axis.horizontal].
          /// Use [Axis.vertical] to scroll vertically.
          scrollDirection: Axis.horizontal,
          controller: controller,
          children: const <Widget>[
            Center(
              child: Text('First Page'),
            ),
            Center(
              child: Text('Second Page'),
            ),
            Center(
              child: Text('Third Page'),
            )
          ],
        );
      }
    }
    
    flutter doctor -v
    [✓] Flutter (Channel master, 2.3.0-13.0.pre.87, on macOS 11.3.1 20E241 darwin-x64, locale en-GB)
        • Flutter version 2.3.0-13.0.pre.87 at /Users/tahatesser/Code/flutter_master
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 4d6a925326 (10 hours ago), 2021-05-21 01:09:02 -0400
        • Engine revision 20260fb95f
        • Dart version 2.14.0 (build 2.14.0-134.0.dev)
    
    [✓] 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 11.0.8+10-b944.6916264)
        • 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.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.8+10-b944.6916264)
    
    [✓] IntelliJ IDEA Community Edition (version 2021.1.1)
        • IntelliJ at /Volumes/Extreme/IntelliJ IDEA CE.app
        • Flutter plugin version 55.1.5
        • Dart plugin version 211.7233
    
    [✓] VS Code (version 1.56.2)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.22.0
    
    [✓] Connected device (3 available)
        • iPhone 12 (mobile) • D72A5DAA-24E6-421B-B4F5-7CFAFB498040 • ios            •
          com.apple.CoreSimulator.SimRuntime.iOS-14-5 (simulator)
        • macOS (desktop)    • macos                                • darwin-x64     • macOS 11.3.1 20E241
          darwin-x64
        • Chrome (web)       • chrome                               • web-javascript • Google Chrome
          90.0.4430.212
    
    • No issues found!

    This might a side effect of this change, It think regular scroll should also scroll horizontal pageview without pressing shift on desktop

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 21, 2021
  3. jeremiahlukus commented on May 21, 2021

    @jeremiahlukus
    Author

    Yea seems odd to have to hold shift to drag on desktop very unintuitive. Thanks for pointing to the commit that gives me a place to look to overwrite this behavior

  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on May 21, 2021
  5. changed the title [-][dev channel] PageView on web broken[/-] [+]Scroll views with horizontal scroll axis on desktop requires `shift` + scroll after desktop rejects drags by default[/+] on May 24, 2021
  6. added
    f: scrollingViewports, list views, slivers, etc.
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    in triagePresently being triaged by the triage team
    on May 24, 2021
  7. changed the title [-]Scroll views with horizontal scroll axis on desktop requires `shift` + scroll after desktop rejects drags by default[/-] [+]Scroll views with horizontal scroll axis on desktop requires `shift` + scroll after desktop mouse rejects drags by default[/+] on May 24, 2021
  8. changed the title [-]Scroll views with horizontal scroll axis on desktop requires `shift` + scroll after desktop mouse rejects drags by default[/-] [+]Scroll views with horzontal scroll axis should scroll by default without pressing `shift` when on desktop[/+] on May 26, 2021
  9. TahaTesser commented on May 26, 2021

    @TahaTesser
    Contributor

    This issue tracks horizontal scroll requiring shift +scroll on desktop, which adds an extra step to scroll.
    Changing the title to better address the solution

  10. gspencergoog commented on May 27, 2021

    @gspencergoog
    Contributor

    This is as designed. Shift+scroll wheel is the standard for horizontal scrolling on desktop applications, even when only horizontal scrolling is available.

    If we changed it as you suggest, then nested scroll views would act very strangely: think of a horizontal scroll inside of a vertical scroll: when the vertical scroll reached the end, it would start scrolling horizontally.

  11. github-actions commented on Aug 1, 2021

    @github-actions

    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.

  12. locked as resolved and limited conversation to collaborators on Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: desktopRunning on desktopf: scrollingViewports, list views, slivers, etc.found in release: 2.3Found to occur in 2.3frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: invalidIssue is closed as not valid

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions