Reputation: 337
I have list of Images in Asset type and I have already added items into it.
How can I show the Asset type image list in Carousel in flutter
List<Asset> images = List<Asset>();
SizedBox(
height: 150.0,
width: 300.0,
child: Carousel(
images: images,
),
)
Upvotes: 0
Views: 2496
Reputation: 909
List<Asset> images = List<Asset>();
SizedBox(
height: 500.0,
width: 300.0,
child: CarouselSlider(
items: images.map((image) => AssetThumb(
asset: image,
width: 300,
height: 300,
),
)).toList(
),)
Upvotes: 1
Reputation: 4923
You can use this Flutter Package: https://pub.dev/packages/carousel_slider
Follow the instructions for Installation.
Import the Package
import 'package:carousel_slider/carousel_slider.dart';
You can assign your List of Widgets (in your case Image.asset()
or AssetImage
)
CarouselSlider(
options: CarouselOptions(height: 400.0),
items: [ YOUR LIST HERE ],
)
Additional Options Reference: https://pub.dev/packages/carousel_slider/example
Upvotes: 0