Updated below,
Now I used this methods, it was showed flatingactionbutton on all data, how to only show video data and could I click sizebox then it was playing video not click floatactionbutton and how to hidden floatactionbutton when the user click play video?
SizedBox(
height: MediaQuery.of(context).size.height * 0.35,
width: double.infinity,
child: widget.snap['imageType'] == 'image'
? Image.network(
widget.snap['postimage'],
//widget.snap['postimage'],
fit: BoxFit.cover,
)
// : VideoPlayer(_controller),
: _controller.value.isInitialized
? AspectRatio(
aspectRatio: _controller.value.aspectRatio,
child: VideoPlayer(_controller),
)
: Container(),
),
FloatingActionButton(
backgroundColor: Colors.white38,
onPressed: () {
setState(() {
_controller.value.isPlaying
? _controller.pause()
: _controller.play();
});
},
child: Icon(
_controller.value.isPlaying
? Icons.pause
: Icons.play_arrow,
),
),
How can use image & video on same frame in flutter?
I tried to used this methods, but I got the errors.
code
SizedBox(
height: MediaQuery.of(context).size.height * 0.35,
width: double.infinity,
child: widget.snap['imageType'] == 'image'
? Image.network(
widget.snap['postimage'],
//widget.snap['postimage'],
fit: BoxFit.cover,
)
// : Image.network(widget.snap['profile_image']),
: VideoPlayerController.network(widget.snap['postimage']),
),
And this is error


