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

Horizontal ListWheelScrollView feature request #25074

Open
dbohatyrov opened this issue Dec 7, 2018 · 20 comments
Open

Horizontal ListWheelScrollView feature request #25074

dbohatyrov opened this issue Dec 7, 2018 · 20 comments
Labels
c: new feature Nothing broken; request for a new capability f: gestures flutter/packages/flutter/gestures repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. P3 Issues that are less important to the Flutter project team-framework Owned by Framework team triaged-framework Triaged by Framework team

Comments

@dbohatyrov
Copy link

dbohatyrov commented Dec 7, 2018

It's more a feature request than an issue, to get possibility of rotating ListWheelScrollView. Or if it is already possible update the docs.

ListView have property Axis scrollDirection which is controlling ListView orientation (vertical or horizontal). I would be happy to have same property on ListWheelScrollView

Steps to Reproduce

  1. Build ListWheelScrollView.
  2. Realize that Axis scrollDirection is missing
  3. Try to rotate it with Transform.rotate
  4. Get strange behaviour of Vertical finger movement and horizontal List movement

Logs

[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [Version 10.0.17758.1], locale ru-RU)
    • Flutter version 1.0.0 at C:\Users\denis\sdk\flutter
    • Framework revision 5391447fae (7 days ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\denis\AppData\Local\Android\Sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = C:\Users\denis\AppData\Local\Android\Sdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    X Flutter plugin not installed; this adds Flutter specific functionality.
    X Dart plugin not installed; this adds Dart specific functionality.
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] VS Code (version 1.29.1)
    • VS Code at C:\Users\denis\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 2.21.1

[√] Connected device (1 available)
    • Mi A2 Lite • 4b334b3d0205 • android-arm64 • Android 8.1.0 (API 27)
@zoechi zoechi added the framework flutter/packages/flutter repository. See also f: labels. label Dec 7, 2018
@zoechi zoechi added this to the Goals milestone Dec 7, 2018
@zoechi zoechi added f: scrolling Viewports, list views, slivers, etc. f: gestures flutter/packages/flutter/gestures repository. labels Dec 7, 2018
@goderbauer goderbauer added the c: new feature Nothing broken; request for a new capability label Jan 4, 2019
@JasCodes
Copy link

@zoechi @goderbauer Any updates or any code snippet available to deal with this issue. Thx

@ReginFell
Copy link

Any news? Have the same issue, haven't found any good solutions so far

@JasCodes
Copy link

@ReginFell @goderbauer @zoechi

Heres my workaround. Please upvote.

https://stackoverflow.com/questions/52578569/how-to-make-listwheelscrollview-horizontal/57881655#57881655

@csells csells changed the title Horizontal ListWheelScrollView Horizontal ListWheelScrollView feature request Jan 9, 2020
@nishantsubedi
Copy link

Any Updates yet on this issue

@omri1100
Copy link

omri1100 commented Apr 1, 2020

Any update?

@mohammadne
Copy link

update ????

@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@giorgio79
Copy link

This package works great https://pub.dev/packages/carousel_slider

@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@jameslester2004
Copy link

Would really appreciate this feature too!

@jameslester2004
Copy link

Hey Jas, thanks for this. I had seen on Stack overflow.

It is ok. Would prefer a more comprehensive official version where we just need to add an scrollDirection property like list view, without needing to use builders.

I have it working. Am I doing something really stupid or does the list just keep scrolling either side, even if there is no widget to display?

Surely need to declare the item count somewhere?

Cheers

@JasCodes
Copy link

JasCodes commented Aug 25, 2020

@jameslester2004 if you read the code, I am using not default constructor but useDelgate one cause I needed infinite builder for my use case. You can easily modify it and pass children to default constrcutor.

ListWheelScrollView.useDelegate

Refer both constructors here

https://api.flutter.dev/flutter/widgets/ListWheelScrollView-class.html

I will actually publish package actually with both contructors.

@jameslester2004
Copy link

Hey man, sorry you're absolutely right. I just got it going. Neat fix! Thanks.

@JasCodes
Copy link

Guys I have add package at https://pub.dev/packages/list_wheel_scroll_view_x

If someone finds it useful; please give the package a like and upvote it on stackoverflow

Thx

cc
@jameslester2004

@maheshmnj
Copy link
Member

maheshmnj commented Mar 22, 2021

Here's a Naive Workaround using the existing ListWheelScrollView

The basic idea is to rotate the ListWheelScrollView using the RotatedBox. Using this approach in one of my apps

Demo Output with

ezgif com-gif-maker (1)

But I do still support this feature Request of having the direction api out of the box.

@codemicah
Copy link

Being able to change the scroll direction of a ListWheelScrollView is one really needed feature.

@aluxen
Copy link

aluxen commented Oct 7, 2021

Any update?

@rahmanrezaee
Copy link

rahmanrezaee commented Oct 22, 2021

copy this code and used it

code sample
    import 'package:flutter/material.dart';
    import 'package:flutter/rendering.dart';

    class ListWheelScrollViewX extends StatelessWidget {
      final Axis scrollDirection;
      final List<Widget>? children;
      final ScrollController? controller;
      final ScrollPhysics? physics;
      final double diameterRatio;
      final double perspective;
      final double offAxisFraction;
      final bool useMagnifier;
      final double magnification;
      final double overAndUnderCenterOpacity;
      final double itemExtent;
      final double squeeze;
      final ValueChanged<int>? onSelectedItemChanged;
      final bool renderChildrenOutsideViewport;
      final ListWheelChildDelegate? childDelegate;
      final Clip clipBehavior;
    
      const ListWheelScrollViewX({
        Key? key,
        this.scrollDirection = Axis.vertical,
        this.controller,
        this.physics,
        this.diameterRatio = RenderListWheelViewport.defaultDiameterRatio,
        this.perspective = RenderListWheelViewport.defaultPerspective,
        this.offAxisFraction = 0.0,
        this.useMagnifier = false,
        this.magnification = 1.0,
        this.overAndUnderCenterOpacity = 1.0,
        required this.itemExtent,
        this.squeeze = 1.0,
        this.onSelectedItemChanged,
        this.renderChildrenOutsideViewport = false,
        this.clipBehavior = Clip.hardEdge,
        required this.children,
      })  : childDelegate = null,
            super(key: key);
    
      const ListWheelScrollViewX.useDelegate({
        Key? key,
        this.scrollDirection = Axis.vertical,
        this.controller,
        this.physics,
        this.diameterRatio = RenderListWheelViewport.defaultDiameterRatio,
        this.perspective = RenderListWheelViewport.defaultPerspective,
        this.offAxisFraction = 0.0,
        this.useMagnifier = false,
        this.magnification = 1.0,
        this.overAndUnderCenterOpacity = 1.0,
        required this.itemExtent,
        this.squeeze = 1.0,
        this.onSelectedItemChanged,
        this.renderChildrenOutsideViewport = false,
        this.clipBehavior = Clip.hardEdge,
        required this.childDelegate,
      })  : children = null,
            super(key: key);
    
      @override
      Widget build(BuildContext context) {
        final _childDelegate = children != null
            ? ListWheelChildListDelegate(
                children: children!.map((child) {
                return RotatedBox(
                  quarterTurns: scrollDirection == Axis.horizontal ? 1 : 0,
                  child: child,
                );
              }).toList())
            : ListWheelChildBuilderDelegate(
                builder: (context, index) {
                  return RotatedBox(
                    quarterTurns: scrollDirection == Axis.horizontal ? 1 : 0,
                    child: childDelegate!.build(context, index),
                  );
                },
              );
    
        return RotatedBox(
          quarterTurns: scrollDirection == Axis.horizontal ? 3 : 0,
          child: ListWheelScrollView.useDelegate(
            controller: controller,
            physics: FixedExtentScrollPhysics(),
            diameterRatio: diameterRatio,
            perspective: perspective,
            offAxisFraction: offAxisFraction,
            useMagnifier: useMagnifier,
            magnification: magnification,
            overAndUnderCenterOpacity: overAndUnderCenterOpacity,
            itemExtent: itemExtent,
            squeeze: squeeze,
            onSelectedItemChanged: onSelectedItemChanged,
            renderChildrenOutsideViewport: renderChildrenOutsideViewport,
            clipBehavior: clipBehavior,
            childDelegate: _childDelegate,
          ),
        );
      }
    }

Example

    ListWheelScrollViewX(
        scrollDirection: Axis.horizontal,
        itemExtent: 120,
        children:...
    ),

Reference
list_wheel_scroll_view_x

changes:
convert to null safety

@JoDeveloper
Copy link

JoDeveloper commented Mar 29, 2022

Guys I have add package at https://pub.dev/packages/list_wheel_scroll_view_x

If someone finds it useful; please give the package a like and upvote it on stackoverflow

Thx

cc @jameslester2004

null-safety version 👍🏼

https://pub.dev/packages/list_wheel_scroll_view_nls

@devberkay
Copy link

update please. FixedExtentScrollPhysics are still not available for horizontal ListViews.

@Peng-Qian
Copy link

come on team, 4 years already...😵

@Piinks Piinks added P3 Issues that are less important to the Flutter project and removed P2 Important issues not at the top of the work list labels Mar 21, 2023
@flutter-triage-bot flutter-triage-bot bot added team-framework Owned by Framework team triaged-framework Triaged by Framework team labels Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability f: gestures flutter/packages/flutter/gestures repository. f: scrolling Viewports, list views, slivers, etc. framework flutter/packages/flutter repository. See also f: labels. P3 Issues that are less important to the Flutter project team-framework Owned by Framework team triaged-framework Triaged by Framework team
Projects
None yet
Development

No branches or pull requests