fix(macos): white text color in dark mode, text field white background

This commit is contained in:
Kingkor Roy Tirtho 2022-11-01 13:08:06 +06:00
parent 46b00bafdf
commit e086b520e7
22 changed files with 311 additions and 253 deletions

View File

@ -1,12 +1,16 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:fluent_ui/fluent_ui.dart' hide Colors;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:spotify/spotify.dart'; import 'package:spotify/spotify.dart';
import 'package:spotube/components/Shared/HoverBuilder.dart'; import 'package:spotube/components/Shared/HoverBuilder.dart';
import 'package:spotube/components/Shared/UniversalImage.dart'; import 'package:spotube/components/Shared/UniversalImage.dart';
import 'package:spotube/hooks/usePlatformProperty.dart';
import 'package:spotube/utils/service_utils.dart'; import 'package:spotube/utils/service_utils.dart';
import 'package:spotube/utils/type_conversion_utils.dart'; import 'package:spotube/utils/type_conversion_utils.dart';
class ArtistCard extends StatelessWidget { class ArtistCard extends HookWidget {
final Artist artist; final Artist artist;
const ArtistCard(this.artist, {Key? key}) : super(key: key); const ArtistCard(this.artist, {Key? key}) : super(key: key);
@ -18,28 +22,76 @@ class ArtistCard extends StatelessWidget {
placeholder: ImagePlaceholder.artist, placeholder: ImagePlaceholder.artist,
), ),
); );
return SizedBox( final boxShadow = usePlatformProperty<BoxShadow?>(
height: 240, (context) => PlatformProperty(
width: 200, android: BoxShadow(
child: InkWell(
onTap: () {
ServiceUtils.navigate(context, "/artist/${artist.id}");
},
borderRadius: BorderRadius.circular(10),
child: HoverBuilder(builder: (context, isHovering) {
return Ink(
width: 200,
decoration: BoxDecoration(
color: Theme.of(context).backgroundColor,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
blurRadius: 10, blurRadius: 10,
offset: const Offset(0, 3), offset: const Offset(0, 3),
spreadRadius: 5, spreadRadius: 5,
color: Theme.of(context).shadowColor, color: Theme.of(context).shadowColor,
),
ios: null,
macos: null,
linux: BoxShadow(
blurRadius: 10,
offset: const Offset(0, 3),
spreadRadius: 5,
color: Theme.of(context).shadowColor,
),
windows: null,
),
);
final splash = usePlatformProperty<InteractiveInkFeatureFactory?>(
(context) => PlatformProperty.multiPlatformGroup({
InkRipple.splashFactory: {TargetPlatform.android, TargetPlatform.linux},
NoSplash.splashFactory: {
TargetPlatform.windows,
TargetPlatform.macOS,
TargetPlatform.iOS,
}
}),
);
return SizedBox(
height: 240,
width: 200,
child: InkWell(
splashFactory: splash,
onTap: () {
ServiceUtils.navigate(context, "/artist/${artist.id}");
},
customBorder: platform == TargetPlatform.windows
? Border.all(
color: FluentTheme.maybeOf(context)
?.micaBackgroundColor
.withOpacity(.7) ??
Colors.transparent,
width: 1,
) )
: null,
borderRadius: BorderRadius.circular(
platform == TargetPlatform.windows ? 5 : 8,
),
child: HoverBuilder(builder: (context, isHovering) {
return Ink(
width: 200,
decoration: BoxDecoration(
color: PlatformTheme.of(context).secondaryBackgroundColor,
borderRadius: BorderRadius.circular(
platform == TargetPlatform.windows ? 5 : 8,
),
boxShadow: [
if (boxShadow != null) boxShadow,
], ],
border: [TargetPlatform.windows, TargetPlatform.macOS]
.contains(platform)
? Border.all(
color: PlatformTheme.of(context).borderColor ??
Colors.transparent,
width: 1,
)
: null,
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(15), padding: const EdgeInsets.all(15),
@ -79,7 +131,7 @@ class ArtistCard extends StatelessWidget {
artist.name!, artist.name!,
maxLines: 2, maxLines: 2,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodyLarge!.copyWith( style: PlatformTextTheme.of(context).body?.copyWith(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),

View File

@ -31,13 +31,13 @@ class ArtistProfile extends HookConsumerWidget {
Widget build(BuildContext context, ref) { Widget build(BuildContext context, ref) {
SpotifyApi spotify = ref.watch(spotifyProvider); SpotifyApi spotify = ref.watch(spotifyProvider);
final parentScrollController = useScrollController(); final parentScrollController = useScrollController();
final textTheme = Theme.of(context).textTheme; final textTheme = PlatformTheme.of(context).textTheme;
final chipTextVariant = useBreakpointValue( final chipTextVariant = useBreakpointValue(
sm: textTheme.bodySmall, sm: textTheme!.caption,
md: textTheme.bodyMedium, md: textTheme.body,
lg: textTheme.headline6, lg: textTheme.subheading,
xl: textTheme.headline6, xl: textTheme.headline,
xxl: textTheme.headline6, xxl: textTheme.headline,
); );
final avatarWidth = useBreakpointValue( final avatarWidth = useBreakpointValue(
@ -53,7 +53,7 @@ class ArtistProfile extends HookConsumerWidget {
final Playback playback = ref.watch(playbackProvider); final Playback playback = ref.watch(playbackProvider);
return SafeArea( return SafeArea(
child: Scaffold( child: PlatformScaffold(
appBar: const PageWindowTitleBar( appBar: const PageWindowTitleBar(
leading: BackButton(), leading: BackButton(),
), ),
@ -68,7 +68,7 @@ class ArtistProfile extends HookConsumerWidget {
return const ShimmerArtistProfile(); return const ShimmerArtistProfile();
} else if (artistsQuery.hasError) { } else if (artistsQuery.hasError) {
return Center( return Center(
child: Text(artistsQuery.error.toString()), child: PlatformText(artistsQuery.error.toString()),
); );
} }
@ -106,21 +106,22 @@ class ArtistProfile extends HookConsumerWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.blue, color: Colors.blue,
borderRadius: BorderRadius.circular(50)), borderRadius: BorderRadius.circular(50)),
child: Text(data.type!.toUpperCase(), child: PlatformText(data.type!.toUpperCase(),
style: chipTextVariant?.copyWith( style: chipTextVariant?.copyWith(
color: Colors.white)), color: Colors.white)),
), ),
Text( PlatformText(
data.name!, data.name!,
style: breakpoint.isSm style: breakpoint.isSm
? textTheme.headline4 ? textTheme.subheading
: textTheme.headline2, : textTheme.headline,
), ),
Text( PlatformText(
"${PrimitiveUtils.toReadableNumber(data.followers!.total!.toDouble())} followers", "${PrimitiveUtils.toReadableNumber(data.followers!.total!.toDouble())} followers",
style: breakpoint.isSm style: breakpoint.isSm
? textTheme.bodyText1 ? textTheme.body
: textTheme.headline5, : textTheme.body
?.copyWith(fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
Row( Row(
@ -144,7 +145,7 @@ class ArtistProfile extends HookConsumerWidget {
); );
} }
return OutlinedButton( return PlatformFilledButton(
onPressed: () async { onPressed: () async {
try { try {
isFollowingQuery.data! isFollowingQuery.data!
@ -170,7 +171,7 @@ class ArtistProfile extends HookConsumerWidget {
]); ]);
} }
}, },
child: Text( child: PlatformText(
isFollowingQuery.data! isFollowingQuery.data!
? "Following" ? "Following"
: "Follow", : "Follow",
@ -190,7 +191,7 @@ class ArtistProfile extends HookConsumerWidget {
const SnackBar( const SnackBar(
width: 300, width: 300,
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
content: Text( content: PlatformText(
"Artist URL copied to clipboard", "Artist URL copied to clipboard",
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -218,7 +219,7 @@ class ArtistProfile extends HookConsumerWidget {
return const PlatformCircularProgressIndicator(); return const PlatformCircularProgressIndicator();
} else if (topTracksQuery.hasError) { } else if (topTracksQuery.hasError) {
return Center( return Center(
child: Text(topTracksQuery.error.toString()), child: PlatformText(topTracksQuery.error.toString()),
); );
} }
@ -252,9 +253,10 @@ class ArtistProfile extends HookConsumerWidget {
return Column(children: [ return Column(children: [
Row( Row(
children: [ children: [
Text( PlatformText(
"Top Tracks", "Top Tracks",
style: Theme.of(context).textTheme.headline4, style:
PlatformTheme.of(context).textTheme?.headline,
), ),
Container( Container(
margin: const EdgeInsets.symmetric(horizontal: 5), margin: const EdgeInsets.symmetric(horizontal: 5),
@ -294,16 +296,16 @@ class ArtistProfile extends HookConsumerWidget {
}, },
), ),
const SizedBox(height: 50), const SizedBox(height: 50),
Text( PlatformText(
"Albums", "Albums",
style: Theme.of(context).textTheme.headline4, style: PlatformTheme.of(context).textTheme?.headline,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
ArtistAlbumList(artistId), ArtistAlbumList(artistId),
const SizedBox(height: 20), const SizedBox(height: 20),
Text( PlatformText(
"Fans also likes", "Fans also likes",
style: Theme.of(context).textTheme.headline4, style: PlatformTheme.of(context).textTheme?.headline,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
HookBuilder( HookBuilder(
@ -317,7 +319,7 @@ class ArtistProfile extends HookConsumerWidget {
return const PlatformCircularProgressIndicator(); return const PlatformCircularProgressIndicator();
} else if (relatedArtists.hasError) { } else if (relatedArtists.hasError) {
return Center( return Center(
child: Text(relatedArtists.error.toString()), child: PlatformText(relatedArtists.error.toString()),
); );
} }

View File

@ -3,6 +3,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' hide Page; import 'package:flutter/material.dart' hide Page;
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:spotify/spotify.dart'; import 'package:spotify/spotify.dart';
import 'package:spotube/components/LoaderShimmers/ShimmerPlaybuttonCard.dart'; import 'package:spotube/components/LoaderShimmers/ShimmerPlaybuttonCard.dart';
import 'package:spotube/components/Playlist/PlaylistCard.dart'; import 'package:spotube/components/Playlist/PlaylistCard.dart';
@ -46,15 +47,13 @@ class CategoryCard extends HookConsumerWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Row( child: Row(
children: [ children: [
Text( PlatformText.headline(category.name ?? "Unknown"),
category.name ?? "Unknown",
style: Theme.of(context).textTheme.headline5,
),
], ],
), ),
), ),
playlistQuery.hasError playlistQuery.hasError
? Text("Something Went Wrong\n${playlistQuery.errors.first}") ? PlatformText(
"Something Went Wrong\n${playlistQuery.errors.first}")
: SizedBox( : SizedBox(
height: 245, height: 245,
child: ScrollConfiguration( child: ScrollConfiguration(

View File

@ -42,7 +42,6 @@ class Genres extends HookConsumerWidget {
]; ];
return PlatformScaffold( return PlatformScaffold(
backgroundColor: PlatformProperty.all(Colors.transparent),
body: ListView.builder( body: ListView.builder(
itemCount: categories.length, itemCount: categories.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {

View File

@ -1,6 +1,7 @@
import 'package:fl_query_hooks/fl_query_hooks.dart'; import 'package:fl_query_hooks/fl_query_hooks.dart';
import 'package:flutter/material.dart' hide Image; import 'package:flutter/material.dart' hide Image;
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:spotube/components/Album/AlbumCard.dart'; import 'package:spotube/components/Album/AlbumCard.dart';
import 'package:spotube/components/LoaderShimmers/ShimmerPlaybuttonCard.dart'; import 'package:spotube/components/LoaderShimmers/ShimmerPlaybuttonCard.dart';
import 'package:spotube/provider/SpotifyDI.dart'; import 'package:spotube/provider/SpotifyDI.dart';
@ -22,7 +23,11 @@ class UserAlbums extends HookConsumerWidget {
} }
return SingleChildScrollView( return SingleChildScrollView(
child: Padding( child: Material(
type: MaterialType.transparency,
color: PlatformTheme.of(context).scaffoldBackgroundColor,
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Wrap( child: Wrap(
spacing: 20, // gap between adjacent chips spacing: 20, // gap between adjacent chips
@ -34,6 +39,7 @@ class UserAlbums extends HookConsumerWidget {
.toList(), .toList(),
), ),
), ),
),
); );
} }
} }

View File

@ -2,6 +2,7 @@ import 'package:fl_query_hooks/fl_query_hooks.dart';
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:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:spotify/spotify.dart'; import 'package:spotify/spotify.dart';
import 'package:spotube/components/Artist/ArtistCard.dart'; import 'package:spotube/components/Artist/ArtistCard.dart';
import 'package:spotube/components/Shared/Waypoint.dart'; import 'package:spotube/components/Shared/Waypoint.dart';
@ -28,7 +29,10 @@ class UserArtists extends HookConsumerWidget {
? false ? false
: (artistQuery.pages.last?.items?.length ?? 0) == 15; : (artistQuery.pages.last?.items?.length ?? 0) == 15;
return GridView.builder( return Material(
type: MaterialType.transparency,
color: PlatformTheme.of(context).scaffoldBackgroundColor,
child: GridView.builder(
itemCount: artists.length, itemCount: artists.length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent( gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200, maxCrossAxisExtent: 200,
@ -48,6 +52,7 @@ class UserArtists extends HookConsumerWidget {
} }
return ArtistCard(artists[index]); return ArtistCard(artists[index]);
}, },
),
); );
} }
} }

View File

@ -26,7 +26,7 @@ class UserDownloads extends HookConsumerWidget {
child: AutoSizeText( child: AutoSizeText(
"Currently downloading (${downloader.currentlyRunning})", "Currently downloading (${downloader.currentlyRunning})",
maxLines: 1, maxLines: 1,
style: Theme.of(context).textTheme.headline5, style: PlatformTextTheme.of(context).headline,
), ),
), ),
const SizedBox(width: 10), const SizedBox(width: 10),
@ -38,7 +38,8 @@ class UserDownloads extends HookConsumerWidget {
onPressed: downloader.currentlyRunning > 0 onPressed: downloader.currentlyRunning > 0
? downloader.cancelAll ? downloader.cancelAll
: null, : null,
child: const Text("Cancel All"), macOSIsSecondary: true,
child: const PlatformText("Cancel All"),
), ),
], ],
), ),

View File

@ -34,7 +34,10 @@ class UserPlaylists extends HookConsumerWidget {
} }
return SingleChildScrollView( return SingleChildScrollView(
child: Padding( child: Material(
type: MaterialType.transparency,
child: Container(
width: double.infinity,
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Wrap( child: Wrap(
spacing: 20, // gap between adjacent chips spacing: 20, // gap between adjacent chips
@ -49,6 +52,7 @@ class UserPlaylists extends HookConsumerWidget {
], ],
), ),
), ),
),
); );
} }
} }

View File

@ -95,7 +95,7 @@ class PlayerControls extends HookConsumerWidget {
return Column( return Column(
children: [ children: [
Tooltip( PlatformTooltip(
message: "Slide to seek forward or backward", message: "Slide to seek forward or backward",
child: PlatformSlider( child: PlatformSlider(
focusNode: FocusNode(), focusNode: FocusNode(),
@ -123,10 +123,10 @@ class PlayerControls extends HookConsumerWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( PlatformText(
"$currentMinutes:$currentSeconds", "$currentMinutes:$currentSeconds",
), ),
Text("$totalMinutes:$totalSeconds"), PlatformText("$totalMinutes:$totalSeconds"),
], ],
), ),
), ),

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:spotube/components/Shared/UniversalImage.dart'; import 'package:spotube/components/Shared/UniversalImage.dart';
import 'package:spotube/hooks/useBreakpoints.dart'; import 'package:spotube/hooks/useBreakpoints.dart';
import 'package:spotube/provider/Playback.dart'; import 'package:spotube/provider/Playback.dart';
@ -36,13 +37,10 @@ class PlayerTrackDetails extends HookConsumerWidget {
), ),
if (breakpoint.isLessThanOrEqualTo(Breakpoints.md)) if (breakpoint.isLessThanOrEqualTo(Breakpoints.md))
Flexible( Flexible(
child: Text( child: PlatformText(
playback.track?.name ?? "Not playing", playback.track?.name ?? "Not playing",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context) style: TextStyle(fontWeight: FontWeight.bold, color: color),
.textTheme
.bodyText1
?.copyWith(fontWeight: FontWeight.bold, color: color),
), ),
), ),
@ -52,13 +50,10 @@ class PlayerTrackDetails extends HookConsumerWidget {
flex: 1, flex: 1,
child: Column( child: Column(
children: [ children: [
Text( PlatformText(
playback.track?.name ?? "Not playing", playback.track?.name ?? "Not playing",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: Theme.of(context) style: TextStyle(fontWeight: FontWeight.bold, color: color),
.textTheme
.bodyText1
?.copyWith(fontWeight: FontWeight.bold, color: color),
), ),
TypeConversionUtils.artists_X_ClickableArtists( TypeConversionUtils.artists_X_ClickableArtists(
playback.track?.artists ?? [], playback.track?.artists ?? [],

View File

@ -77,7 +77,7 @@ class Search extends HookConsumerWidget {
return SafeArea( return SafeArea(
child: Material( child: Material(
color: Theme.of(context).backgroundColor, color: PlatformTheme.of(context).scaffoldBackgroundColor,
child: Column( child: Column(
children: [ children: [
Container( Container(
@ -85,7 +85,6 @@ class Search extends HookConsumerWidget {
horizontal: 20, horizontal: 20,
vertical: 10, vertical: 10,
), ),
color: Theme.of(context).backgroundColor,
child: PlatformTextField( child: PlatformTextField(
onChanged: (value) { onChanged: (value) {
ref.read(searchTermStateProvider.notifier).state = value; ref.read(searchTermStateProvider.notifier).state = value;
@ -136,16 +135,12 @@ class Search extends HookConsumerWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (tracks.isNotEmpty) if (tracks.isNotEmpty) PlatformText.headline("Songs"),
Text(
"Songs",
style: Theme.of(context).textTheme.headline5,
),
if (searchTrack.isLoading && if (searchTrack.isLoading &&
!searchTrack.isFetchingNextPage) !searchTrack.isFetchingNextPage)
const PlatformCircularProgressIndicator() const PlatformCircularProgressIndicator()
else if (searchTrack.hasError) else if (searchTrack.hasError)
Text( PlatformText(
searchTrack.error?[searchTrack.pageParams.last]) searchTrack.error?[searchTrack.pageParams.last])
else else
...tracks.asMap().entries.map((track) { ...tracks.asMap().entries.map((track) {
@ -191,20 +186,17 @@ class Search extends HookConsumerWidget {
: () => searchTrack.fetchNextPage(), : () => searchTrack.fetchNextPage(),
child: searchTrack.isFetchingNextPage child: searchTrack.isFetchingNextPage
? const PlatformCircularProgressIndicator() ? const PlatformCircularProgressIndicator()
: const Text("Load more"), : const PlatformText("Load more"),
), ),
), ),
if (playlists.isNotEmpty) if (playlists.isNotEmpty)
Text( PlatformText.headline("Playlists"),
"Playlists",
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10), const SizedBox(height: 10),
if (searchPlaylist.isLoading && if (searchPlaylist.isLoading &&
!searchPlaylist.isFetchingNextPage) !searchPlaylist.isFetchingNextPage)
const PlatformCircularProgressIndicator() const PlatformCircularProgressIndicator()
else if (searchPlaylist.hasError) else if (searchPlaylist.hasError)
Text(searchPlaylist PlatformText(searchPlaylist
.error?[searchPlaylist.pageParams.last]) .error?[searchPlaylist.pageParams.last])
else else
ScrollConfiguration( ScrollConfiguration(
@ -249,16 +241,13 @@ class Search extends HookConsumerWidget {
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
if (artists.isNotEmpty) if (artists.isNotEmpty)
Text( PlatformText.headline("Artists"),
"Artists",
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 10), const SizedBox(height: 10),
if (searchArtist.isLoading && if (searchArtist.isLoading &&
!searchArtist.isFetchingNextPage) !searchArtist.isFetchingNextPage)
const PlatformCircularProgressIndicator() const PlatformCircularProgressIndicator()
else if (searchArtist.hasError) else if (searchArtist.hasError)
Text(searchArtist PlatformText(searchArtist
.error?[searchArtist.pageParams.last]) .error?[searchArtist.pageParams.last])
else else
ScrollConfiguration( ScrollConfiguration(
@ -303,7 +292,7 @@ class Search extends HookConsumerWidget {
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
if (albums.isNotEmpty) if (albums.isNotEmpty)
Text( PlatformText(
"Albums", "Albums",
style: Theme.of(context).textTheme.headline5, style: Theme.of(context).textTheme.headline5,
), ),
@ -312,7 +301,7 @@ class Search extends HookConsumerWidget {
!searchAlbum.isFetchingNextPage) !searchAlbum.isFetchingNextPage)
const PlatformCircularProgressIndicator() const PlatformCircularProgressIndicator()
else if (searchAlbum.hasError) else if (searchAlbum.hasError)
Text( PlatformText(
searchAlbum.error?[searchAlbum.pageParams.last]) searchAlbum.error?[searchAlbum.pageParams.last])
else else
ScrollConfiguration( ScrollConfiguration(

View File

@ -32,7 +32,10 @@ class About extends HookWidget {
return PlatformListTile( return PlatformListTile(
leading: const Icon(Icons.info_outline_rounded), leading: const Icon(Icons.info_outline_rounded),
title: const Text("About Spotube"), title: Text(
"About Spotube",
style: PlatformTextTheme.of(context).body,
),
onTap: () { onTap: () {
showAboutDialog( showAboutDialog(
context: context, context: context,

View File

@ -50,11 +50,11 @@ class Settings extends HookConsumerWidget {
); );
return SafeArea( return SafeArea(
child: Scaffold( child: PlatformScaffold(
appBar: PageWindowTitleBar( appBar: PageWindowTitleBar(
center: Text( center: PlatformText(
"Settings", "Settings",
style: Theme.of(context).textTheme.headline5, style: PlatformTheme.of(context).textTheme?.headline,
), ),
), ),
body: Row( body: Row(
@ -65,10 +65,11 @@ class Settings extends HookConsumerWidget {
constraints: const BoxConstraints(maxWidth: 1366), constraints: const BoxConstraints(maxWidth: 1366),
child: ListView( child: ListView(
children: [ children: [
const Text( PlatformText(
" Account", " Account",
style: style: PlatformTextTheme.of(context)
TextStyle(fontWeight: FontWeight.bold, fontSize: 20), .headline
?.copyWith(fontWeight: FontWeight.bold),
), ),
if (auth.isAnonymous) if (auth.isAnonymous)
AdaptiveListTile( AdaptiveListTile(
@ -101,7 +102,8 @@ class Settings extends HookConsumerWidget {
), ),
), ),
), ),
child: Text("Connect with Spotify".toUpperCase()), child: PlatformText(
"Connect with Spotify".toUpperCase()),
), ),
), ),
if (auth.isLoggedIn) if (auth.isLoggedIn)
@ -109,7 +111,7 @@ class Settings extends HookConsumerWidget {
Auth auth = ref.watch(authProvider); Auth auth = ref.watch(authProvider);
return PlatformListTile( return PlatformListTile(
leading: const Icon(Icons.logout_rounded), leading: const Icon(Icons.logout_rounded),
title: const SizedBox( title: SizedBox(
height: 50, height: 50,
width: 180, width: 180,
child: Align( child: Align(
@ -117,6 +119,7 @@ class Settings extends HookConsumerWidget {
child: AutoSizeText( child: AutoSizeText(
"Log out of this account", "Log out of this account",
maxLines: 1, maxLines: 1,
style: PlatformTextTheme.of(context).body,
), ),
), ),
), ),
@ -131,19 +134,20 @@ class Settings extends HookConsumerWidget {
auth.logout(); auth.logout();
GoRouter.of(context).pop(); GoRouter.of(context).pop();
}, },
child: const Text("Logout"), child: const PlatformText("Logout"),
), ),
); );
}), }),
const Text( PlatformText(
" Appearance", " Appearance",
style: style: PlatformTextTheme.of(context)
TextStyle(fontWeight: FontWeight.bold, fontSize: 20), .headline
?.copyWith(fontWeight: FontWeight.bold),
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon(Icons.dashboard_rounded), leading: const Icon(Icons.dashboard_rounded),
title: const Text("Layout Mode"), title: const PlatformText("Layout Mode"),
subtitle: const Text( subtitle: const PlatformText(
"Override responsive layout mode settings", "Override responsive layout mode settings",
), ),
trailing: (context, update) => trailing: (context, update) =>
@ -152,19 +156,19 @@ class Settings extends HookConsumerWidget {
items: [ items: [
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: LayoutMode.adaptive, value: LayoutMode.adaptive,
child: const Text( child: const PlatformText(
"Adaptive", "Adaptive",
), ),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: LayoutMode.compact, value: LayoutMode.compact,
child: const Text( child: const PlatformText(
"Compact", "Compact",
), ),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: LayoutMode.extended, value: LayoutMode.extended,
child: const Text("Extended"), child: const PlatformText("Extended"),
), ),
], ],
onChanged: (value) { onChanged: (value) {
@ -177,26 +181,22 @@ class Settings extends HookConsumerWidget {
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon(Icons.dark_mode_outlined), leading: const Icon(Icons.dark_mode_outlined),
title: const Text("Theme"), title: const PlatformText("Theme"),
trailing: (context, update) => trailing: (context, update) =>
PlatformDropDownMenu<ThemeMode>( PlatformDropDownMenu<ThemeMode>(
value: preferences.themeMode, value: preferences.themeMode,
items: [ items: [
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: ThemeMode.dark, value: ThemeMode.dark,
child: const Text( child: const PlatformText("Dark"),
"Dark",
),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: ThemeMode.light, value: ThemeMode.light,
child: const Text( child: const PlatformText("Light"),
"Light",
),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: ThemeMode.system, value: ThemeMode.system,
child: const Text("System"), child: const PlatformText("System"),
), ),
], ],
onChanged: (value) { onChanged: (value) {
@ -209,7 +209,7 @@ class Settings extends HookConsumerWidget {
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.palette_outlined), leading: const Icon(Icons.palette_outlined),
title: const Text("Accent Color Scheme"), title: const PlatformText("Accent Color Scheme"),
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
horizontal: 15, horizontal: 15,
vertical: 5, vertical: 5,
@ -223,7 +223,7 @@ class Settings extends HookConsumerWidget {
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.format_color_fill_rounded), leading: const Icon(Icons.format_color_fill_rounded),
title: const Text("Background Color Scheme"), title: const PlatformText("Background Color Scheme"),
contentPadding: const EdgeInsets.symmetric( contentPadding: const EdgeInsets.symmetric(
horizontal: 15, horizontal: 15,
vertical: 5, vertical: 5,
@ -237,7 +237,7 @@ class Settings extends HookConsumerWidget {
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.album_rounded), leading: const Icon(Icons.album_rounded),
title: const Text("Rotating Album Art"), title: const PlatformText("Rotating Album Art"),
trailing: PlatformSwitch( trailing: PlatformSwitch(
value: preferences.rotatingAlbumArt, value: preferences.rotatingAlbumArt,
onChanged: (state) { onChanged: (state) {
@ -245,27 +245,28 @@ class Settings extends HookConsumerWidget {
}, },
), ),
), ),
const Text( PlatformText(
" Playback", " Playback",
style: style: PlatformTextTheme.of(context)
TextStyle(fontWeight: FontWeight.bold, fontSize: 20), .headline
?.copyWith(fontWeight: FontWeight.bold),
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon(Icons.multitrack_audio_rounded), leading: const Icon(Icons.multitrack_audio_rounded),
title: const Text("Audio Quality"), title: const PlatformText("Audio Quality"),
trailing: (context, update) => trailing: (context, update) =>
PlatformDropDownMenu<AudioQuality>( PlatformDropDownMenu<AudioQuality>(
value: preferences.audioQuality, value: preferences.audioQuality,
items: [ items: [
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: AudioQuality.high, value: AudioQuality.high,
child: const Text( child: const PlatformText(
"High", "High",
), ),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: AudioQuality.low, value: AudioQuality.low,
child: const Text("Low"), child: const PlatformText("Low"),
), ),
], ],
onChanged: (value) { onChanged: (value) {
@ -279,10 +280,10 @@ class Settings extends HookConsumerWidget {
if (kIsMobile) if (kIsMobile)
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.download_for_offline_rounded), leading: const Icon(Icons.download_for_offline_rounded),
title: const Text( title: const PlatformText(
"Pre download and play", "Pre download and play",
), ),
subtitle: const Text( subtitle: const PlatformText(
"Instead of streaming audio, download bytes and play instead (Recommended for higher bandwidth users)", "Instead of streaming audio, download bytes and play instead (Recommended for higher bandwidth users)",
), ),
trailing: PlatformSwitch( trailing: PlatformSwitch(
@ -294,7 +295,7 @@ class Settings extends HookConsumerWidget {
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.fast_forward_rounded), leading: const Icon(Icons.fast_forward_rounded),
title: const Text( title: const PlatformText(
"Skip non-music segments (SponsorBlock)", "Skip non-music segments (SponsorBlock)",
), ),
trailing: PlatformSwitch( trailing: PlatformSwitch(
@ -304,20 +305,17 @@ class Settings extends HookConsumerWidget {
}, },
), ),
), ),
const Text( PlatformText(
" Search", " Search",
style: style: PlatformTextTheme.of(context)
TextStyle(fontWeight: FontWeight.bold, fontSize: 20), .headline
?.copyWith(fontWeight: FontWeight.bold),
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon(Icons.shopping_bag_rounded), leading: const Icon(Icons.shopping_bag_rounded),
title: Text( title: const PlatformText("Market Place"),
"Market Place", subtitle: PlatformText.caption(
style: Theme.of(context).textTheme.bodyText1,
),
subtitle: Text(
"Recommendation Country", "Recommendation Country",
style: Theme.of(context).textTheme.caption,
), ),
trailing: (context, update) => ConstrainedBox( trailing: (context, update) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 250), constraints: const BoxConstraints(maxWidth: 250),
@ -327,7 +325,7 @@ class Settings extends HookConsumerWidget {
.map( .map(
(country) => (PlatformDropDownMenuItem( (country) => (PlatformDropDownMenuItem(
value: country.first, value: country.first,
child: Text(country.last), child: PlatformText(country.last),
)), )),
) )
.toList(), .toList(),
@ -343,18 +341,21 @@ class Settings extends HookConsumerWidget {
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon(Icons.screen_search_desktop_rounded), leading: const Icon(Icons.screen_search_desktop_rounded),
title: const SizedBox( title: SizedBox(
height: 50, height: 50,
width: 200, width: 200,
child: Align( child: Align(
alignment: Alignment.centerLeft, alignment: Alignment.centerLeft,
child: AutoSizeText( child: DefaultTextStyle(
style: PlatformTextTheme.of(context).body!,
child: const AutoSizeText(
"Format of the YouTube Search term", "Format of the YouTube Search term",
maxLines: 2, maxLines: 2,
), ),
), ),
), ),
subtitle: const Text("(Case sensitive)"), ),
subtitle: const PlatformText("(Case sensitive)"),
breakOn: Breakpoints.lg, breakOn: Breakpoints.lg,
trailing: (context, update) => ConstrainedBox( trailing: (context, update) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 450), constraints: const BoxConstraints(maxWidth: 450),
@ -377,7 +378,7 @@ class Settings extends HookConsumerWidget {
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon(Icons.low_priority_rounded), leading: const Icon(Icons.low_priority_rounded),
title: const SizedBox( title: SizedBox(
height: 50, height: 50,
width: 180, width: 180,
child: Align( child: Align(
@ -385,6 +386,7 @@ class Settings extends HookConsumerWidget {
child: AutoSizeText( child: AutoSizeText(
"Track Match Algorithm", "Track Match Algorithm",
maxLines: 1, maxLines: 1,
style: PlatformTextTheme.of(context).body,
), ),
), ),
), ),
@ -394,19 +396,19 @@ class Settings extends HookConsumerWidget {
items: [ items: [
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: SpotubeTrackMatchAlgorithm.authenticPopular, value: SpotubeTrackMatchAlgorithm.authenticPopular,
child: const Text( child: const PlatformText(
"Popular from Author", "Popular from Author",
), ),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: SpotubeTrackMatchAlgorithm.popular, value: SpotubeTrackMatchAlgorithm.popular,
child: const Text( child: const PlatformText(
"Accurately Popular", "Accurately Popular",
), ),
), ),
PlatformDropDownMenuItem( PlatformDropDownMenuItem(
value: SpotubeTrackMatchAlgorithm.youtube, value: SpotubeTrackMatchAlgorithm.youtube,
child: const Text("YouTube's Top choice"), child: const PlatformText("YouTube's Top choice"),
), ),
], ],
onChanged: (value) { onChanged: (value) {
@ -417,15 +419,16 @@ class Settings extends HookConsumerWidget {
}, },
), ),
), ),
const Text( PlatformText(
" Downloads", " Downloads",
style: style: PlatformTextTheme.of(context)
TextStyle(fontWeight: FontWeight.bold, fontSize: 20), .headline
?.copyWith(fontWeight: FontWeight.bold),
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.file_download_outlined), leading: const Icon(Icons.file_download_outlined),
title: const Text("Download Location"), title: const PlatformText("Download Location"),
subtitle: Text(preferences.downloadLocation), subtitle: PlatformText(preferences.downloadLocation),
trailing: PlatformFilledButton( trailing: PlatformFilledButton(
onPressed: pickDownloadLocation, onPressed: pickDownloadLocation,
child: const Icon(Icons.folder_rounded), child: const Icon(Icons.folder_rounded),
@ -434,7 +437,8 @@ class Settings extends HookConsumerWidget {
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.lyrics_rounded), leading: const Icon(Icons.lyrics_rounded),
title: const Text("Download lyrics along with the Track"), title: const PlatformText(
"Download lyrics along with the Track"),
trailing: PlatformSwitch( trailing: PlatformSwitch(
value: preferences.saveTrackLyrics, value: preferences.saveTrackLyrics,
onChanged: (state) { onChanged: (state) {
@ -442,10 +446,11 @@ class Settings extends HookConsumerWidget {
}, },
), ),
), ),
const Text( PlatformText(
" About", " About",
style: style: PlatformTextTheme.of(context)
TextStyle(fontWeight: FontWeight.bold, fontSize: 20), .headline
?.copyWith(fontWeight: FontWeight.bold),
), ),
AdaptiveListTile( AdaptiveListTile(
leading: const Icon( leading: const Icon(
@ -487,14 +492,14 @@ class Settings extends HookConsumerWidget {
children: const [ children: const [
Icon(Icons.favorite_outline_rounded), Icon(Icons.favorite_outline_rounded),
SizedBox(width: 5), SizedBox(width: 5),
Text("Please Sponsor/Donate"), PlatformText("Please Sponsor/Donate"),
], ],
), ),
), ),
), ),
PlatformListTile( PlatformListTile(
leading: const Icon(Icons.update_rounded), leading: const Icon(Icons.update_rounded),
title: const Text("Check for Update"), title: const PlatformText("Check for Update"),
trailing: PlatformSwitch( trailing: PlatformSwitch(
value: preferences.checkUpdate, value: preferences.checkUpdate,
onChanged: (checked) => onChanged: (checked) =>

View File

@ -20,14 +20,14 @@ class Action extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (isExpanded != true) { if (isExpanded != true) {
return Tooltip( return PlatformIconButton(
message: text.toStringShallow().split(",").last.replaceAll(
"\"",
"",
),
child: PlatformIconButton(
icon: icon, icon: icon,
onPressed: onPressed, onPressed: onPressed,
tooltip: text is Text
? (text as Text).data
: text.toStringShallow().split(",").last.replaceAll(
"\"",
"",
), ),
); );
} }

View File

@ -1,5 +1,6 @@
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:platform_ui/platform_ui.dart';
class AnchorButton<T> extends HookWidget { class AnchorButton<T> extends HookWidget {
final String text; final String text;
@ -28,7 +29,7 @@ class AnchorButton<T> extends HookWidget {
onTap: onTap, onTap: onTap,
child: MouseRegion( child: MouseRegion(
cursor: MaterialStateMouseCursor.clickable, cursor: MaterialStateMouseCursor.clickable,
child: Text( child: PlatformText(
text, text,
style: style.copyWith( style: style.copyWith(
decoration: decoration:

View File

@ -33,7 +33,7 @@ class TitleBarActionButtons extends StatelessWidget {
}, },
style: ButtonStyle( style: ButtonStyle(
foregroundColor: MaterialStateProperty.all( foregroundColor: MaterialStateProperty.all(
Theme.of(context).iconTheme.color), PlatformTheme.of(context).iconTheme?.color),
), ),
child: Icon( child: Icon(
Icons.minimize_rounded, Icons.minimize_rounded,
@ -45,7 +45,7 @@ class TitleBarActionButtons extends StatelessWidget {
}, },
style: ButtonStyle( style: ButtonStyle(
foregroundColor: MaterialStateProperty.all( foregroundColor: MaterialStateProperty.all(
Theme.of(context).iconTheme.color), PlatformTheme.of(context).iconTheme?.color),
), ),
child: Icon( child: Icon(
Icons.crop_square_rounded, Icons.crop_square_rounded,
@ -57,7 +57,7 @@ class TitleBarActionButtons extends StatelessWidget {
}, },
style: ButtonStyle( style: ButtonStyle(
foregroundColor: MaterialStateProperty.all( foregroundColor: MaterialStateProperty.all(
color ?? Theme.of(context).iconTheme.color), color ?? PlatformTheme.of(context).iconTheme?.color),
overlayColor: MaterialStateProperty.all(Colors.redAccent), overlayColor: MaterialStateProperty.all(Colors.redAccent),
), ),
child: const Icon( child: const Icon(

View File

@ -77,6 +77,7 @@ class PlaybuttonCard extends HookWidget {
onTap: onTap, onTap: onTap,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
splashFactory: splash, splashFactory: splash,
highlightColor: Colors.black12,
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 200), constraints: const BoxConstraints(maxWidth: 200),
child: HoverBuilder(builder: (context, isHovering) { child: HoverBuilder(builder: (context, isHovering) {
@ -89,11 +90,10 @@ class PlaybuttonCard extends HookWidget {
boxShadow: [ boxShadow: [
if (boxShadow != null) boxShadow, if (boxShadow != null) boxShadow,
], ],
border: platform == TargetPlatform.windows border: [TargetPlatform.windows, TargetPlatform.macOS]
.contains(platform)
? Border.all( ? Border.all(
color: FluentUI.FluentTheme.maybeOf(context) color: PlatformTheme.of(context).borderColor ??
?.micaBackgroundColor
.withOpacity(.7) ??
Colors.transparent, Colors.transparent,
width: 1, width: 1,
) )

View File

@ -132,9 +132,9 @@ class TrackCollectionView<T> extends HookConsumerWidget {
primary: true, primary: true,
backgroundColor: color?.color, backgroundColor: color?.color,
title: collapsed.value title: collapsed.value
? Text( ? PlatformText.headline(
title, title,
style: Theme.of(context).textTheme.headline4?.copyWith( style: TextStyle(
color: color?.titleTextColor, color: color?.titleTextColor,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
@ -188,23 +188,17 @@ class TrackCollectionView<T> extends HookConsumerWidget {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment.spaceBetween,
children: [ children: [
Text( PlatformText.headline(
title, title,
style: Theme.of(context) style: TextStyle(
.textTheme
.headline4
?.copyWith(
color: color?.titleTextColor, color: color?.titleTextColor,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
), ),
), ),
if (description != null) if (description != null)
Text( PlatformText(
description!, description!,
style: Theme.of(context) style: TextStyle(
.textTheme
.bodyLarge
?.copyWith(
color: color?.bodyTextColor, color: color?.bodyTextColor,
), ),
maxLines: 2, maxLines: 2,
@ -232,7 +226,7 @@ class TrackCollectionView<T> extends HookConsumerWidget {
} else if (tracksSnapshot.hasError && } else if (tracksSnapshot.hasError &&
tracksSnapshot.isError) { tracksSnapshot.isError) {
return SliverToBoxAdapter( return SliverToBoxAdapter(
child: Text("Error ${tracksSnapshot.error}")); child: PlatformText("Error ${tracksSnapshot.error}"));
} }
final tracks = tracksSnapshot.data!; final tracks = tracksSnapshot.data!;

View File

@ -74,7 +74,7 @@ class TrackTile extends HookConsumerWidget {
SnackBar( SnackBar(
width: 300, width: 300,
behavior: SnackBarBehavior.floating, behavior: SnackBarBehavior.floating,
content: Text( content: PlatformText(
"Copied $data to clipboard", "Copied $data to clipboard",
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
@ -98,7 +98,7 @@ class TrackTile extends HookConsumerWidget {
return HookBuilder(builder: (context) { return HookBuilder(builder: (context) {
final playlistsCheck = useState(<String, bool>{}); final playlistsCheck = useState(<String, bool>{});
return AlertDialog( return AlertDialog(
title: Text( title: PlatformText(
"Add `${track.value.name}` to following Playlists"), "Add `${track.value.name}` to following Playlists"),
titleTextStyle: titleTextStyle:
Theme.of(context).textTheme.bodyText1?.copyWith( Theme.of(context).textTheme.bodyText1?.copyWith(
@ -107,11 +107,11 @@ class TrackTile extends HookConsumerWidget {
), ),
actions: [ actions: [
PlatformTextButton( PlatformTextButton(
child: const Text("Cancel"), child: const PlatformText("Cancel"),
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),
), ),
PlatformFilledButton( PlatformFilledButton(
child: const Text("Add"), child: const PlatformText("Add"),
onPressed: () async { onPressed: () async {
final selectedPlaylists = playlistsCheck final selectedPlaylists = playlistsCheck
.value.entries .value.entries
@ -140,7 +140,7 @@ class TrackTile extends HookConsumerWidget {
final playlist = final playlist =
snapshot.data!.elementAt(index); snapshot.data!.elementAt(index);
return CheckboxListTile( return CheckboxListTile(
title: Text(playlist.name!), title: PlatformText(playlist.name!),
controlAffinity: controlAffinity:
ListTileControlAffinity.leading, ListTileControlAffinity.leading,
value: playlistsCheck.value[playlist.id] ?? value: playlistsCheck.value[playlist.id] ??
@ -191,7 +191,7 @@ class TrackTile extends HookConsumerWidget {
height: 20, height: 20,
width: 25, width: 25,
child: Center( child: Center(
child: Text((track.key + 1).toString()), child: PlatformText((track.key + 1).toString()),
), ),
), ),
Padding( Padding(
@ -221,7 +221,7 @@ class TrackTile extends HookConsumerWidget {
playback.track?.id == track.value.id playback.track?.id == track.value.id
? Icons.pause_circle_rounded ? Icons.pause_circle_rounded
: Icons.play_circle_rounded, : Icons.play_circle_rounded,
color: Theme.of(context).primaryColor, color: PlatformTheme.of(context).primaryColor,
), ),
onPressed: () => onTrackPlayButtonPressed?.call( onPressed: () => onTrackPlayButtonPressed?.call(
track.value, track.value,
@ -231,7 +231,7 @@ class TrackTile extends HookConsumerWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( PlatformText(
track.value.name ?? "", track.value.name ?? "",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -240,7 +240,7 @@ class TrackTile extends HookConsumerWidget {
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
isReallyLocal isReallyLocal
? Text( ? PlatformText(
TypeConversionUtils.artists_X_String<Artist>( TypeConversionUtils.artists_X_String<Artist>(
track.value.artists ?? []), track.value.artists ?? []),
) )
@ -256,7 +256,7 @@ class TrackTile extends HookConsumerWidget {
if (breakpoint.isMoreThan(Breakpoints.md) && showAlbum) if (breakpoint.isMoreThan(Breakpoints.md) && showAlbum)
Expanded( Expanded(
child: isReallyLocal child: isReallyLocal
? Text(track.value.album?.name ?? "") ? PlatformText(track.value.album?.name ?? "")
: LinkText( : LinkText(
track.value.album!.name!, track.value.album!.name!,
"/album/${track.value.album?.id}", "/album/${track.value.album?.id}",
@ -266,7 +266,7 @@ class TrackTile extends HookConsumerWidget {
), ),
if (!breakpoint.isSm) ...[ if (!breakpoint.isSm) ...[
const SizedBox(width: 10), const SizedBox(width: 10),
Text(duration), PlatformText(duration),
], ],
const SizedBox(width: 10), const SizedBox(width: 10),
if (!isReallyLocal) if (!isReallyLocal)
@ -280,7 +280,7 @@ class TrackTile extends HookConsumerWidget {
color: Colors.pink, color: Colors.pink,
) )
: const Icon(Icons.favorite_border_rounded), : const Icon(Icons.favorite_border_rounded),
text: const Text("Save as favorite"), text: const PlatformText("Save as favorite"),
onPressed: () { onPressed: () {
toggler.item2.mutate(Tuple2(spotify, toggler.item1)); toggler.item2.mutate(Tuple2(spotify, toggler.item1));
}, },
@ -288,18 +288,18 @@ class TrackTile extends HookConsumerWidget {
if (auth.isLoggedIn) if (auth.isLoggedIn)
Action( Action(
icon: const Icon(Icons.add_box_rounded), icon: const Icon(Icons.add_box_rounded),
text: const Text("Add To playlist"), text: const PlatformText("Add To playlist"),
onPressed: actionAddToPlaylist, onPressed: actionAddToPlaylist,
), ),
if (userPlaylist && auth.isLoggedIn) if (userPlaylist && auth.isLoggedIn)
Action( Action(
icon: const Icon(Icons.remove_circle_outline_rounded), icon: const Icon(Icons.remove_circle_outline_rounded),
text: const Text("Remove from playlist"), text: const PlatformText("Remove from playlist"),
onPressed: actionRemoveFromPlaylist, onPressed: actionRemoveFromPlaylist,
), ),
Action( Action(
icon: const Icon(Icons.share_rounded), icon: const Icon(Icons.share_rounded),
text: const Text("Share"), text: const PlatformText("Share"),
onPressed: () { onPressed: () {
actionShare(track.value); actionShare(track.value);
}, },

View File

@ -82,7 +82,7 @@ class TracksTableView extends HookConsumerWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: PlatformText(
"#", "#",
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: tableHeadStyle, style: tableHeadStyle,
@ -91,7 +91,7 @@ class TracksTableView extends HookConsumerWidget {
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
Text( PlatformText(
"Title", "Title",
style: tableHeadStyle, style: tableHeadStyle,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -105,7 +105,7 @@ class TracksTableView extends HookConsumerWidget {
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
Text( PlatformText(
"Album", "Album",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: tableHeadStyle, style: tableHeadStyle,
@ -116,7 +116,7 @@ class TracksTableView extends HookConsumerWidget {
], ],
if (!breakpoint.isSm) ...[ if (!breakpoint.isSm) ...[
const SizedBox(width: 10), const SizedBox(width: 10),
Text("Time", style: tableHeadStyle), PlatformText("Time", style: tableHeadStyle),
const SizedBox(width: 10), const SizedBox(width: 10),
], ],
SortTracksDropdown( SortTracksDropdown(
@ -135,7 +135,7 @@ class TracksTableView extends HookConsumerWidget {
child: Row( child: Row(
children: [ children: [
const Icon(Icons.file_download_outlined), const Icon(Icons.file_download_outlined),
Text( PlatformText(
"Download ${selectedTracks.isNotEmpty ? "(${selectedTracks.length})" : ""}", "Download ${selectedTracks.isNotEmpty ? "(${selectedTracks.length})" : ""}",
), ),
], ],

View File

@ -201,7 +201,7 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
}; };
}, []); }, []);
platform = TargetPlatform.windows; platform = TargetPlatform.macOS;
return PlatformApp.router( return PlatformApp.router(
routeInformationParser: router.routeInformationParser, routeInformationParser: router.routeInformationParser,

View File

@ -134,14 +134,17 @@ final windowsDarkTheme = FluentUI.ThemeData.dark().copyWith(
), ),
); );
final macosTheme = MacosThemeData.light().copyWith( final macosTheme = MacosThemeData.light().copyWith(
pushButtonTheme: PushButtonThemeData( pushButtonTheme: const PushButtonThemeData(
secondaryColor: Colors.white, secondaryColor: Colors.white,
), ),
iconTheme: MacosIconThemeData(size: 16), iconTheme: const MacosIconThemeData(size: 14),
iconButtonTheme: MacosIconButtonThemeData(), typography: MacosTypography(color: Colors.grey[900]!),
typography: MacosTypography(color: Colors.green),
); );
final macosDarkTheme = MacosThemeData.dark().copyWith( final macosDarkTheme = MacosThemeData.dark().copyWith(
typography: MacosTypography(color: Colors.red), pushButtonTheme: const PushButtonThemeData(
secondaryColor: Colors.white,
),
iconTheme: const MacosIconThemeData(size: 14),
typography: MacosTypography(color: MacosColors.textColor),
); );
final iosTheme = CupertinoThemeData(); final iosTheme = CupertinoThemeData();