Improved read filters
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:quds_popup_menu/quds_popup_menu.dart';
|
||||
import 'package:linkdy/screens/bookmarks/ui/visualization_modal.dart';
|
||||
|
||||
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||
import 'package:linkdy/screens/bookmarks/ui/bookmark_item.dart';
|
||||
@@ -124,76 +124,47 @@ class BookmarksScreen extends ConsumerWidget {
|
||||
icon: const Icon(Icons.search_rounded),
|
||||
tooltip: t.bookmarks.search.searchBookmarks,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
QudsPopupButton(
|
||||
radius: 22,
|
||||
backgroundColor: Theme.of(context).popupMenuTheme.surfaceTintColor,
|
||||
items: [
|
||||
QudsPopupMenuItem(
|
||||
leading: const Icon(Icons.archive_rounded),
|
||||
title: Text(t.bookmarks.archived),
|
||||
onPressed: () => ref.read(routerProvider).push(RoutesPaths.archivedBookmarks),
|
||||
PopupMenuButton(
|
||||
itemBuilder: (context) => <PopupMenuEntry>[
|
||||
PopupMenuItem(
|
||||
onTap: () => ref.read(routerProvider).push(RoutesPaths.archivedBookmarks),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.archive_rounded),
|
||||
const SizedBox(width: 16),
|
||||
Text(t.bookmarks.archived),
|
||||
],
|
||||
),
|
||||
),
|
||||
QudsPopupMenuItem(
|
||||
leading: const Icon(Icons.share_rounded),
|
||||
title: Text(t.bookmarks.shared),
|
||||
onPressed: () => ref.read(routerProvider).push(RoutesPaths.sharedBookmarks),
|
||||
PopupMenuItem(
|
||||
onTap: () => ref.read(routerProvider).push(RoutesPaths.sharedBookmarks),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.share_rounded),
|
||||
const SizedBox(width: 16),
|
||||
Text(t.bookmarks.shared),
|
||||
],
|
||||
),
|
||||
),
|
||||
QudsPopupMenuDivider(),
|
||||
QudsPopupMenuSection(
|
||||
leading: const Icon(Icons.list_rounded),
|
||||
titleText: t.bookmarks.readStatus,
|
||||
subTitle: Text(readStatus()),
|
||||
subItems: [
|
||||
QudsPopupMenuItem(
|
||||
leading: const Icon(Icons.list_rounded),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: Text(t.bookmarks.showAllBookmarks)),
|
||||
if (bookmarks.readStatus == ReadStatus.all) ...[
|
||||
const SizedBox(width: 8),
|
||||
const Icon(Icons.check_rounded),
|
||||
],
|
||||
],
|
||||
),
|
||||
onPressed: () => ref.read(bookmarksProvider.notifier).setReadStatus(ReadStatus.all),
|
||||
),
|
||||
QudsPopupMenuItem(
|
||||
leading: const Icon(Icons.mark_as_unread_rounded),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: Text(t.bookmarks.showOnlyUnread)),
|
||||
if (bookmarks.readStatus == ReadStatus.unread) ...[
|
||||
const SizedBox(width: 8),
|
||||
const Icon(Icons.check_rounded),
|
||||
],
|
||||
],
|
||||
),
|
||||
onPressed: () => ref.read(bookmarksProvider.notifier).setReadStatus(ReadStatus.unread),
|
||||
),
|
||||
QudsPopupMenuItem(
|
||||
leading: const Icon(Icons.mark_email_read_rounded),
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(child: Text(t.bookmarks.showOnlyRead)),
|
||||
if (bookmarks.readStatus == ReadStatus.read) ...[
|
||||
const SizedBox(width: 8),
|
||||
const Icon(Icons.check_rounded),
|
||||
],
|
||||
],
|
||||
),
|
||||
onPressed: () => ref.read(bookmarksProvider.notifier).setReadStatus(ReadStatus.read),
|
||||
),
|
||||
],
|
||||
const PopupMenuDivider(height: 1),
|
||||
PopupMenuItem(
|
||||
onTap: () => showModalBottomSheet(
|
||||
context: context,
|
||||
useRootNavigator: true,
|
||||
builder: (context) => const VisualizationModal(),
|
||||
isScrollControlled: true,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.sort_rounded),
|
||||
const SizedBox(width: 16),
|
||||
Text(t.bookmarks.filterSort),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
tooltip: t.generic.options,
|
||||
child: const Icon(Icons.more_vert_rounded),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
96
lib/screens/bookmarks/ui/visualization_modal.dart
Normal file
96
lib/screens/bookmarks/ui/visualization_modal.dart
Normal file
@@ -0,0 +1,96 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:segmented_button_slide/segmented_button_slide.dart';
|
||||
|
||||
import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
|
||||
import 'package:linkdy/widgets/section_label.dart';
|
||||
|
||||
import 'package:linkdy/constants/enums.dart';
|
||||
import 'package:linkdy/i18n/strings.g.dart';
|
||||
|
||||
class VisualizationModal extends ConsumerWidget {
|
||||
const VisualizationModal({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return Padding(
|
||||
padding: MediaQuery.of(context).viewInsets,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.only(
|
||||
topLeft: Radius.circular(28),
|
||||
topRight: Radius.circular(28),
|
||||
),
|
||||
color: Theme.of(context).dialogBackgroundColor,
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.sort_rounded,
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
size: 24,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
t.bookmarks.filterSort,
|
||||
style: const TextStyle(
|
||||
fontSize: 24,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SectionLabel(
|
||||
label: t.bookmarks.readStatus,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 0,
|
||||
vertical: 16,
|
||||
),
|
||||
),
|
||||
SegmentedButtonSlide(
|
||||
entries: [
|
||||
SegmentedButtonSlideEntry(label: t.bookmarks.all),
|
||||
SegmentedButtonSlideEntry(label: t.bookmarks.unread),
|
||||
SegmentedButtonSlideEntry(label: t.bookmarks.read),
|
||||
],
|
||||
selectedEntry: ref.watch(bookmarksProvider).readStatus.index,
|
||||
onChange: (v) => ref.read(bookmarksProvider.notifier).setReadStatus(ReadStatus.values[v]),
|
||||
colors: SegmentedButtonSlideColors(
|
||||
barColor: Theme.of(context).colorScheme.primary.withOpacity(0.2),
|
||||
backgroundSelectedColor: Theme.of(context).colorScheme.primary,
|
||||
foregroundSelectedColor: Theme.of(context).colorScheme.onPrimary,
|
||||
foregroundUnselectedColor: Theme.of(context).colorScheme.onSurface,
|
||||
hoverColor: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 24),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Text(t.generic.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user