From c4c9fd7ac27bbefbacf437a053fb63190b6f233c Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Wed, 16 Mar 2022 18:06:42 +0600 Subject: [PATCH] leading/center not working on PageWindowTitle on Android fixed artist-to-clickable-artists now responsive useBreakpoint logic updated --- lib/components/Player/PlayerTrackDetails.dart | 9 ++-- lib/components/Player/PlayerView.dart | 1 - lib/components/Settings.dart | 50 ++++++++++--------- lib/components/Shared/PageWindowTitleBar.dart | 4 +- lib/helpers/artists-to-clickable-artists.dart | 10 ++-- lib/hooks/useBreakpoints.dart | 16 +++--- 6 files changed, 44 insertions(+), 46 deletions(-) diff --git a/lib/components/Player/PlayerTrackDetails.dart b/lib/components/Player/PlayerTrackDetails.dart index 9610756c..34bd9297 100644 --- a/lib/components/Player/PlayerTrackDetails.dart +++ b/lib/components/Player/PlayerTrackDetails.dart @@ -20,8 +20,7 @@ class PlayerTrackDetails extends HookConsumerWidget { children: [ if (albumArt != null) Padding( - padding: EdgeInsets.all( - breakpoint.isLessThanOrEqualTo(Breakpoints.md) ? 5.0 : 0), + padding: const EdgeInsets.all(5.0), child: CachedNetworkImage( imageUrl: albumArt!, maxHeightDiskCache: 50, @@ -36,8 +35,7 @@ class PlayerTrackDetails extends HookConsumerWidget { }, ), ), - if (breakpoint.isLessThanOrEqualTo(Breakpoints.md)) ...[ - const SizedBox(width: 10), + if (breakpoint.isLessThanOrEqualTo(Breakpoints.md)) Flexible( child: Text( playback.currentTrack?.name ?? "Not playing", @@ -48,7 +46,7 @@ class PlayerTrackDetails extends HookConsumerWidget { ?.copyWith(fontWeight: FontWeight.bold, color: color), ), ), - ], + // title of the currently playing track if (breakpoint.isMoreThan(Breakpoints.md)) Flexible( @@ -65,7 +63,6 @@ class PlayerTrackDetails extends HookConsumerWidget { ), artistsToClickableArtists( playback.currentTrack?.artists ?? [], - mainAxisAlignment: MainAxisAlignment.center, ) ], ), diff --git a/lib/components/Player/PlayerView.dart b/lib/components/Player/PlayerView.dart index c410d744..1f910a2d 100644 --- a/lib/components/Player/PlayerView.dart +++ b/lib/components/Player/PlayerView.dart @@ -65,7 +65,6 @@ class PlayerView extends HookConsumerWidget { ), artistsToClickableArtists( currentTrack?.artists ?? [], - mainAxisAlignment: MainAxisAlignment.center, textStyle: Theme.of(context).textTheme.headline6!.copyWith( fontWeight: FontWeight.bold, color: paletteColor.bodyTextColor, diff --git a/lib/components/Settings.dart b/lib/components/Settings.dart index 117a8037..48d4335b 100644 --- a/lib/components/Settings.dart +++ b/lib/components/Settings.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:go_router/go_router.dart'; @@ -80,27 +82,29 @@ class Settings extends HookConsumerWidget { ], ), const SizedBox(height: 10), - SettingsHotKeyTile( - title: "Next track global shortcut", - currentHotKey: preferences.nextTrackHotKey, - onHotKeyRecorded: (value) { - preferences.setNextTrackHotKey(value); - }, - ), - SettingsHotKeyTile( - title: "Prev track global shortcut", - currentHotKey: preferences.prevTrackHotKey, - onHotKeyRecorded: (value) { - preferences.setPrevTrackHotKey(value); - }, - ), - SettingsHotKeyTile( - title: "Play/Pause global shortcut", - currentHotKey: preferences.playPauseHotKey, - onHotKeyRecorded: (value) { - preferences.setPlayPauseHotKey(value); - }, - ), + if (!Platform.isAndroid && !Platform.isIOS) ...[ + SettingsHotKeyTile( + title: "Next track global shortcut", + currentHotKey: preferences.nextTrackHotKey, + onHotKeyRecorded: (value) { + preferences.setNextTrackHotKey(value); + }, + ), + SettingsHotKeyTile( + title: "Prev track global shortcut", + currentHotKey: preferences.prevTrackHotKey, + onHotKeyRecorded: (value) { + preferences.setPrevTrackHotKey(value); + }, + ), + SettingsHotKeyTile( + title: "Play/Pause global shortcut", + currentHotKey: preferences.playPauseHotKey, + onHotKeyRecorded: (value) { + preferences.setPlayPauseHotKey(value); + }, + ), + ], Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -170,8 +174,8 @@ class Settings extends HookConsumerWidget { ], ), const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, + Wrap( + alignment: WrapAlignment.center, children: const [ Hyperlink( "💚 Sponsor/Donate 💚", diff --git a/lib/components/Shared/PageWindowTitleBar.dart b/lib/components/Shared/PageWindowTitleBar.dart index 02cc76f5..c3a0038d 100644 --- a/lib/components/Shared/PageWindowTitleBar.dart +++ b/lib/components/Shared/PageWindowTitleBar.dart @@ -53,14 +53,14 @@ class PageWindowTitleBar extends StatelessWidget : super(key: key); @override Size get preferredSize => Size.fromHeight( - !Platform.isIOS && !Platform.isAndroid ? appWindow.titleBarHeight : 0, + !Platform.isIOS && !Platform.isAndroid ? appWindow.titleBarHeight : 35, ); @override Widget build(BuildContext context) { if (Platform.isIOS || Platform.isAndroid) { return PreferredSize( - preferredSize: const Size.fromHeight(70), + preferredSize: const Size.fromHeight(300), child: Row( children: [ if (leading != null) leading!, diff --git a/lib/helpers/artists-to-clickable-artists.dart b/lib/helpers/artists-to-clickable-artists.dart index 2ce58e98..aa55ab02 100644 --- a/lib/helpers/artists-to-clickable-artists.dart +++ b/lib/helpers/artists-to-clickable-artists.dart @@ -1,18 +1,16 @@ import 'package:flutter/material.dart'; import 'package:spotify/spotify.dart'; -import 'package:spotube/components/Artist/ArtistProfile.dart'; import 'package:spotube/components/Shared/LinkText.dart'; -import 'package:spotube/components/Shared/SpotubePageRoute.dart'; Widget artistsToClickableArtists( List artists, { - CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, - MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, + WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.center, + WrapAlignment mainAxisAlignment = WrapAlignment.center, TextStyle textStyle = const TextStyle(), }) { - return Row( + return Wrap( crossAxisAlignment: crossAxisAlignment, - mainAxisAlignment: mainAxisAlignment, + alignment: mainAxisAlignment, children: artists .asMap() .entries diff --git a/lib/hooks/useBreakpoints.dart b/lib/hooks/useBreakpoints.dart index 825e1217..e4e73334 100644 --- a/lib/hooks/useBreakpoints.dart +++ b/lib/hooks/useBreakpoints.dart @@ -73,22 +73,22 @@ BreakpointUtils useBreakpoints() { final utils = BreakpointUtils(breakpoint.value); useEffect(() { - if (width >= 1920 && breakpoint.value != Breakpoints.xxl) { + if (width > 1920 && breakpoint.value != Breakpoints.xxl) { breakpoint.value = Breakpoints.xxl; - } else if (width >= 1366 && - width < 1920 && + } else if (width > 1366 && + width <= 1920 && breakpoint.value != Breakpoints.xl) { breakpoint.value = Breakpoints.xl; - } else if (width >= 768 && - width < 1366 && + } else if (width > 768 && + width <= 1366 && breakpoint.value != Breakpoints.lg) { breakpoint.value = Breakpoints.lg; - } else if (width >= 360 && - width < 768 && + } else if (width > 360 && + width <= 768 && breakpoint.value != Breakpoints.md) { breakpoint.value = Breakpoints.md; } else if (width >= 250 && - width < 360 && + width <= 360 && breakpoint.value != Breakpoints.sm) { breakpoint.value = Breakpoints.sm; }