From b988fcfcdd1f54b2219204306d84f783c0435a14 Mon Sep 17 00:00:00 2001 From: estevez-dev Date: Fri, 20 Sep 2019 16:42:50 +0300 Subject: [PATCH] Resolves #461 Hide media switch buttons if nothing playing --- .../widgets/media_player_widgets.dart | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/entities/media_player/widgets/media_player_widgets.dart b/lib/entities/media_player/widgets/media_player_widgets.dart index 529a61f..988093e 100644 --- a/lib/entities/media_player/widgets/media_player_widgets.dart +++ b/lib/entities/media_player/widgets/media_player_widgets.dart @@ -403,25 +403,26 @@ class _MediaPlayerControlsState extends State { ) ); } - children.add( - ButtonBar( - children: [ - RaisedButton( - child: Text("Duplicate to"), - color: Colors.blue, - textColor: Colors.white, - onPressed: () => _duplicateTo(entity), - ), - RaisedButton( - child: Text("Switch to"), - color: Colors.blue, - textColor: Colors.white, - onPressed: () => _switchTo(entity), + if (entity.state == EntityState.playing || entity.state == EntityState.paused) { + children.add( + ButtonBar( + children: [ + RaisedButton( + child: Text("Duplicate to"), + color: Colors.blue, + textColor: Colors.white, + onPressed: () => _duplicateTo(entity), + ), + RaisedButton( + child: Text("Switch to"), + color: Colors.blue, + textColor: Colors.white, + onPressed: () => _switchTo(entity), + ) + ], ) - ], - ) - ); - + ); + } } return Column( children: children,