Skip to content

Commit

Permalink
add missing accessibility labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Oct 16, 2024
1 parent c09c010 commit d58083e
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ unlinked_spec.ds

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
macos/Flutter/ephemeral/flutter_export_environment.sh
macos/Flutter/ephemeral/Flutter-Generated.xcconfig

# Coverage
coverage/
Expand All @@ -95,4 +97,9 @@ app.*.symbols
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
!/dev/ci/**/Gemfile.lock

# Not-yet supported platforms
windows/
linux/

1 change: 1 addition & 0 deletions lib/components/AlbumScreen/delete_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class _DeleteButtonState extends State<DeleteButton> {
bool? isOffline = box.get("FinampSettings")?.isOffline;

return IconButton(
tooltip: AppLocalizations.of(context)!.deleteFromDevice,
icon: const Icon(Icons.delete),
// If offline, we don't allow the user to delete items.
// If we did, we'd have to implement listeners for MusicScreenTabView so that the user can't delete a parent, go back, and select the same parent.
Expand Down
4 changes: 4 additions & 0 deletions lib/components/AlbumScreen/sync_album_or_playlist_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:finamp/services/sync_helper.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:logging/logging.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class SyncAlbumOrPlaylistButton extends StatefulWidget {
const SyncAlbumOrPlaylistButton({
Expand Down Expand Up @@ -39,6 +40,9 @@ class _SyncAlbumOrPlaylistButtonState
Widget build(BuildContext context) {
isAlbumDownloaded = _downloadHelper.isAlbumDownloaded(widget.parent.id);
return IconButton(
tooltip: isAlbumDownloaded
? AppLocalizations.of(context)!.sync
: AppLocalizations.of(context)!.download,
onPressed: () => syncAlbumOrPlaylist(), icon:
isAlbumDownloaded ?
const Icon(Icons.sync) :
Expand Down
2 changes: 2 additions & 0 deletions lib/components/ArtistScreen/artist_download_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class _ArtistDownloadButtonState extends State<ArtistDownloadButton> {
deleteAlbums = undownloadedAlbums.isEmpty;

return IconButton(
tooltip: AppLocalizations.of(context)!
.downloadArtist(widget.artist.name ?? "Unknown Artist"),
icon: deleteAlbums
? const Icon(Icons.delete)
: const Icon(Icons.download),
Expand Down
7 changes: 6 additions & 1 deletion lib/components/ArtistScreen/artist_play_button.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


import '../../models/jellyfin_models.dart';
Expand Down Expand Up @@ -66,6 +67,8 @@ class _ArtistPlayButtonState extends State<ArtistPlayButton> {
});

return IconButton(
tooltip: AppLocalizations.of(context)!
.playArtist(widget.artist.name ?? "Unknown Artist"),
onPressed: () async {
await _audioServiceHelper
.replaceQueueWithItem(itemList: sortedSongs);
Expand All @@ -87,6 +90,8 @@ class _ArtistPlayButtonState extends State<ArtistPlayButton> {
final List<BaseItemDto> items = snapshot.data!;

return IconButton(
tooltip: AppLocalizations.of(context)!
.playArtist(widget.artist.name ?? "Unknown Artist"),
onPressed: () async {
await _audioServiceHelper
.replaceQueueWithItem(itemList: items);
Expand All @@ -102,4 +107,4 @@ class _ArtistPlayButtonState extends State<ArtistPlayButton> {
},
);
}
}
}
5 changes: 5 additions & 0 deletions lib/components/ArtistScreen/artist_shuffle_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


import '../../models/jellyfin_models.dart';
Expand Down Expand Up @@ -55,6 +56,8 @@ class _ArtistShuffleButtonState extends State<ArtistShuffleButton> {
}

return IconButton(
tooltip: AppLocalizations.of(context)!
.shuffleArtist(widget.artist.name ?? "Unknown Artist"),
onPressed: () async {
await _audioServiceHelper
.replaceQueueWithItem(itemList: artistsSongs, shuffle: true);
Expand All @@ -76,6 +79,8 @@ class _ArtistShuffleButtonState extends State<ArtistShuffleButton> {
final List<BaseItemDto> items = snapshot.data!;

return IconButton(
tooltip: AppLocalizations.of(context)!
.shuffleArtist(widget.artist.name ?? "Unknown Artist"),
onPressed: () async {
await _audioServiceHelper
.replaceQueueWithItem(itemList: items, shuffle: true, initialIndex: Random().nextInt(items.length));
Expand Down
14 changes: 13 additions & 1 deletion lib/components/PlayerScreen/player_buttons.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:audio_service/audio_service.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

import '../../services/music_player_background_task.dart';

Expand All @@ -20,6 +21,9 @@ class PlayerButtons extends StatelessWidget {
textDirection: TextDirection.ltr,
children: [
IconButton(
tooltip: playbackState?.shuffleMode == AudioServiceShuffleMode.all
? AppLocalizations.of(context)!.playbackOrderShuffledTooltip
: AppLocalizations.of(context)!.playbackOrderLinearTooltip,
icon: _getShufflingIcon(
playbackState == null
? AudioServiceShuffleMode.none
Expand All @@ -41,6 +45,7 @@ class PlayerButtons extends StatelessWidget {
iconSize: 20,
),
IconButton(
tooltip: AppLocalizations.of(context)!.skipToPrevious,
icon: const Icon(Icons.skip_previous),
onPressed: playbackState != null
? () async => await audioHandler.skipToPrevious()
Expand All @@ -51,6 +56,7 @@ class PlayerButtons extends StatelessWidget {
height: 56,
width: 56,
child: FloatingActionButton(
tooltip: AppLocalizations.of(context)!.togglePlayback,
// We set a heroTag because otherwise the play button on AlbumScreenContent will do hero widget stuff
heroTag: "PlayerScreenFAB",
backgroundColor: Theme.of(context).colorScheme.primary,
Expand All @@ -75,12 +81,18 @@ class PlayerButtons extends StatelessWidget {
),
),
IconButton(
tooltip: AppLocalizations.of(context)!.skipToNext,
icon: const Icon(Icons.skip_next),
onPressed: playbackState != null
? () async => audioHandler.skipToNext()
: null,
iconSize: 36),
IconButton(
tooltip: playbackState?.repeatMode == AudioServiceRepeatMode.all
? AppLocalizations.of(context)!.loopModeAllTooltip
: playbackState?.repeatMode == AudioServiceRepeatMode.one
? AppLocalizations.of(context)!.loopModeOneTooltip
: AppLocalizations.of(context)!.loopModeNoneTooltip,
icon: _getRepeatingIcon(
playbackState == null
? AudioServiceRepeatMode.none
Expand Down Expand Up @@ -131,4 +143,4 @@ class PlayerButtons extends StatelessWidget {
return const Icon(Icons.shuffle);
}
}
}
}
56 changes: 54 additions & 2 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -531,5 +531,57 @@
"@swipeInsertQueueNext": {},
"swipeInsertQueueNextSubtitle": "Enable to insert a song as next item in queue when swiped in song list instead of appending it to the end.",
"@swipeInsertQueueNextSubtitle": {},
"redesignBeta": "Redesign Beta"
}
"redesignBeta": "Try the Beta",
"@redesignBeta": {},
"playbackOrderShuffledTooltip": "Shuffling. Tap to toggle.",
"@playbackOrderShuffledTooltip": {},
"playbackOrderLinearTooltip": "Playing in order. Tap to toggle.",
"@playbackOrderLinearTooltip": {},
"loopModeAllTooltip": "Looping all. Tap to toggle.",
"@loopModeAllTooltip": {},
"loopModeOneTooltip": "Looping one. Tap to toggle.",
"@loopModeOneTooltip": {},
"loopModeNoneTooltip": "Not looping. Tap to toggle.",
"@loopModeNoneTooltip": {},
"skipToPrevious": "Skip to Previous Song",
"@skipToPrevious": {},
"skipToNext": "Skip to Next Song",
"@skipToNext": {},
"togglePlayback": "Toggle Playback",
"@togglePlayback": {},
"playArtist": "Play all albums by {artist}",
"@playArtist": {
"placeholders": {
"artist": {
"type": "String",
"example": "The Beatles"
}
}
},
"shuffleArtist": "Shuffle all albums by {artist}",
"@shuffleArtist": {
"placeholders": {
"artist": {
"type": "String",
"example": "The Beatles"
}
}
},
"downloadArtist": "Download all albums by {artist}",
"@downloadArtist": {
"placeholders": {
"artist": {
"type": "String",
"example": "The Beatles"
}
}
},
"deleteFromDevice": "Delete from Device",
"@deleteFromDevice": {},
"download": "Download",
"@download": {},
"sync": "Synchronize with Server",
"@sync": {},
"about": "About Finamp",
"@about": {}
}
1 change: 1 addition & 0 deletions lib/screens/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SettingsScreen extends StatelessWidget {
title: Text(AppLocalizations.of(context)!.settings),
actions: [
IconButton(
tooltip: AppLocalizations.of(context)!.about,
icon: const Icon(Icons.info),
onPressed: () async {
final applicationLegalese =
Expand Down

0 comments on commit d58083e

Please sign in to comment.