Widget build(BuildContext context) {
return CustomCard(
onTap: null,
borderRadius: BorderRadius.circular(10.0),
child: OpenContainer(
transitionType: ContainerTransitionType.fadeThrough,
openBuilder: (BuildContext context, VoidCallback _) {
return ViewImage(post: post);
},
closedElevation: 0.0,
closedShape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(10.0),
),
),
onClosed: (v) {},
closedColor: Theme.of(context).cardColor,
closedBuilder: (BuildContext context, VoidCallback openContainer) {
return Stack(
children: [
Column(
children: [
ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0),
topRight: Radius.circular(10.0),
),
child:
**final** fileName = await VideoThumbnail.thumbnailFile({
video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4",
thumbnailPath: (await getTemporaryDirectory()).path,
imageFormat: ImageFormat.WEBP,
maxHeight: 64,
quality: 75,
});
),
This is my code and the code before, I've got the error at the word final. So the console gives me an error. And says that it expected an indentifier and a ')' around the word final, but I don't know were exactly I have to place it. Is there anyone who can help me with this problem? I don't know if the error is being caused by the earlier code.
CodePudding user response:
I believe I can see a couple of issues here:
- You're missing the braces
{
and}
for your properties. - You should remove trailing commas
,
from your property list, otherwise it may cause issues in some browsers.
Try the following instead:
VideoThumbnail.thumbnailFile({
video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4",
thumbnailPath: (await getTemporaryDirectory()).path,
imageFormat: ImageFormat.WEBP,
maxHeight: 64,
quality: 75
});
CodePudding user response:
You declare a var in a child property; this is your problem.
Your code :
final fileName = await VideoThumbnail.thumbnailFile({
video: "https://flutter.github.io/assets-for-api-docs/assets/videos/butterfly.mp4",
thumbnailPath: (await getTemporaryDirectory()).path,
imageFormat: ImageFormat.WEBP,
maxHeight: 64,
quality: 75,
});
should be declared in the right place, so for example in a setState
function.