flutter_carousel_media_slider 0.0.2 flutter_carousel_media_slider: ^0.0.2 copied to clipboard
Carousel slider which supports for both video and image, which is highly useful for tv applications at commercial places to promote their business in both image (.png / .jpg) and video formats (.mp4)
Required fields: #
- MediaName
- MediaUrl
- MediaType
- carouselImageSource
Step 1: Create a list of CarouselMedia #
List<CarouselMedia> media = [
CarouselMedia(
mediaName: 'Image 1',
mediaUrl:
'https://images.pexels.com/photos/1172253/pexels-photo-1172253.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500',
mediaType: CarouselMediaType.image,
carouselImageSource: CarouselImageSource.network,
),
CarouselMedia(
mediaName: 'Image 2',
mediaUrl:
'https://media.istockphoto.com/photos/mountain-landscape-picture-id517188688?k=20&m=517188688&s=612x612&w=0&h=i38qBm2P-6V4vZVEaMy_TaTEaoCMkYhvLCysE7yJQ5Q=',
mediaType: CarouselMediaType.image,
carouselImageSource: CarouselImageSource.network,
),
CarouselMedia(
mediaName: 'Image 5',
mediaUrl:
'https://sample-videos.com/video123/mp4/720/big_buck_bunny_720p_1mb.mp4',
mediaType: CarouselMediaType.video,
carouselImageSource: CarouselImageSource.network,
),
CarouselMedia(
mediaName: 'Image 3',
mediaUrl:
'https://st2.depositphotos.com/1006472/5665/i/600/depositphotos_56658541-stock-photo-faceless-hooded-anonymous-computer-hacker.jpg',
mediaType: CarouselMediaType.image,
carouselImageSource: CarouselImageSource.network,
),
CarouselMedia(
mediaName: 'Image 4',
mediaUrl:
'https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4#7',
mediaType: CarouselMediaType.video,
carouselImageSource: CarouselImageSource.network,
),
];
Step 2: add the media list to the carousel Media slider #
FlutterCarouselMediaSlider(
carouselMediaList: media,
onPageChanged: (index) {
debugPrint('Page Changed: $index');
},
),