Skip to content

Commit

Permalink
fix: android downloads and local collection path + design adjustments (
Browse files Browse the repository at this point in the history
…#904)

* fix: android downloads and local collection path + design adjustments

* fix: hide sidepanel divider if no sidepanel

* fix: podcasttile padding
  • Loading branch information
Feichtmeier authored Aug 30, 2024
1 parent df7b394 commit 3ac49fb
Show file tree
Hide file tree
Showing 22 changed files with 143 additions and 274 deletions.
2 changes: 1 addition & 1 deletion lib/app/view/master_detail_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class MasterDetailPage extends StatelessWidget with WatchItMixin {
masterItems: masterItems,
libraryModel: libraryModel,
),
const VerticalDivider(),
if (context.showMasterPanel) const VerticalDivider(),
Expanded(
child: BackGesture(
child: Navigator(
Expand Down
65 changes: 0 additions & 65 deletions lib/app/view/scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ import 'package:flutter/material.dart';
import 'package:watch_it/watch_it.dart';
import 'package:yaru/yaru.dart';

import '../../common/view/icons.dart';
import '../../constants.dart';
import '../../extensions/build_context_x.dart';
import '../../l10n/l10n.dart';
import '../../library/library_model.dart';
import '../../patch_notes/patch_notes_dialog.dart';
import '../../player/view/player_view.dart';
import '../app_model.dart';
Expand Down Expand Up @@ -53,8 +50,6 @@ class _MusicPodScaffoldState extends State<MusicPodScaffold> {
const Expanded(child: MasterDetailPage()),
if (!playerToTheRight || isMobile)
const PlayerView(mode: PlayerPosition.bottom),
if (isMobile && context.m.size.width < 500)
const MobileNavigationBar(),
],
),
),
Expand All @@ -71,63 +66,3 @@ class _MusicPodScaffoldState extends State<MusicPodScaffold> {
);
}
}

class MobileNavigationBar extends StatelessWidget with WatchItMixin {
const MobileNavigationBar({super.key});

@override
Widget build(BuildContext context) {
final selectedPageId =
watchPropertyValue((LibraryModel m) => m.selectedPageId);
final libraryModel = di<LibraryModel>();

return NavigationBar(
backgroundColor: context.t.cardColor,
height: 45,
indicatorColor: Colors.transparent,
selectedIndex: switch (selectedPageId) {
kSearchPageId => 0,
kLocalAudioPageId => 1,
kRadioPageId => 2,
_ => 3,
},
onDestinationSelected: (i) => libraryModel.pushNamed(
pageId: switch (i) {
0 => kSearchPageId,
1 => kLocalAudioPageId,
2 => kRadioPageId,
_ => kPodcastsPageId,
},
),
destinations: [
NavigationDestination(
icon: Icon(Iconz().search),
selectedIcon: Icon(Iconz().search),
label: context.l10n.search,
),
NavigationDestination(
icon: Icon(Iconz().localAudio),
selectedIcon: Icon(Iconz().localAudioFilled),
label: context.l10n.local,
),
NavigationDestination(
icon: Icon(Iconz().radio),
selectedIcon: Icon(Iconz().radioFilled),
label: context.l10n.radio,
),
NavigationDestination(
icon: Icon(Iconz().podcast),
selectedIcon: Icon(Iconz().podcastFilled),
label: context.l10n.podcasts,
),
]
.map(
(e) => Padding(
padding: const EdgeInsets.only(bottom: 23),
child: e,
),
)
.toList(),
);
}
}
44 changes: 27 additions & 17 deletions lib/common/view/audio_tile.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:watch_it/watch_it.dart';
import 'package:yaru/constants.dart';
import 'package:yaru/yaru.dart';

import '../../constants.dart';
import '../../extensions/build_context_x.dart';
Expand All @@ -14,6 +14,7 @@ import 'audio_tile_image.dart';
import 'audio_tile_option_button.dart';
import 'like_icon.dart';
import 'tapable_text.dart';
import 'theme.dart';

class AudioTile extends StatefulWidget with WatchItStatefulWidgetMixin {
const AudioTile({
Expand Down Expand Up @@ -78,8 +79,14 @@ class _AudioTileState extends State<AudioTile> {

return MouseRegion(
key: ValueKey(widget.audio.audioType?.index),
onEnter: (e) => setState(() => _hovered = true),
onExit: (e) => setState(() => _hovered = false),
onEnter: (e) {
if (isMobile) return;
setState(() => _hovered = true);
},
onExit: (e) {
if (isMobile) return;
setState(() => _hovered = false);
},
child: ListTile(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
minLeadingWidth: kAudioTrackWidth,
Expand All @@ -89,7 +96,7 @@ class _AudioTileState extends State<AudioTile> {
? selectedColor
: theme.colorScheme.onSurface,
selectedTileColor: theme.colorScheme.onSurface.withOpacity(0.05),
contentPadding: kModernAudioTilePadding,
contentPadding: audioTilePadding,
onTap: () {
if (widget.selected) {
if (widget.isPlayerPlaying) {
Expand All @@ -116,7 +123,7 @@ class _AudioTileState extends State<AudioTile> {
: () => widget.onSubTitleTap?.call(subTitle),
),
trailing: _AudioTileTrail(
hovered: _hovered,
hovered: isMobile ? true : _hovered,
liked: liked,
audio: widget.audio,
selected: widget.selected,
Expand Down Expand Up @@ -192,18 +199,21 @@ class _AudioTileTrail extends StatelessWidget with WatchItMixin {
),
},
),
const SizedBox(
width: 5,
),
if (audio.audioType != AudioType.radio && audio.durationMs != null)
SizedBox(
width: 60,
child: Align(
alignment: Alignment.centerRight,
child: Text(
Duration(milliseconds: audio.durationMs!.toInt()).formattedTime,
style: context.t.textTheme.labelMedium?.copyWith(
color: selected && isPlayerPlaying ? selectedColor : null,
if (!isMobile &&
audio.audioType != AudioType.radio &&
audio.durationMs != null)
Padding(
padding: const EdgeInsets.only(left: 5),
child: SizedBox(
width: 60,
child: Align(
alignment: Alignment.centerRight,
child: Text(
Duration(milliseconds: audio.durationMs!.toInt())
.formattedTime,
style: context.t.textTheme.labelMedium?.copyWith(
color: selected && isPlayerPlaying ? selectedColor : null,
),
),
),
),
Expand Down
126 changes: 0 additions & 126 deletions lib/common/view/audio_tile_header.dart

This file was deleted.

3 changes: 1 addition & 2 deletions lib/common/view/header_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class HeaderBar extends StatelessWidget

Widget? leading;

if (!isMobile &&
includeSidebarButton &&
if (includeSidebarButton &&
!context.showMasterPanel &&
masterScaffoldKey.currentState?.isDrawerOpen == false) {
leading = const SidebarButton();
Expand Down
4 changes: 2 additions & 2 deletions lib/common/view/icons.dart
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@ class Iconz {
? YaruIcons.sort_ascending
: appleStyled
? CupertinoIcons.sort_up
: Icons.arrow_upward;
: Icons.sort;
IconData get descending => yaruStyled
? YaruIcons.sort_descending
: appleStyled
? CupertinoIcons.sort_down
: Icons.arrow_downward;
: Icons.sort;
IconData get info => yaruStyled
? YaruIcons.information
: appleStyled
Expand Down
Loading

0 comments on commit 3ac49fb

Please sign in to comment.