Skip to content

Commit

Permalink
Merge pull request #436 from KRTirtho/disect-platform_ui
Browse files Browse the repository at this point in the history
Removal of platform UI 😢
  • Loading branch information
KRTirtho authored Mar 10, 2023
2 parents cfa9e04 + a25bc9a commit b836495
Show file tree
Hide file tree
Showing 67 changed files with 1,206 additions and 2,019 deletions.
12 changes: 6 additions & 6 deletions lib/collections/spotube_icons.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:fluent_ui/fluent_ui.dart';
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
import 'package:flutter/material.dart';
import 'package:flutter_feather_icons/flutter_feather_icons.dart';

abstract class SpotubeIcons {
static const home = FluentIcons.home;
static const home = FluentIcons.home_12_regular;
static const search = FeatherIcons.search;
static const library = FluentIcons.library;
static const library = FluentIcons.library_16_regular;
static const music = FeatherIcons.music;
static const play = FluentIcons.play;
static const play = FluentIcons.play_12_regular;
static const pause = FeatherIcons.pause;
static const skipForward = FeatherIcons.skipForward;
static const skipBack = FeatherIcons.skipBack;
Expand All @@ -16,8 +16,8 @@ abstract class SpotubeIcons {
static const refresh = FeatherIcons.refreshCw;
static const settings = FeatherIcons.settings;
static const shuffle = FeatherIcons.shuffle;
static const repeat = FluentIcons.repeat_all;
static const repeatOne = FluentIcons.repeat_one;
static const repeat = FluentIcons.arrow_repeat_all_16_regular;
static const repeatOne = Icons.repeat_one_rounded;
static const remove = FeatherIcons.minus;
static const removeFilled = FeatherIcons.minusCircle;
static const add = FeatherIcons.plus;
Expand Down
66 changes: 12 additions & 54 deletions lib/components/artist/artist_card.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
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:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotify/spotify.dart';
import 'package:spotube/components/shared/hover_builder.dart';
import 'package:spotube/components/shared/image/universal_image.dart';
import 'package:spotube/hooks/use_platform_property.dart';
import 'package:spotube/provider/blacklist_provider.dart';
import 'package:spotube/utils/service_utils.dart';
import 'package:spotube/utils/type_conversion_utils.dart';
Expand All @@ -30,75 +28,35 @@ class ArtistCard extends HookConsumerWidget {
),
),
);
final boxShadow = usePlatformProperty<BoxShadow?>(
(context) => PlatformProperty(
android: BoxShadow(
blurRadius: 10,
offset: const Offset(0, 3),
spreadRadius: 5,
color: Theme.of(context).colorScheme.shadow,
),
ios: null,
macos: null,
linux: BoxShadow(
blurRadius: 6,
color: Theme.of(context).shadowColor.withOpacity(0.3),
),
windows: null,
),
);

final splash = usePlatformProperty<InteractiveInkFeatureFactory?>(
(context) => PlatformProperty.only(
android: InkRipple.splashFactory,
other: NoSplash.splashFactory,
),
);

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,
),
borderRadius: BorderRadius.circular(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,
),
color: Theme.of(context).cardColor,
borderRadius: BorderRadius.circular(8),
boxShadow: [
if (boxShadow != null) boxShadow,
BoxShadow(
blurRadius: 10,
offset: const Offset(0, 3),
spreadRadius: 5,
color: Theme.of(context).colorScheme.shadow,
),
],
border: isBlackListed
? Border.all(
color: Colors.red[400]!,
width: 2,
)
: [TargetPlatform.windows, TargetPlatform.macOS]
.contains(platform)
? Border.all(
color: PlatformTheme.of(context).borderColor ??
Colors.transparent,
width: 1,
)
: null,
: null,
),
child: Padding(
padding: const EdgeInsets.all(15),
Expand Down Expand Up @@ -138,7 +96,7 @@ class ArtistCard extends HookConsumerWidget {
artist.name!,
maxLines: 2,
textAlign: TextAlign.center,
style: PlatformTextTheme.of(context).body?.copyWith(
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.bold,
),
),
Expand Down
24 changes: 14 additions & 10 deletions lib/components/desktop_login/login_form.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotube/provider/authentication_provider.dart';

class TokenLoginForm extends HookConsumerWidget {
Expand All @@ -25,27 +25,31 @@ class TokenLoginForm extends HookConsumerWidget {
),
child: Column(
children: [
PlatformTextField(
TextField(
controller: directCodeController,
placeholder: "Spotify \"sp_dc\" Cookie",
label: "sp_dc Cookie",
decoration: const InputDecoration(
hintText: "Spotify \"sp_dc\" Cookie",
labelText: "sp_dc Cookie",
),
keyboardType: TextInputType.visiblePassword,
),
const SizedBox(height: 10),
PlatformTextField(
TextField(
controller: keyCodeController,
placeholder: "Spotify \"sp_key\" Cookie",
label: "sp_key Cookie",
decoration: const InputDecoration(
hintText: "Spotify \"sp_key\" Cookie",
labelText: "sp_key Cookie",
),
keyboardType: TextInputType.visiblePassword,
),
const SizedBox(height: 20),
PlatformFilledButton(
FilledButton(
onPressed: () async {
if (keyCodeController.text.isEmpty ||
directCodeController.text.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: PlatformText("Please fill in all fields"),
content: Text("Please fill in all fields"),
behavior: SnackBarBehavior.floating,
),
);
Expand All @@ -61,7 +65,7 @@ class TokenLoginForm extends HookConsumerWidget {
onDone?.call();
}
},
child: const PlatformText("Submit"),
child: const Text("Submit"),
)
],
),
Expand Down
10 changes: 6 additions & 4 deletions lib/components/genre/category_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart' hide Page;
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotify/spotify.dart';
import 'package:spotube/components/shared/shimmers/shimmer_playbutton_card.dart';
import 'package:spotube/components/shared/waypoint.dart';
Expand Down Expand Up @@ -39,13 +39,15 @@ class CategoryCard extends HookConsumerWidget {
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
PlatformText.headline(category.name ?? "Unknown"),
Text(
category.name ?? "Unknown",
style: Theme.of(context).textTheme.titleLarge,
),
],
),
),
playlistQuery.hasPageError && !playlistQuery.hasPageData
? PlatformText(
"Something Went Wrong\n${playlistQuery.errors.first}")
? Text("Something Went Wrong\n${playlistQuery.errors.first}")
: SizedBox(
height: 245,
child: ScrollConfiguration(
Expand Down
13 changes: 7 additions & 6 deletions lib/components/library/user_albums.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:collection/collection.dart';
import 'package:fuzzywuzzy/fuzzywuzzy.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/album/album_card.dart';
import 'package:spotube/components/shared/playbutton_card.dart';
Expand Down Expand Up @@ -65,16 +65,17 @@ class UserAlbums extends HookConsumerWidget {
physics: const AlwaysScrollableScrollPhysics(),
child: Material(
type: MaterialType.transparency,
textStyle: PlatformTheme.of(context).textTheme!.body!,
color: PlatformTheme.of(context).scaffoldBackgroundColor,
color: Theme.of(context).scaffoldBackgroundColor,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
PlatformTextField(
TextField(
onChanged: (value) => searchText.value = value,
prefixIcon: SpotubeIcons.filter,
placeholder: 'Filter Albums...',
decoration: const InputDecoration(
prefixIcon: Icon(SpotubeIcons.filter),
hintText: 'Filter albums...',
),
),
const SizedBox(height: 20),
Wrap(
Expand Down
18 changes: 10 additions & 8 deletions lib/components/library/user_artists.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:collection/collection.dart';
import 'package:fuzzywuzzy/fuzzywuzzy.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotify/spotify.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/shared/fallbacks/anonymous_fallback.dart';
Expand Down Expand Up @@ -56,25 +56,27 @@ class UserArtists extends HookConsumerWidget {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: ColoredBox(
color: PlatformTheme.of(context).scaffoldBackgroundColor!,
child: PlatformTextField(
color: Theme.of(context).scaffoldBackgroundColor,
child: TextField(
onChanged: (value) => searchText.value = value,
prefixIcon: SpotubeIcons.filter,
placeholder: 'Filter artists...',
decoration: const InputDecoration(
prefixIcon: Icon(SpotubeIcons.filter),
hintText: 'Filter artists...',
),
),
),
),
),
backgroundColor: PlatformTheme.of(context).scaffoldBackgroundColor,
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
body: artistQuery.pages.isEmpty
? Padding(
padding: const EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: const [
PlatformCircularProgressIndicator(),
CircularProgressIndicator(),
SizedBox(width: 10),
PlatformText("Loading..."),
Text("Loading..."),
],
),
)
Expand Down
19 changes: 9 additions & 10 deletions lib/components/library/user_downloads.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotify/spotify.dart';
import 'package:spotube/components/shared/image/universal_image.dart';
import 'package:spotube/provider/downloader_provider.dart';
Expand All @@ -26,20 +26,19 @@ class UserDownloads extends HookConsumerWidget {
child: AutoSizeText(
"Currently downloading (${downloader.currentlyRunning})",
maxLines: 1,
style: PlatformTextTheme.of(context).headline,
style: Theme.of(context).textTheme.headlineMedium,
),
),
const SizedBox(width: 10),
PlatformFilledButton(
style: ButtonStyle(
backgroundColor: MaterialStatePropertyAll(Colors.red[50]),
foregroundColor: MaterialStatePropertyAll(Colors.red[400]),
FilledButton(
style: FilledButton.styleFrom(
backgroundColor: Colors.red[50],
foregroundColor: Colors.red[400],
),
onPressed: downloader.currentlyRunning > 0
? downloader.cancelAll
: null,
isSecondary: true,
child: const PlatformText("Cancel All"),
child: const Text("Cancel All"),
),
],
),
Expand All @@ -49,7 +48,7 @@ class UserDownloads extends HookConsumerWidget {
itemCount: downloader.inQueue.length,
itemBuilder: (context, index) {
final track = downloader.inQueue.elementAt(index);
return PlatformListTile(
return ListTile(
title: Text(track.name ?? ''),
leading: Padding(
padding: const EdgeInsets.symmetric(horizontal: 5),
Expand All @@ -68,7 +67,7 @@ class UserDownloads extends HookConsumerWidget {
trailing: const SizedBox(
width: 30,
height: 30,
child: PlatformCircularProgressIndicator(),
child: CircularProgressIndicator(),
),
subtitle: Text(
TypeConversionUtils.artists_X_String(
Expand Down
6 changes: 3 additions & 3 deletions lib/components/library/user_local_tracks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:mime/mime.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:platform_ui/platform_ui.dart';

import 'package:spotify/spotify.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/shared/compact_search.dart';
Expand Down Expand Up @@ -189,7 +189,7 @@ class UserLocalTracks extends HookConsumerWidget {
child: Row(
children: [
const SizedBox(width: 10),
PlatformFilledButton(
FilledButton(
onPressed: trackSnapshot.value != null
? () {
if (trackSnapshot.value?.isNotEmpty == true) {
Expand Down Expand Up @@ -221,7 +221,7 @@ class UserLocalTracks extends HookConsumerWidget {
},
),
const SizedBox(width: 10),
PlatformFilledButton(
FilledButton(
child: const Icon(SpotubeIcons.refresh),
onPressed: () {
ref.refresh(localTracksProvider);
Expand Down
Loading

0 comments on commit b836495

Please sign in to comment.