Changed search screen with modal

This commit is contained in:
Juan Gilsanz Polo
2024-02-26 22:49:44 +01:00
parent 4bac98e573
commit d1396699e6
3 changed files with 123 additions and 103 deletions

View File

@@ -48,10 +48,6 @@ final List<RouteBase> appRoutes = [
),
],
),
GoRoute(
path: RoutesPaths.bookmarksSearch,
builder: (context, state) => const SearchBookmarksScreen(),
),
GoRoute(
path: RoutesPaths.tagBookmarks,
name: RoutesNames.tagBookmarks,

View File

@@ -9,6 +9,7 @@ import 'package:linkdy/screens/bookmarks/provider/bookmarks.provider.dart';
import 'package:linkdy/screens/bookmarks/ui/bookmark_item.dart';
import 'package:linkdy/screens/bookmarks/ui/add_bookmark_modal.dart';
import 'package:linkdy/screens/bookmarks/ui/delete_bookmark_modal.dart';
import 'package:linkdy/screens/bookmarks/ui/search_bookmarks.dart';
import 'package:linkdy/widgets/error_screen.dart';
import 'package:linkdy/widgets/no_data_screen.dart';
import 'package:linkdy/widgets/snackbar_fab.dart';
@@ -18,7 +19,7 @@ import 'package:linkdy/providers/router.provider.dart';
import 'package:linkdy/router/paths.dart';
class BookmarksScreen extends ConsumerWidget {
const BookmarksScreen({Key? key}) : super(key: key);
const BookmarksScreen({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -42,6 +43,22 @@ class BookmarksScreen extends ConsumerWidget {
);
}
void openSearchModal() {
showGeneralDialog(
context: context,
barrierColor: !(width > 700 || !(Platform.isAndroid || Platform.isIOS)) ? Colors.transparent : Colors.black54,
transitionBuilder: (context, anim1, anim2, child) {
return SlideTransition(
position: Tween(begin: const Offset(0, 1), end: const Offset(0, 0)).animate(
CurvedAnimation(parent: anim1, curve: Curves.easeInOutCubicEmphasized),
),
child: child,
);
},
pageBuilder: (context, animation, secondaryAnimation) => SearchBookmarksModal(fullscreen: width <= 700),
);
}
bool scrollListener(ScrollUpdateNotification scrollNotification) {
if (scrollNotification.metrics.extentAfter < 100 &&
bookmarks.loadingMore == false &&
@@ -67,7 +84,7 @@ class BookmarksScreen extends ConsumerWidget {
title: Text(t.bookmarks.bookmarks),
actions: [
IconButton(
onPressed: () => ref.watch(routerProvider).push(RoutesPaths.bookmarksSearch),
onPressed: openSearchModal,
icon: const Icon(Icons.search_rounded),
tooltip: t.bookmarks.search.searchBookmarks,
),

View File

@@ -14,8 +14,13 @@ import 'package:linkdy/providers/router.provider.dart';
import 'package:linkdy/i18n/strings.g.dart';
import 'package:linkdy/widgets/no_data_screen.dart';
class SearchBookmarksScreen extends ConsumerWidget {
const SearchBookmarksScreen({Key? key}) : super(key: key);
class SearchBookmarksModal extends ConsumerWidget {
final bool fullscreen;
const SearchBookmarksModal({
super.key,
required this.fullscreen,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -31,7 +36,8 @@ class SearchBookmarksScreen extends ConsumerWidget {
return false;
}
return Scaffold(
return Dialog.fullscreen(
child: Scaffold(
appBar: AppBar(
toolbarHeight: 68,
leading: Padding(
@@ -132,6 +138,7 @@ class SearchBookmarksScreen extends ConsumerWidget {
);
},
),
),
);
}
}