From 87d0147ad213a33899ac774655e3e6ac926a2b1c Mon Sep 17 00:00:00 2001 From: Frederik Feichtmeier Date: Fri, 30 Aug 2024 00:44:24 +0200 Subject: [PATCH] feat: improve android styling and sizes (#902) * feat: improve android styling and sizes * fix: use primary color less * fix: update macos/windows/android theme --- lib/app/view/app.dart | 2 +- lib/app/view/scaffold.dart | 6 +- lib/common/view/audio_card.dart | 7 +- lib/common/view/audio_card_bottom.dart | 8 +- lib/common/view/audio_tile.dart | 22 ++++- lib/common/view/avatar_play_button.dart | 4 +- lib/common/view/cover_background.dart | 11 +-- lib/common/view/explore_online_popup.dart | 1 + lib/common/view/header_bar.dart | 11 ++- lib/common/view/sliver_audio_tile_list.dart | 3 + lib/common/view/theme.dart | 52 +++++++++-- lib/l10n/app_de.arb | 2 + lib/l10n/app_en.arb | 2 + lib/local_audio/view/album_page.dart | 43 ++++----- lib/local_audio/view/album_view.dart | 3 +- lib/local_audio/view/artist_page.dart | 39 ++++---- lib/player/view/bottom_player.dart | 21 +++-- lib/player/view/full_height_player.dart | 44 +++++----- lib/player/view/player_main_controls.dart | 7 +- lib/player/view/player_view.dart | 3 +- lib/player/view/queue_button.dart | 44 ++++++---- lib/player/view/repeat_button.dart | 13 +-- lib/player/view/shuffle_button.dart | 13 ++- lib/playlists/view/playlist_page.dart | 78 ++++++++-------- lib/podcasts/view/download_button.dart | 1 + lib/podcasts/view/podcast_audio_tile.dart | 82 +++++++++-------- lib/podcasts/view/podcast_page.dart | 33 +++---- lib/podcasts/view/podcast_sub_button.dart | 6 +- ...ess.dart => podcast_tile_play_button.dart} | 59 +++++++------ ...ogress.dart => podcast_tile_progress.dart} | 27 +++--- .../view/podcasts_collection_body.dart | 4 +- lib/radio/view/radio_history_tile.dart | 14 ++- lib/radio/view/radio_page_star_button.dart | 13 +-- lib/radio/view/station_card.dart | 6 +- lib/radio/view/station_page.dart | 23 +++-- .../view/sliver_podcast_search_results.dart | 5 +- needs_translation.json | 40 +++++++++ pubspec.lock | 88 +++++++++---------- pubspec.yaml | 4 +- 39 files changed, 487 insertions(+), 357 deletions(-) rename lib/podcasts/view/{avatar_with_progress.dart => podcast_tile_play_button.dart} (54%) rename lib/podcasts/view/{audio_progress.dart => podcast_tile_progress.dart} (63%) diff --git a/lib/app/view/app.dart b/lib/app/view/app.dart index d6d377312..be2cb41aa 100644 --- a/lib/app/view/app.dart +++ b/lib/app/view/app.dart @@ -1,7 +1,7 @@ import 'dart:ui'; import 'package:flutter/material.dart'; -import 'package:phoenix_theme/phoenix_theme.dart' hide ColorX, isMobile; +import 'package:phoenix_theme/phoenix_theme.dart' hide ColorX; import 'package:system_theme/system_theme.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; diff --git a/lib/app/view/scaffold.dart b/lib/app/view/scaffold.dart index e6920252f..aea90fdf0 100644 --- a/lib/app/view/scaffold.dart +++ b/lib/app/view/scaffold.dart @@ -82,7 +82,9 @@ class MobileNavigationBar extends StatelessWidget with WatchItMixin { final libraryModel = di(); return NavigationBar( - height: 60, + backgroundColor: context.t.cardColor, + height: 45, + indicatorColor: Colors.transparent, selectedIndex: switch (selectedPageId) { kSearchPageId => 0, kLocalAudioPageId => 1, @@ -106,7 +108,7 @@ class MobileNavigationBar extends StatelessWidget with WatchItMixin { NavigationDestination( icon: Icon(Iconz().localAudio), selectedIcon: Icon(Iconz().localAudioFilled), - label: context.l10n.localAudio, + label: context.l10n.local, ), NavigationDestination( icon: Icon(Iconz().radio), diff --git a/lib/common/view/audio_card.dart b/lib/common/view/audio_card.dart index cc3cd0f7b..eb44bea65 100644 --- a/lib/common/view/audio_card.dart +++ b/lib/common/view/audio_card.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:shimmer/shimmer.dart'; import 'package:yaru/yaru.dart'; -import '../../constants.dart'; import '../../extensions/build_context_x.dart'; import '../../extensions/theme_data_x.dart'; import 'icons.dart'; @@ -75,7 +74,7 @@ class _AudioCardState extends State { bottom: 10, right: 10, child: CircleAvatar( - radius: avatarIconSize, + radius: avatarIconRadius, backgroundColor: theme.colorScheme.primary, child: IconButton( onPressed: widget.onPlay, @@ -132,8 +131,8 @@ class _AudioCard extends StatelessWidget { final light = theme.isLight; return SizedBox( - height: height ?? kAudioCardDimension - (isMobile ? 10 : 0), - width: width ?? kAudioCardDimension, + height: height ?? audioCardDimension, + width: width ?? audioCardDimension, child: InkWell( onTap: onTap, onHover: onHover, diff --git a/lib/common/view/audio_card_bottom.dart b/lib/common/view/audio_card_bottom.dart index 5f1e5b013..fcbe94ddc 100644 --- a/lib/common/view/audio_card_bottom.dart +++ b/lib/common/view/audio_card_bottom.dart @@ -2,9 +2,9 @@ import 'package:flutter/material.dart'; import 'package:shimmer/shimmer.dart'; import 'package:yaru/yaru.dart'; -import '../../constants.dart'; import '../../extensions/build_context_x.dart'; import '../../extensions/theme_data_x.dart'; +import 'theme.dart'; class AudioCardBottom extends StatelessWidget { const AudioCardBottom({ @@ -24,11 +24,11 @@ class AudioCardBottom extends StatelessWidget { final light = theme.isLight; return SizedBox( - width: kAudioCardDimension, + width: audioCardDimension, child: Tooltip( message: text ?? '', child: Container( - width: kAudioCardDimension, + width: audioCardDimension, margin: const EdgeInsets.all(1), padding: const EdgeInsets.symmetric( vertical: 5, @@ -39,7 +39,7 @@ class AudioCardBottom extends StatelessWidget { borderRadius: BorderRadius.circular(5), child: SizedBox( height: 15, - width: kAudioCardDimension - 20, + width: audioCardDimension - 20, child: Shimmer.fromColors( baseColor: theme.cardColor, highlightColor: light diff --git a/lib/common/view/audio_tile.dart b/lib/common/view/audio_tile.dart index b090e0a7f..6bc87c0a0 100644 --- a/lib/common/view/audio_tile.dart +++ b/lib/common/view/audio_tile.dart @@ -30,6 +30,7 @@ class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin { this.startPlaylist, required this.audioPageType, required this.showLeading, + this.selectedColor, }); final String pageId; @@ -45,6 +46,7 @@ class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin { final LibraryModel libraryModel; final void Function(Audio audio) insertIntoQueue; final bool showLeading; + final Color? selectedColor; @override State createState() => _AudioTileState(); @@ -57,6 +59,7 @@ class _AudioTileState extends State { Widget build(BuildContext context) { final theme = context.t; final liked = watchPropertyValue((LibraryModel m) => m.liked(widget.audio)); + final selectedColor = widget.selectedColor ?? theme.contrastyPrimary; final subTitle = switch (widget.audioPageType) { AudioPageType.artist => widget.audio.album ?? context.l10n.unknown, _ => widget.audio.artist ?? context.l10n.unknown, @@ -83,7 +86,7 @@ class _AudioTileState extends State { leading: leading, selected: widget.selected, selectedColor: widget.isPlayerPlaying - ? theme.contrastyPrimary + ? selectedColor : theme.colorScheme.onSurface, selectedTileColor: theme.colorScheme.onSurface.withOpacity(0.05), contentPadding: kModernAudioTilePadding, @@ -122,6 +125,7 @@ class _AudioTileState extends State { pageId: widget.pageId, audioPageType: widget.audioPageType, insertIntoQueue: widget.insertIntoQueue, + selectedColor: selectedColor, ), ), ); @@ -139,6 +143,7 @@ class _AudioTileTrail extends StatelessWidget with WatchItMixin { required this.insertIntoQueue, required this.hovered, required this.liked, + required this.selectedColor, }); final Audio audio; @@ -150,6 +155,7 @@ class _AudioTileTrail extends StatelessWidget with WatchItMixin { final void Function(Audio audio) insertIntoQueue; final bool hovered; final bool liked; + final Color selectedColor; @override Widget build(BuildContext context) { @@ -173,8 +179,14 @@ class _AudioTileTrail extends StatelessWidget with WatchItMixin { Opacity( opacity: hovered || selected || liked ? 1 : 0, child: switch (audio.audioType) { - AudioType.radio => RadioLikeIcon(audio: audio), - AudioType.local => LikeIcon(audio: audio), + AudioType.radio => RadioLikeIcon( + audio: audio, + color: selected && isPlayerPlaying ? selectedColor : null, + ), + AudioType.local => LikeIcon( + audio: audio, + color: selected && isPlayerPlaying ? selectedColor : null, + ), _ => SizedBox.square( dimension: context.t.buttonTheme.height, ), @@ -190,7 +202,9 @@ class _AudioTileTrail extends StatelessWidget with WatchItMixin { alignment: Alignment.centerRight, child: Text( Duration(milliseconds: audio.durationMs!.toInt()).formattedTime, - style: context.t.textTheme.labelMedium, + style: context.t.textTheme.labelMedium?.copyWith( + color: selected && isPlayerPlaying ? selectedColor : null, + ), ), ), ), diff --git a/lib/common/view/avatar_play_button.dart b/lib/common/view/avatar_play_button.dart index 36e57c33d..91c2994cc 100644 --- a/lib/common/view/avatar_play_button.dart +++ b/lib/common/view/avatar_play_button.dart @@ -30,9 +30,9 @@ class AvatarPlayButton extends StatelessWidget with WatchItMixin { isPlayerPlaying && pageIsQueue ? Iconz().pause : Iconz().playFilled; return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), + padding: bigPlayButtonPadding, child: CircleAvatar( - radius: bigPlayButtonSize, + radius: bigPlayButtonRadius, backgroundColor: theme.colorScheme.inverseSurface, child: IconButton( tooltip: context.l10n.playAll, diff --git a/lib/common/view/cover_background.dart b/lib/common/view/cover_background.dart index 27771de49..24fc0b1d0 100644 --- a/lib/common/view/cover_background.dart +++ b/lib/common/view/cover_background.dart @@ -1,20 +1,21 @@ -import '../../constants.dart'; import 'package:flutter/material.dart'; +import 'theme.dart'; + class CoverBackground extends StatelessWidget { const CoverBackground({ super.key, - this.dimension = kAudioCardDimension, + this.dimension, }); - final double dimension; + final double? dimension; @override Widget build(BuildContext context) { return Image.asset( 'assets/images/media-optical.png', - height: dimension, - width: dimension, + height: dimension ?? audioCardDimension, + width: dimension ?? audioCardDimension, ); } } diff --git a/lib/common/view/explore_online_popup.dart b/lib/common/view/explore_online_popup.dart index cd0434b9a..0d55c1ca9 100644 --- a/lib/common/view/explore_online_popup.dart +++ b/lib/common/view/explore_online_popup.dart @@ -20,6 +20,7 @@ class ExploreOnlinePopup extends StatelessWidget with WatchItMixin { return PopupMenuButton( enabled: isOnline, tooltip: context.l10n.searchOnline, + padding: EdgeInsets.zero, itemBuilder: (c) => [ PopupMenuItem( padding: const EdgeInsets.only(left: 5), diff --git a/lib/common/view/header_bar.dart b/lib/common/view/header_bar.dart index 225b5cb42..29bc9c9a5 100644 --- a/lib/common/view/header_bar.dart +++ b/lib/common/view/header_bar.dart @@ -1,7 +1,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:phoenix_theme/phoenix_theme.dart' hide isMobile; +import 'package:phoenix_theme/phoenix_theme.dart'; import 'package:watch_it/watch_it.dart'; import 'package:yaru/yaru.dart'; @@ -48,7 +48,8 @@ class HeaderBar extends StatelessWidget Widget? leading; - if (includeSidebarButton && + if (!isMobile && + includeSidebarButton && !context.showMasterPanel && masterScaffoldKey.currentState?.isDrawerOpen == false) { leading = const SidebarButton(); @@ -56,7 +57,11 @@ class HeaderBar extends StatelessWidget if (includeBackButton && canPop) { leading = const NavBackButton(); } else { - leading = null; + leading = isMobile + ? const SizedBox( + width: 60, + ) + : null; } } diff --git a/lib/common/view/sliver_audio_tile_list.dart b/lib/common/view/sliver_audio_tile_list.dart index 43dcdde4f..2d7648285 100644 --- a/lib/common/view/sliver_audio_tile_list.dart +++ b/lib/common/view/sliver_audio_tile_list.dart @@ -16,6 +16,7 @@ class SliverAudioTileList extends StatelessWidget with WatchItMixin { this.padding, this.onSubTitleTab, required this.audioPageType, + this.selectedColor, }); final List