Closed indjec closed 3 years ago
this is my code:
Scaffold( appBar: AppBar( title: Text("Video player"), ), body: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ filePath != null ? Image(image: AssetImage(filePath)) : Text('No Floatting Button Click') ], ), floatingActionButton: Row( mainAxisAlignment: MainAxisAlignment.end, mainAxisSize: MainAxisSize.min, children: [ FloatingActionButton( tooltip: "Generate a file of thumbnail", onPressed: () async { final fileName = await VideoThumbnail.thumbnailFile( video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4", thumbnailPath: (await getTemporaryDirectory()).path, imageFormat: ImageFormat.PNG, maxHeight: 64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio quality: 75, ); setState(() { final file = File(fileName); filePath = file.path; }); }, child: Text('Click'), ), ], ));
this is my code:
Scaffold( appBar: AppBar( title: Text("Video player"), ), body: Column( mainAxisAlignment: MainAxisAlignment.start, mainAxisSize: MainAxisSize.min, children:[
filePath != null
? Image(image: AssetImage(filePath))
: Text('No Floatting Button Click')
],
),
floatingActionButton: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
FloatingActionButton(
tooltip: "Generate a file of thumbnail",
onPressed: () async {
final fileName = await VideoThumbnail.thumbnailFile(
video:
"https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4",
thumbnailPath: (await getTemporaryDirectory()).path,
imageFormat: ImageFormat.PNG,
maxHeight:
64, // specify the height of the thumbnail, let the width auto-scaled to keep the source aspect ratio
quality: 75,
);
setState(() {
final file = File(fileName);
filePath = file.path;
});
},
child: Text('Click'),
),
],
));