mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
refactor(blacklist): blacklist page instead of dialog
This commit is contained in:
parent
947c14353e
commit
d495709c99
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:spotify/spotify.dart' hide Search;
|
||||
import 'package:spotube/pages/settings/blacklist.dart';
|
||||
import 'package:spotube/pages/settings/about.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
import 'package:spotube/components/shared/spotube_page_route.dart';
|
||||
@ -56,6 +57,12 @@ final router = GoRouter(
|
||||
child: const SettingsPage(),
|
||||
),
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: "blacklist",
|
||||
pageBuilder: (context, state) => SpotubePage(
|
||||
child: const BlackListPage(),
|
||||
),
|
||||
),
|
||||
GoRoute(
|
||||
path: "about",
|
||||
pageBuilder: (context, state) => SpotubePage(
|
||||
|
@ -7,7 +7,6 @@ import 'package:spotube/utils/platform.dart';
|
||||
class PageWindowTitleBar extends StatefulHookWidget with PreferredSizeWidget {
|
||||
final Widget? leading;
|
||||
final bool automaticallyImplyLeading;
|
||||
final Widget? title;
|
||||
final List<Widget>? actions;
|
||||
final Color? backgroundColor;
|
||||
final Color? foregroundColor;
|
||||
@ -24,7 +23,6 @@ class PageWindowTitleBar extends StatefulHookWidget with PreferredSizeWidget {
|
||||
|
||||
PageWindowTitleBar({
|
||||
Key? key,
|
||||
this.title,
|
||||
this.actions,
|
||||
this.center,
|
||||
this.toolbarOpacity = 1,
|
||||
|
@ -100,10 +100,10 @@ class ShimmerTrackTile extends StatelessWidget {
|
||||
child: CustomPaint(
|
||||
size: const Size(double.infinity, 50),
|
||||
painter: ShimmerTrackTilePainter(
|
||||
background: shimmerTheme?.shimmerBackgroundColor ??
|
||||
background: shimmerTheme.shimmerBackgroundColor ??
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
foreground:
|
||||
shimmerTheme?.shimmerColor ?? Theme.of(context).cardColor,
|
||||
shimmerTheme.shimmerColor ?? Theme.of(context).cardColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -18,7 +18,7 @@ class AboutSpotube extends HookConsumerWidget {
|
||||
return PlatformScaffold(
|
||||
appBar: PageWindowTitleBar(
|
||||
leading: const PlatformBackButton(),
|
||||
title: const PlatformText("About Wives"),
|
||||
center: const PlatformText("About Spotube"),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
|
@ -4,11 +4,12 @@ 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/components/shared/page_window_title_bar.dart';
|
||||
import 'package:spotube/provider/blacklist_provider.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
class BlackListDialog extends HookConsumerWidget {
|
||||
const BlackListDialog({Key? key}) : super(key: key);
|
||||
class BlackListPage extends HookConsumerWidget {
|
||||
const BlackListPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, ref) {
|
||||
@ -33,13 +34,19 @@ class BlackListDialog extends HookConsumerWidget {
|
||||
[blacklist, searchText.value],
|
||||
);
|
||||
|
||||
return PlatformAlertDialog(
|
||||
title: const PlatformText("Blacklist"),
|
||||
content: Column(
|
||||
return PlatformScaffold(
|
||||
appBar: PageWindowTitleBar(
|
||||
center: const PlatformText("Blacklist"),
|
||||
centerTitle: true,
|
||||
leading: const PlatformBackButton(),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
padding: platform == TargetPlatform.windows
|
||||
? const EdgeInsets.all(8.0).copyWith(left: 45)
|
||||
: const EdgeInsets.all(8.0),
|
||||
child: PlatformTextField(
|
||||
onChanged: (value) => searchText.value = value,
|
||||
placeholder: "Search",
|
||||
@ -51,12 +58,11 @@ class BlackListDialog extends HookConsumerWidget {
|
||||
itemCount: filteredBlacklist.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = filteredBlacklist.elementAt(index);
|
||||
return ListTile(
|
||||
return PlatformListTile(
|
||||
leading: PlatformText("${index + 1}."),
|
||||
minLeadingWidth: 20,
|
||||
title: PlatformText("${item.name} (${item.type.name})"),
|
||||
subtitle: PlatformText.caption(item.id),
|
||||
trailing: IconButton(
|
||||
trailing: PlatformIconButton(
|
||||
icon: Icon(Icons.delete_forever_rounded,
|
||||
color: Colors.red[400]),
|
||||
onPressed: () {
|
@ -5,7 +5,6 @@ import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:platform_ui/platform_ui.dart';
|
||||
import 'package:spotube/components/settings/blacklist_dialog.dart';
|
||||
import 'package:spotube/components/settings/color_scheme_picker_dialog.dart';
|
||||
import 'package:spotube/components/shared/adaptive/adaptive_list_tile.dart';
|
||||
import 'package:spotube/components/shared/page_window_title_bar.dart';
|
||||
@ -339,19 +338,14 @@ class SettingsPage extends HookConsumerWidget {
|
||||
),
|
||||
PlatformListTile(
|
||||
leading: const Icon(Icons.playlist_remove_rounded),
|
||||
title: const PlatformText(
|
||||
"Track/Artist Blacklist",
|
||||
title: const PlatformText("Blacklist"),
|
||||
subtitle: const PlatformText(
|
||||
"Blacklisted tracks and artists",
|
||||
),
|
||||
onTap: () {
|
||||
showPlatformAlertDialog(
|
||||
context,
|
||||
barrierDismissible: true,
|
||||
builder: (context) {
|
||||
return const BlackListDialog();
|
||||
GoRouter.of(context).push("/settings/blacklist");
|
||||
},
|
||||
);
|
||||
},
|
||||
trailing: const Icon(Icons.open_in_new_rounded),
|
||||
trailing: const Icon(Icons.chevron_right_rounded),
|
||||
),
|
||||
PlatformText(
|
||||
" Search",
|
||||
|
Loading…
Reference in New Issue
Block a user