@@ -60,17 +60,7 @@ class ChatMasterSidePanel extends StatelessWidget with WatchItMixin {
6060 context: context,
6161 builder: (context) => const ChatSettingsDialog (),
6262 ),
63- trailing: IconButton (
64- tooltip: l10n.playMedia,
65- onPressed: () {
66- showDialog (
67- context: context,
68- builder: (context) => const PlayerFullView (),
69- );
70- di <PlayerManager >().updateState (fullMode: true );
71- },
72- icon: const Icon (YaruIcons .media_play),
73- ),
63+ trailing: const _OpenEmptyPlayerButton (),
7464 ),
7565 ],
7666 ),
@@ -80,3 +70,31 @@ class ChatMasterSidePanel extends StatelessWidget with WatchItMixin {
8070 );
8171 }
8272}
73+
74+ class _OpenEmptyPlayerButton extends StatelessWidget with WatchItMixin {
75+ const _OpenEmptyPlayerButton ();
76+
77+ @override
78+ Widget build (BuildContext context) {
79+ final currentMedia = watchStream (
80+ (PlayerManager p) => p.currentMediaStream,
81+ initialValue: di <PlayerManager >().currentMedia,
82+ ).data;
83+
84+ if (currentMedia != null ) {
85+ return const SizedBox .shrink ();
86+ }
87+
88+ return IconButton (
89+ tooltip: context.l10n.playMedia,
90+ onPressed: () {
91+ showDialog (
92+ context: context,
93+ builder: (context) => const PlayerFullView (),
94+ );
95+ di <PlayerManager >().updateState (fullMode: true );
96+ },
97+ icon: const Icon (YaruIcons .media_play),
98+ );
99+ }
100+ }
0 commit comments