Hello FlutterFlow Community,
I do have some dart/flutter experience but this is my first custom widget with flutter flow and I'm a bit lost.
I need more control over the carousel, I'm trying to prevent the user from being able to swipe the carousel, as the user to meet certain conditions before the next carousel is shown, this is a very crucial element of my UI design so I have to get this right.
For this to happen I need to add NeverScrollableScrollPhysics()
to the carousel. Documentation: https://api.flutter.dev/flutter/widgets/NeverScrollableScrollPhysics-class.html
Here is the code I have so far...
class CustomCarousel extends StatefulWidget {
const CustomCarousel({
Key? key,
this.width,
this.height,
required this.itemCount,
required this.itemBuilder,
}) : super(key: key);
final double? width;
final double? height;
final int itemCount;
final Widget Function(BuildContext, int) itemBuilder;
@override
_CustomCarouselState createState() => _CustomCarouselState();
}
class _CustomCarouselState extends State<CustomCarousel> {
final PageController _controller = PageController();
@override
Widget build(BuildContext context) {
return SizedBox(
width: widget.width,
height: widget.height,
child: PageView.builder(
controller: _controller,
physics: NeverScrollableScrollPhysics(),
itemCount: widget.itemCount,
itemBuilder: widget.itemBuilder,
),
);
}
}
This code does not compile, here are my parameters
I suspect the itemBuilder is the issue but unfortunately I'm not very experienced with extending flutter flow with custom code as of yet.
Please note FlutterFlow added Future<dynamic> Function()
upon save, I think this is the issue as my code isn't asynchronous, but then again I don't see the need for a future here. So yeah, that's me lost and confused as how to proceed. ๐
Thank You Flutter Flow peoples ๐