From 2ae3e1fbda85c37da5117dbfc8c8e29942fc0449 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Mon, 23 Dec 2024 00:12:32 +0100 Subject: [PATCH] Add tooltips to several buttons --- lib/player_ui/app_bar.dart | 1 + lib/player_ui/body.dart | 5 +++++ lib/player_ui/bottom_bar.dart | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/lib/player_ui/app_bar.dart b/lib/player_ui/app_bar.dart index b8b4774..71891c0 100644 --- a/lib/player_ui/app_bar.dart +++ b/lib/player_ui/app_bar.dart @@ -17,6 +17,7 @@ class PlayerUIAppBar { actions: [ IconButton( icon: const Icon(Icons.copy_all), + tooltip: 'Copy playlist to clipboard', onPressed: () { final state = BlocProvider.of(context).state; if (state != null) { diff --git a/lib/player_ui/body.dart b/lib/player_ui/body.dart index efb3069..268bf04 100644 --- a/lib/player_ui/body.dart +++ b/lib/player_ui/body.dart @@ -84,6 +84,7 @@ class PlayerUIBody extends StatelessWidget { icon: playerState.isPlaying && item.current ? const Icon(Icons.pause) : const Icon(Icons.play_arrow), + tooltip: 'Play this track', onPressed: () { BlocProvider.of(context) .add(Command.playlistGoto(i)); @@ -96,11 +97,13 @@ class PlayerUIBody extends StatelessWidget { children: [ IconButton( icon: const Icon(Icons.copy), + tooltip: 'Copy uri to clipboard', onPressed: () => Clipboard.setData(ClipboardData(text: item.filename)), ), IconButton( icon: const Icon(Icons.delete_forever), + tooltip: 'Remove from playlist', color: Colors.redAccent, onPressed: () { BlocProvider.of(context) @@ -138,6 +141,7 @@ class PlayerUIBody extends StatelessWidget { SizedBox.fromSize(size: const Size(10, 0)), IconButton( icon: const Icon(Icons.send), + tooltip: 'Add link to playlist', onPressed: () { BlocProvider.of(context) .add(Command.load(_textController.text)); @@ -146,6 +150,7 @@ class PlayerUIBody extends StatelessWidget { ), IconButton( icon: const Icon(Icons.playlist_add), + tooltip: 'Add many links', onPressed: () async { final blocProvider = BlocProvider.of(context); final links = await _showAddManyLinksDialog(context); diff --git a/lib/player_ui/bottom_bar.dart b/lib/player_ui/bottom_bar.dart index 56d5164..413ea34 100644 --- a/lib/player_ui/bottom_bar.dart +++ b/lib/player_ui/bottom_bar.dart @@ -31,6 +31,7 @@ class PlayerUIBottomBar extends StatelessWidget { children: [ IconButton( icon: const Icon(Icons.skip_previous), + tooltip: 'Skip to previous track', onPressed: () { BlocProvider.of(context) .add(Command.playlistPrevious()); @@ -43,6 +44,7 @@ class PlayerUIBottomBar extends StatelessWidget { icon: (playerState.isPlaying) ? const Icon(Icons.pause) : const Icon(Icons.play_arrow), + tooltip: (playerState.isPlaying) ? 'Pause' : 'Play', onPressed: () { BlocProvider.of(context) .add(Command.togglePlayback()); @@ -52,6 +54,7 @@ class PlayerUIBottomBar extends StatelessWidget { ), IconButton( icon: const Icon(Icons.skip_next), + tooltip: 'Skip to next track', onPressed: () { BlocProvider.of(context) .add(Command.playlistNext()); @@ -141,6 +144,7 @@ class PlayerUIBottomBar extends StatelessWidget { buildProps: (p) => [p.subtitleTracks], builder: (context, playerState) => PopupMenuButton( icon: const Icon(Icons.subtitles), + tooltip: 'Select subtitle track', enabled: playerState.subtitleTracks.isNotEmpty, itemBuilder: (context) { return playerState.subtitleTracks @@ -160,6 +164,7 @@ class PlayerUIBottomBar extends StatelessWidget { buildProps: (p) => [p.isLooping], builder: (context, playerState) => IconButton( icon: const Icon(Icons.repeat), + tooltip: 'Toggle playlist looping', isSelected: playerState.isLooping, onPressed: () { BlocProvider.of(context) @@ -169,6 +174,7 @@ class PlayerUIBottomBar extends StatelessWidget { ), IconButton( icon: const Icon(Icons.shuffle), + tooltip: 'Shuffle playlist', onPressed: () { BlocProvider.of(context) .add(Command.shuffle()); @@ -176,6 +182,8 @@ class PlayerUIBottomBar extends StatelessWidget { ), IconButton( icon: const Icon(Icons.delete_forever), + tooltip: 'Clear playlist', + color: Colors.redAccent, onPressed: () { BlocProvider.of(context) .add(Command.playlistClear());