diff --git a/lib/i18n/strings.g.dart b/lib/i18n/strings.g.dart index 41ac2cc..7021c32 100644 --- a/lib/i18n/strings.g.dart +++ b/lib/i18n/strings.g.dart @@ -4,9 +4,9 @@ /// To regenerate, run: `dart run slang` /// /// Locales: 2 -/// Strings: 348 (174 per locale) +/// Strings: 350 (175 per locale) /// -/// Built on 2024-02-28 at 14:44 UTC +/// Built on 2024-02-28 at 16:02 UTC // coverage:ignore-file // ignore_for_file: type=lint @@ -234,6 +234,7 @@ class _StringsBookmarksEn { String get all => 'All'; String get unread => 'Unread'; String get read => 'Read'; + String get filterSort => 'Filter and sort'; late final _StringsBookmarksAddBookmarkEn addBookmark = _StringsBookmarksAddBookmarkEn._(_root); late final _StringsBookmarksSearchEn search = _StringsBookmarksSearchEn._(_root); late final _StringsBookmarksBookmarkOptionsEn bookmarkOptions = _StringsBookmarksBookmarkOptionsEn._(_root); @@ -604,6 +605,7 @@ class _StringsBookmarksEs implements _StringsBookmarksEn { @override String get all => 'Todos'; @override String get unread => 'No leídos'; @override String get read => 'Leídos'; + @override String get filterSort => 'Filtrar y ordenar'; @override late final _StringsBookmarksAddBookmarkEs addBookmark = _StringsBookmarksAddBookmarkEs._(_root); @override late final _StringsBookmarksSearchEs search = _StringsBookmarksSearchEs._(_root); @override late final _StringsBookmarksBookmarkOptionsEs bookmarkOptions = _StringsBookmarksBookmarkOptionsEs._(_root); @@ -923,6 +925,7 @@ extension on Translations { case 'bookmarks.all': return 'All'; case 'bookmarks.unread': return 'Unread'; case 'bookmarks.read': return 'Read'; + case 'bookmarks.filterSort': return 'Filter and sort'; case 'bookmarks.addBookmark.addBookmark': return 'Add new bookmark'; case 'bookmarks.addBookmark.editBookmark': return 'Edit bookmark'; case 'bookmarks.addBookmark.bookmarkUrl': return 'Bookmark URL'; @@ -1105,6 +1108,7 @@ extension on _StringsEs { case 'bookmarks.all': return 'Todos'; case 'bookmarks.unread': return 'No leídos'; case 'bookmarks.read': return 'Leídos'; + case 'bookmarks.filterSort': return 'Filtrar y ordenar'; case 'bookmarks.addBookmark.addBookmark': return 'Añadir nuevo marcador'; case 'bookmarks.addBookmark.editBookmark': return 'Editar marcador'; case 'bookmarks.addBookmark.url': return 'URL'; diff --git a/lib/i18n/strings_en.i18n.json b/lib/i18n/strings_en.i18n.json index 2e8f7a3..38f3c23 100644 --- a/lib/i18n/strings_en.i18n.json +++ b/lib/i18n/strings_en.i18n.json @@ -59,6 +59,7 @@ "all": "All", "unread": "Unread", "read": "Read", + "filterSort": "Filter and sort", "addBookmark": { "addBookmark": "Add new bookmark", "editBookmark": "Edit bookmark", diff --git a/lib/i18n/strings_es.i18n.json b/lib/i18n/strings_es.i18n.json index 4bdadf9..9999b53 100644 --- a/lib/i18n/strings_es.i18n.json +++ b/lib/i18n/strings_es.i18n.json @@ -59,6 +59,7 @@ "all": "Todos", "unread": "No leídos", "read": "Leídos", + "filterSort": "Filtrar y ordenar", "addBookmark": { "addBookmark": "Añadir nuevo marcador", "editBookmark": "Editar marcador", diff --git a/lib/screens/bookmarks/ui/bookmarks.dart b/lib/screens/bookmarks/ui/bookmarks.dart index 1310aa0..32c7082 100644 --- a/lib/screens/bookmarks/ui/bookmarks.dart +++ b/lib/screens/bookmarks/ui/bookmarks.dart @@ -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) => [ + 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), ], ), ), diff --git a/lib/screens/bookmarks/ui/visualization_modal.dart b/lib/screens/bookmarks/ui/visualization_modal.dart new file mode 100644 index 0000000..00443e4 --- /dev/null +++ b/lib/screens/bookmarks/ui/visualization_modal.dart @@ -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), + ), + ], + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/screens/tags/ui/add_tag_modal.dart b/lib/screens/tags/ui/add_tag_modal.dart index 0d19314..cbefb7c 100644 --- a/lib/screens/tags/ui/add_tag_modal.dart +++ b/lib/screens/tags/ui/add_tag_modal.dart @@ -6,7 +6,7 @@ import 'package:linkdy/screens/tags/provider/add_tag.provider.dart'; import 'package:linkdy/i18n/strings.g.dart'; class AddTagModal extends ConsumerWidget { - const AddTagModal({Key? key}) : super(key: key); + const AddTagModal({super.key}); @override Widget build(BuildContext context, WidgetRef ref) { diff --git a/pubspec.lock b/pubspec.lock index fbff66d..4a2b712 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -853,22 +853,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.3" - quds_popup_menu: - dependency: "direct main" - description: - name: quds_popup_menu - sha256: d0f3f2f84c0bbf2934b961abbdafaa112c7ff9057585a24526a1ef61d2cd79e7 - url: "https://pub.dev" - source: hosted - version: "0.0.1+1" - quds_ui_kit: - dependency: transitive - description: - name: quds_ui_kit - sha256: "12018041085bf3f6bdb30744ba86cdb4b3a8e7d51dc2b271f275885508dd21f4" - url: "https://pub.dev" - source: hosted - version: "0.0.7+10" riverpod: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index df282e2..8ad840f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,7 +57,6 @@ dependencies: skeletonizer: ^1.0.1 http: ^1.2.0 flutter_slidable: ^3.0.1 - quds_popup_menu: ^0.0.1+1 dev_dependencies: build_runner: ^2.4.8