how i can make a slide show for multi images with duration I want to enter multiple images to the code and export a video I only found this package ffmpeg_kit_flutter and used it as follows But I'm having a problem 1- In merging several photos 2- Put a duration between them
the images with path like this
/storage/emulated/0/Download/01.jpg
/storage/emulated/0/Download/02.jpg
/storage/emulated/0/Download/03.jpg
/storage/emulated/0/Download/04.jpg
my code is
Future<void> VideoMerger() async {
loading = true;
notifyListeners();
if(await Permission.storage.request().isGranted){
String commandToExecute ='-r 15 -f mp3 -i /storage/emulated/0/Download/khh.mp3 -f image2 -i /storage/emulated/0/Download/01.jpg -y /storage/emulated/0/Download/output.mp4';
await FFmpegKit.executeAsync(commandToExecute).then((rc) {
loading = false;
notifyListeners();
print('FFmpeg process exited with rc: $rc');
});
}else if (await Permission.storage.isPermanentlyDenied){
loading = false;
notifyListeners();
openAppSettings();
}
}
CodePudding user response:
There is a package carousel_slider 4.1.1
.
Add carousel_slider: ^4.1.1
to your pubspec.yaml dependencies. And import it:
import 'package:carousel_slider/carousel_slider.dart';
To use Simply create a CarouselSlider widget, and pass the required params:
CarouselSlider(
options: CarouselOptions(height: 400.0),
items: [1,2,3,4,5].map((i) {
return Builder(
builder: (BuildContext context) {
return Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 5.0),
decoration: BoxDecoration(
color: Colors.amber
),
child: Text('text $i', style: TextStyle(fontSize: 16.0),)
);
},
);
}).toList(),
)
Params:
CarouselSlider(
items: items,
options: CarouselOptions(
height: 400,
aspectRatio: 16/9,
viewportFraction: 0.8,
initialPage: 0,
enableInfiniteScroll: true,
reverse: false,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),
autoPlayCurve: Curves.fastOutSlowIn,
enlargeCenterPage: true,
onPageChanged: callbackFunction,
scrollDirection: Axis.horizontal,
)
)
More details here.
CodePudding user response:
use carousel_clider package
Try this:
var items = ["image_1", "image_2", "image_3"];
CarouselSlider(
items: items,
options: CarouselOptions(
height: 400,
aspectRatio: 16/9,
viewportFraction: 0.8,
initialPage: 0,
enableInfiniteScroll: true,
reverse: false,
autoPlay: true,
autoPlayInterval: Duration(seconds: 3),
autoPlayAnimationDuration: Duration(milliseconds: 800),
autoPlayCurve: Curves.fastOutSlowIn,
enlargeCenterPage: true,
onPageChanged: callbackFunction,
scrollDirection: Axis.horizontal,
)
)