mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-06 15:39:41 +00:00
refactor(lyrics): remove lyric element from mobile navbar and open lyric sheet in mobile player view
This commit is contained in:
parent
e7acb9ed5c
commit
b5415f442a
@ -13,3 +13,10 @@ List<SideBarTiles> sidebarTileList = [
|
|||||||
SideBarTiles(icon: SpotubeIcons.library, title: "Library"),
|
SideBarTiles(icon: SpotubeIcons.library, title: "Library"),
|
||||||
SideBarTiles(icon: SpotubeIcons.music, title: "Lyrics")
|
SideBarTiles(icon: SpotubeIcons.music, title: "Lyrics")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
List<SideBarTiles> navbarTileList = [
|
||||||
|
SideBarTiles(icon: SpotubeIcons.home, title: "Browse"),
|
||||||
|
SideBarTiles(icon: SpotubeIcons.search, title: "Search"),
|
||||||
|
SideBarTiles(icon: SpotubeIcons.library, title: "Library"),
|
||||||
|
SideBarTiles(icon: SpotubeIcons.settings, title: "Settings")
|
||||||
|
];
|
||||||
|
|||||||
@ -50,6 +50,7 @@ abstract class SpotubeIcons {
|
|||||||
static const fastForward = FeatherIcons.fastForward;
|
static const fastForward = FeatherIcons.fastForward;
|
||||||
static const angleRight = FeatherIcons.chevronRight;
|
static const angleRight = FeatherIcons.chevronRight;
|
||||||
static const angleLeft = FeatherIcons.chevronLeft;
|
static const angleLeft = FeatherIcons.chevronLeft;
|
||||||
|
static const angleDown = FeatherIcons.chevronDown;
|
||||||
static const shoppingBag = FeatherIcons.shoppingBag;
|
static const shoppingBag = FeatherIcons.shoppingBag;
|
||||||
static const screenSearch = Icons.screen_search_desktop_outlined;
|
static const screenSearch = Icons.screen_search_desktop_outlined;
|
||||||
static const save = FeatherIcons.save;
|
static const save = FeatherIcons.save;
|
||||||
@ -58,4 +59,6 @@ abstract class SpotubeIcons {
|
|||||||
static const update = FeatherIcons.refreshCcw;
|
static const update = FeatherIcons.refreshCcw;
|
||||||
static const info = FeatherIcons.info;
|
static const info = FeatherIcons.info;
|
||||||
static const userRemove = FeatherIcons.userX;
|
static const userRemove = FeatherIcons.userX;
|
||||||
|
static const close = FeatherIcons.x;
|
||||||
|
static const minimize = FeatherIcons.minimize2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,6 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
|||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:platform_ui/platform_ui.dart';
|
import 'package:platform_ui/platform_ui.dart';
|
||||||
import 'package:spotube/collections/side_bar_tiles.dart';
|
import 'package:spotube/collections/side_bar_tiles.dart';
|
||||||
import 'package:spotube/collections/spotube_icons.dart';
|
|
||||||
import 'package:spotube/components/root/sidebar.dart';
|
import 'package:spotube/components/root/sidebar.dart';
|
||||||
import 'package:spotube/hooks/use_breakpoints.dart';
|
import 'package:spotube/hooks/use_breakpoints.dart';
|
||||||
import 'package:spotube/provider/downloader_provider.dart';
|
import 'package:spotube/provider/downloader_provider.dart';
|
||||||
@ -40,7 +39,7 @@ class SpotubeNavigationBar extends HookConsumerWidget {
|
|||||||
layoutMode == LayoutMode.adaptive)) return const SizedBox();
|
layoutMode == LayoutMode.adaptive)) return const SizedBox();
|
||||||
return PlatformBottomNavigationBar(
|
return PlatformBottomNavigationBar(
|
||||||
items: [
|
items: [
|
||||||
...sidebarTileList.map(
|
...navbarTileList.map(
|
||||||
(e) {
|
(e) {
|
||||||
return PlatformBottomNavigationBarItem(
|
return PlatformBottomNavigationBarItem(
|
||||||
icon: e.icon,
|
icon: e.icon,
|
||||||
@ -48,20 +47,15 @@ class SpotubeNavigationBar extends HookConsumerWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
const PlatformBottomNavigationBarItem(
|
|
||||||
icon: SpotubeIcons.settings,
|
|
||||||
label: "Settings",
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
selectedIndex: insideSelectedIndex.value,
|
selectedIndex: insideSelectedIndex.value,
|
||||||
onSelectedIndexChanged: (i) {
|
onSelectedIndexChanged: (i) {
|
||||||
if (i == 4) {
|
|
||||||
insideSelectedIndex.value = 4;
|
|
||||||
Sidebar.goToSettings(context);
|
|
||||||
} else {
|
|
||||||
insideSelectedIndex.value = i;
|
insideSelectedIndex.value = i;
|
||||||
onSelectedIndexChanged(i);
|
if (navbarTileList[i].title == "Settings") {
|
||||||
|
Sidebar.goToSettings(context);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
onSelectedIndexChanged(i);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -193,6 +193,7 @@ class PlaybuttonCard extends HookWidget {
|
|||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
playButton,
|
playButton,
|
||||||
|
const SizedBox(width: 10),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:platform_ui/platform_ui.dart';
|
import 'package:platform_ui/platform_ui.dart';
|
||||||
|
import 'package:spotube/collections/spotube_icons.dart';
|
||||||
import 'package:spotube/components/shared/page_window_title_bar.dart';
|
import 'package:spotube/components/shared/page_window_title_bar.dart';
|
||||||
import 'package:spotube/components/shared/image/universal_image.dart';
|
import 'package:spotube/components/shared/image/universal_image.dart';
|
||||||
import 'package:spotube/hooks/use_custom_status_bar_color.dart';
|
import 'package:spotube/hooks/use_custom_status_bar_color.dart';
|
||||||
@ -15,7 +16,8 @@ import 'package:spotube/utils/platform.dart';
|
|||||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||||
|
|
||||||
class LyricsPage extends HookConsumerWidget {
|
class LyricsPage extends HookConsumerWidget {
|
||||||
const LyricsPage({Key? key}) : super(key: key);
|
final bool isModal;
|
||||||
|
const LyricsPage({Key? key, this.isModal = false}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, ref) {
|
Widget build(BuildContext context, ref) {
|
||||||
@ -37,13 +39,13 @@ class LyricsPage extends HookConsumerWidget {
|
|||||||
noSetBGColor: true,
|
noSetBGColor: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
final body = [
|
Widget body = [
|
||||||
SyncedLyrics(palette: palette),
|
SyncedLyrics(palette: palette),
|
||||||
GeniusLyrics(palette: palette),
|
GeniusLyrics(palette: palette),
|
||||||
][index.value];
|
][index.value];
|
||||||
|
|
||||||
final tabbar = PreferredSize(
|
final tabbar = PreferredSize(
|
||||||
preferredSize: const Size.fromHeight(40),
|
preferredSize: const Size.fromHeight(50),
|
||||||
child: PlatformTabBar(
|
child: PlatformTabBar(
|
||||||
isNavigational: PlatformProperty.only(linux: true, other: false),
|
isNavigational: PlatformProperty.only(linux: true, other: false),
|
||||||
selectedIndex: index.value,
|
selectedIndex: index.value,
|
||||||
@ -63,10 +65,53 @@ class LyricsPage extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (isModal) {
|
||||||
|
return SafeArea(
|
||||||
|
child: Container(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black45,
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
margin: const EdgeInsets.all(16),
|
||||||
|
child: BackdropFilter(
|
||||||
|
filter: ImageFilter.blur(sigmaX: 50, sigmaY: 50),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Container(
|
||||||
|
height: 7,
|
||||||
|
width: 150,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: palette.titleTextColor,
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
PlatformAppBar(
|
||||||
|
title: tabbar,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
toolbarOpacity: platform == TargetPlatform.iOS ? 0 : 1,
|
||||||
|
actions: [
|
||||||
|
PlatformIconButton(
|
||||||
|
icon: const Icon(SpotubeIcons.minimize),
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Expanded(child: body),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
return PlatformScaffold(
|
return PlatformScaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
appBar: !kIsMacOS
|
appBar: !kIsMacOS
|
||||||
? (platform != TargetPlatform.windows
|
? (platform != TargetPlatform.windows && !isModal
|
||||||
? PageWindowTitleBar(
|
? PageWindowTitleBar(
|
||||||
toolbarOpacity: 0,
|
toolbarOpacity: 0,
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
@ -81,10 +126,11 @@ class LyricsPage extends HookConsumerWidget {
|
|||||||
image: UniversalImage.imageProvider(albumArt),
|
image: UniversalImage.imageProvider(albumArt),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
),
|
),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
),
|
),
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
|
||||||
child: Container(
|
child: ColoredBox(
|
||||||
color: palette.color.withOpacity(.7),
|
color: palette.color.withOpacity(.7),
|
||||||
child: SafeArea(child: body),
|
child: SafeArea(child: body),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import 'package:spotube/components/shared/image/universal_image.dart';
|
|||||||
import 'package:spotube/hooks/use_breakpoints.dart';
|
import 'package:spotube/hooks/use_breakpoints.dart';
|
||||||
import 'package:spotube/hooks/use_custom_status_bar_color.dart';
|
import 'package:spotube/hooks/use_custom_status_bar_color.dart';
|
||||||
import 'package:spotube/hooks/use_palette_color.dart';
|
import 'package:spotube/hooks/use_palette_color.dart';
|
||||||
|
import 'package:spotube/pages/lyrics/lyrics.dart';
|
||||||
import 'package:spotube/provider/playback_provider.dart';
|
import 'package:spotube/provider/playback_provider.dart';
|
||||||
import 'package:spotube/provider/user_preferences_provider.dart';
|
import 'package:spotube/provider/user_preferences_provider.dart';
|
||||||
import 'package:spotube/utils/type_conversion_utils.dart';
|
import 'package:spotube/utils/type_conversion_utils.dart';
|
||||||
@ -193,10 +194,24 @@ class PlayerView extends HookConsumerWidget {
|
|||||||
extraActions: [
|
extraActions: [
|
||||||
PlatformIconButton(
|
PlatformIconButton(
|
||||||
tooltip: "Open Lyrics",
|
tooltip: "Open Lyrics",
|
||||||
icon: const Icon(SpotubeIcons.lyrics),
|
icon: const Icon(SpotubeIcons.music),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
GoRouter.of(context).pop();
|
showModalBottomSheet(
|
||||||
GoRouter.of(context).go('/lyrics');
|
context: context,
|
||||||
|
isDismissible: true,
|
||||||
|
enableDrag: true,
|
||||||
|
isScrollControlled: true,
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
barrierColor: Colors.black12,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: MediaQuery.of(context).size.height,
|
||||||
|
),
|
||||||
|
builder: (context) =>
|
||||||
|
const LyricsPage(isModal: true),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user