Changed search screen with modal
This commit is contained in:
@@ -48,10 +48,6 @@ final List<RouteBase> appRoutes = [
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
GoRoute(
|
|
||||||
path: RoutesPaths.bookmarksSearch,
|
|
||||||
builder: (context, state) => const SearchBookmarksScreen(),
|
|
||||||
),
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: RoutesPaths.tagBookmarks,
|
path: RoutesPaths.tagBookmarks,
|
||||||
name: RoutesNames.tagBookmarks,
|
name: RoutesNames.tagBookmarks,
|
||||||
|
|||||||
@@ -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/bookmark_item.dart';
|
||||||
import 'package:linkdy/screens/bookmarks/ui/add_bookmark_modal.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/delete_bookmark_modal.dart';
|
||||||
|
import 'package:linkdy/screens/bookmarks/ui/search_bookmarks.dart';
|
||||||
import 'package:linkdy/widgets/error_screen.dart';
|
import 'package:linkdy/widgets/error_screen.dart';
|
||||||
import 'package:linkdy/widgets/no_data_screen.dart';
|
import 'package:linkdy/widgets/no_data_screen.dart';
|
||||||
import 'package:linkdy/widgets/snackbar_fab.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';
|
import 'package:linkdy/router/paths.dart';
|
||||||
|
|
||||||
class BookmarksScreen extends ConsumerWidget {
|
class BookmarksScreen extends ConsumerWidget {
|
||||||
const BookmarksScreen({Key? key}) : super(key: key);
|
const BookmarksScreen({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
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) {
|
bool scrollListener(ScrollUpdateNotification scrollNotification) {
|
||||||
if (scrollNotification.metrics.extentAfter < 100 &&
|
if (scrollNotification.metrics.extentAfter < 100 &&
|
||||||
bookmarks.loadingMore == false &&
|
bookmarks.loadingMore == false &&
|
||||||
@@ -67,7 +84,7 @@ class BookmarksScreen extends ConsumerWidget {
|
|||||||
title: Text(t.bookmarks.bookmarks),
|
title: Text(t.bookmarks.bookmarks),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => ref.watch(routerProvider).push(RoutesPaths.bookmarksSearch),
|
onPressed: openSearchModal,
|
||||||
icon: const Icon(Icons.search_rounded),
|
icon: const Icon(Icons.search_rounded),
|
||||||
tooltip: t.bookmarks.search.searchBookmarks,
|
tooltip: t.bookmarks.search.searchBookmarks,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -14,8 +14,13 @@ import 'package:linkdy/providers/router.provider.dart';
|
|||||||
import 'package:linkdy/i18n/strings.g.dart';
|
import 'package:linkdy/i18n/strings.g.dart';
|
||||||
import 'package:linkdy/widgets/no_data_screen.dart';
|
import 'package:linkdy/widgets/no_data_screen.dart';
|
||||||
|
|
||||||
class SearchBookmarksScreen extends ConsumerWidget {
|
class SearchBookmarksModal extends ConsumerWidget {
|
||||||
const SearchBookmarksScreen({Key? key}) : super(key: key);
|
final bool fullscreen;
|
||||||
|
|
||||||
|
const SearchBookmarksModal({
|
||||||
|
super.key,
|
||||||
|
required this.fullscreen,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@@ -31,7 +36,8 @@ class SearchBookmarksScreen extends ConsumerWidget {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Dialog.fullscreen(
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
toolbarHeight: 68,
|
toolbarHeight: 68,
|
||||||
leading: Padding(
|
leading: Padding(
|
||||||
@@ -132,6 +138,7 @@ class SearchBookmarksScreen extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user