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
Comments
@zoechi @goderbauer Any updates or any code snippet available to deal with this issue. Thx |
Any news? Have the same issue, haven't found any good solutions so far |
@ReginFell @goderbauer @zoechi Heres my workaround. Please upvote. |
Any Updates yet on this issue |
Any update? |
update ???? |
This package works great https://pub.dev/packages/carousel_slider |
Would really appreciate this feature too! |
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 |
@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.
Refer both constructors here https://api.flutter.dev/flutter/widgets/ListWheelScrollView-class.html I will actually publish package actually with both contructors. |
Hey man, sorry you're absolutely right. I just got it going. Neat fix! Thanks. |
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 |
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
But I do still support this feature Request of having the direction api out of the box. |
Being able to change the scroll direction of a ListWheelScrollView is one really needed feature. |
Any update? |
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 changes: |
null-safety version 👍🏼 |
update please. FixedExtentScrollPhysics are still not available for horizontal ListViews. |
come on team, 4 years already...😵 |
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 propertyAxis scrollDirection
which is controllingListView
orientation (vertical or horizontal). I would be happy to have same property onListWheelScrollView
Steps to Reproduce
ListWheelScrollView
.Axis scrollDirection
is missingTransform.rotate
Logs
The text was updated successfully, but these errors were encountered: