Ensure that the controller is disposed only if initialized
This commit is contained in:
parent
36467b6673
commit
4a90dde9a3
1 changed files with 7 additions and 1 deletions
|
@ -40,7 +40,9 @@ class _VideoWidgetState extends State<VideoWidget> {
|
|||
@override
|
||||
void dispose() {
|
||||
_videoPlayerController.dispose();
|
||||
_chewieController.dispose();
|
||||
if (_chewieController != null) {
|
||||
_chewieController.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -66,6 +68,10 @@ class _VideoWidgetState extends State<VideoWidget> {
|
|||
Widget _getLoadingWidget() {
|
||||
return Stack(children: [
|
||||
_getThumbnail(),
|
||||
Container(
|
||||
color: Colors.black12,
|
||||
constraints: BoxConstraints.expand(),
|
||||
),
|
||||
loadWidget,
|
||||
]);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue