leading/center not working on PageWindowTitle on Android fixed

artist-to-clickable-artists now responsive
useBreakpoint logic updated
This commit is contained in:
Kingkor Roy Tirtho 2022-03-16 18:06:42 +06:00
parent c64f329c42
commit c4c9fd7ac2
6 changed files with 44 additions and 46 deletions

View File

@ -20,8 +20,7 @@ class PlayerTrackDetails extends HookConsumerWidget {
children: [ children: [
if (albumArt != null) if (albumArt != null)
Padding( Padding(
padding: EdgeInsets.all( padding: const EdgeInsets.all(5.0),
breakpoint.isLessThanOrEqualTo(Breakpoints.md) ? 5.0 : 0),
child: CachedNetworkImage( child: CachedNetworkImage(
imageUrl: albumArt!, imageUrl: albumArt!,
maxHeightDiskCache: 50, maxHeightDiskCache: 50,
@ -36,8 +35,7 @@ class PlayerTrackDetails extends HookConsumerWidget {
}, },
), ),
), ),
if (breakpoint.isLessThanOrEqualTo(Breakpoints.md)) ...[ if (breakpoint.isLessThanOrEqualTo(Breakpoints.md))
const SizedBox(width: 10),
Flexible( Flexible(
child: Text( child: Text(
playback.currentTrack?.name ?? "Not playing", playback.currentTrack?.name ?? "Not playing",
@ -48,7 +46,7 @@ class PlayerTrackDetails extends HookConsumerWidget {
?.copyWith(fontWeight: FontWeight.bold, color: color), ?.copyWith(fontWeight: FontWeight.bold, color: color),
), ),
), ),
],
// title of the currently playing track // title of the currently playing track
if (breakpoint.isMoreThan(Breakpoints.md)) if (breakpoint.isMoreThan(Breakpoints.md))
Flexible( Flexible(
@ -65,7 +63,6 @@ class PlayerTrackDetails extends HookConsumerWidget {
), ),
artistsToClickableArtists( artistsToClickableArtists(
playback.currentTrack?.artists ?? [], playback.currentTrack?.artists ?? [],
mainAxisAlignment: MainAxisAlignment.center,
) )
], ],
), ),

View File

@ -65,7 +65,6 @@ class PlayerView extends HookConsumerWidget {
), ),
artistsToClickableArtists( artistsToClickableArtists(
currentTrack?.artists ?? [], currentTrack?.artists ?? [],
mainAxisAlignment: MainAxisAlignment.center,
textStyle: Theme.of(context).textTheme.headline6!.copyWith( textStyle: Theme.of(context).textTheme.headline6!.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: paletteColor.bodyTextColor, color: paletteColor.bodyTextColor,

View File

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
@ -80,6 +82,7 @@ class Settings extends HookConsumerWidget {
], ],
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
if (!Platform.isAndroid && !Platform.isIOS) ...[
SettingsHotKeyTile( SettingsHotKeyTile(
title: "Next track global shortcut", title: "Next track global shortcut",
currentHotKey: preferences.nextTrackHotKey, currentHotKey: preferences.nextTrackHotKey,
@ -101,6 +104,7 @@ class Settings extends HookConsumerWidget {
preferences.setPlayPauseHotKey(value); preferences.setPlayPauseHotKey(value);
}, },
), ),
],
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -170,8 +174,8 @@ class Settings extends HookConsumerWidget {
], ],
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Row( Wrap(
mainAxisAlignment: MainAxisAlignment.center, alignment: WrapAlignment.center,
children: const [ children: const [
Hyperlink( Hyperlink(
"💚 Sponsor/Donate 💚", "💚 Sponsor/Donate 💚",

View File

@ -53,14 +53,14 @@ class PageWindowTitleBar extends StatelessWidget
: super(key: key); : super(key: key);
@override @override
Size get preferredSize => Size.fromHeight( Size get preferredSize => Size.fromHeight(
!Platform.isIOS && !Platform.isAndroid ? appWindow.titleBarHeight : 0, !Platform.isIOS && !Platform.isAndroid ? appWindow.titleBarHeight : 35,
); );
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (Platform.isIOS || Platform.isAndroid) { if (Platform.isIOS || Platform.isAndroid) {
return PreferredSize( return PreferredSize(
preferredSize: const Size.fromHeight(70), preferredSize: const Size.fromHeight(300),
child: Row( child: Row(
children: [ children: [
if (leading != null) leading!, if (leading != null) leading!,

View File

@ -1,18 +1,16 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:spotify/spotify.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/LinkText.dart';
import 'package:spotube/components/Shared/SpotubePageRoute.dart';
Widget artistsToClickableArtists( Widget artistsToClickableArtists(
List<ArtistSimple> artists, { List<ArtistSimple> artists, {
CrossAxisAlignment crossAxisAlignment = CrossAxisAlignment.center, WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.center,
MainAxisAlignment mainAxisAlignment = MainAxisAlignment.start, WrapAlignment mainAxisAlignment = WrapAlignment.center,
TextStyle textStyle = const TextStyle(), TextStyle textStyle = const TextStyle(),
}) { }) {
return Row( return Wrap(
crossAxisAlignment: crossAxisAlignment, crossAxisAlignment: crossAxisAlignment,
mainAxisAlignment: mainAxisAlignment, alignment: mainAxisAlignment,
children: artists children: artists
.asMap() .asMap()
.entries .entries

View File

@ -73,22 +73,22 @@ BreakpointUtils useBreakpoints() {
final utils = BreakpointUtils(breakpoint.value); final utils = BreakpointUtils(breakpoint.value);
useEffect(() { useEffect(() {
if (width >= 1920 && breakpoint.value != Breakpoints.xxl) { if (width > 1920 && breakpoint.value != Breakpoints.xxl) {
breakpoint.value = Breakpoints.xxl; breakpoint.value = Breakpoints.xxl;
} else if (width >= 1366 && } else if (width > 1366 &&
width < 1920 && width <= 1920 &&
breakpoint.value != Breakpoints.xl) { breakpoint.value != Breakpoints.xl) {
breakpoint.value = Breakpoints.xl; breakpoint.value = Breakpoints.xl;
} else if (width >= 768 && } else if (width > 768 &&
width < 1366 && width <= 1366 &&
breakpoint.value != Breakpoints.lg) { breakpoint.value != Breakpoints.lg) {
breakpoint.value = Breakpoints.lg; breakpoint.value = Breakpoints.lg;
} else if (width >= 360 && } else if (width > 360 &&
width < 768 && width <= 768 &&
breakpoint.value != Breakpoints.md) { breakpoint.value != Breakpoints.md) {
breakpoint.value = Breakpoints.md; breakpoint.value = Breakpoints.md;
} else if (width >= 250 && } else if (width >= 250 &&
width < 360 && width <= 360 &&
breakpoint.value != Breakpoints.sm) { breakpoint.value != Breakpoints.sm) {
breakpoint.value = Breakpoints.sm; breakpoint.value = Breakpoints.sm;
} }