2024-04-01 16:45:11 +02:00
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
2024-08-06 16:20:27 +02:00
|
|
|
import 'package:immich_mobile/extensions/theme_extensions.dart';
|
2024-04-01 16:45:11 +02:00
|
|
|
import 'package:immich_mobile/routing/router.dart';
|
2024-05-07 06:04:21 +02:00
|
|
|
import 'package:immich_mobile/widgets/common/immich_app_bar.dart';
|
2024-04-01 16:45:11 +02:00
|
|
|
|
|
|
|
@RoutePage()
|
|
|
|
// ignore: must_be_immutable
|
|
|
|
class SearchPage extends HookConsumerWidget {
|
|
|
|
const SearchPage({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
TextStyle categoryTitleStyle = const TextStyle(
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
fontSize: 15.0,
|
|
|
|
);
|
|
|
|
|
2024-08-06 16:20:27 +02:00
|
|
|
Color categoryIconColor = context.colorScheme.onSurface;
|
2024-04-01 16:45:11 +02:00
|
|
|
|
|
|
|
buildSearchButton() {
|
|
|
|
return GestureDetector(
|
|
|
|
onTap: () {
|
|
|
|
context.pushRoute(SearchInputRoute());
|
|
|
|
},
|
|
|
|
child: Card(
|
|
|
|
elevation: 0,
|
2024-08-06 16:20:27 +02:00
|
|
|
color: context.colorScheme.surfaceContainerHigh,
|
2024-04-01 16:45:11 +02:00
|
|
|
shape: RoundedRectangleBorder(
|
2024-08-06 16:20:27 +02:00
|
|
|
borderRadius: BorderRadius.circular(50),
|
2024-04-01 16:45:11 +02:00
|
|
|
),
|
|
|
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 16.0,
|
|
|
|
vertical: 12.0,
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
2024-08-06 16:20:27 +02:00
|
|
|
Icon(
|
|
|
|
Icons.search,
|
|
|
|
color: context.colorScheme.onSurfaceSecondary,
|
|
|
|
),
|
2024-04-01 16:45:11 +02:00
|
|
|
const SizedBox(width: 16.0),
|
|
|
|
Text(
|
2024-04-05 16:45:37 +02:00
|
|
|
"search_bar_hint",
|
2024-04-01 16:45:11 +02:00
|
|
|
style: context.textTheme.bodyLarge?.copyWith(
|
2024-08-06 16:20:27 +02:00
|
|
|
color: context.colorScheme.onSurfaceSecondary,
|
2024-04-01 16:45:11 +02:00
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
2024-04-05 16:45:37 +02:00
|
|
|
).tr(),
|
2024-04-01 16:45:11 +02:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
appBar: const ImmichAppBar(),
|
2024-06-17 17:47:04 +02:00
|
|
|
body: ListView(
|
2024-04-01 16:45:11 +02:00
|
|
|
children: [
|
2024-06-17 17:47:04 +02:00
|
|
|
buildSearchButton(),
|
|
|
|
const SizedBox(height: 24.0),
|
|
|
|
Padding(
|
2024-10-10 10:44:14 +02:00
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
2024-06-17 17:47:04 +02:00
|
|
|
child: Text(
|
2024-10-10 10:44:14 +02:00
|
|
|
'search_page_categories',
|
2024-06-17 17:47:04 +02:00
|
|
|
style: context.textTheme.bodyLarge?.copyWith(
|
|
|
|
fontWeight: FontWeight.w500,
|
2024-04-01 16:45:11 +02:00
|
|
|
),
|
2024-06-17 17:47:04 +02:00
|
|
|
).tr(),
|
|
|
|
),
|
2024-10-10 10:44:14 +02:00
|
|
|
const SizedBox(height: 12.0),
|
2024-06-17 17:47:04 +02:00
|
|
|
ListTile(
|
|
|
|
leading: Icon(
|
|
|
|
Icons.favorite_border_rounded,
|
|
|
|
color: categoryIconColor,
|
|
|
|
),
|
|
|
|
title:
|
|
|
|
Text('search_page_favorites', style: categoryTitleStyle).tr(),
|
|
|
|
onTap: () => context.pushRoute(const FavoritesRoute()),
|
|
|
|
),
|
|
|
|
const CategoryDivider(),
|
|
|
|
ListTile(
|
|
|
|
leading: Icon(
|
|
|
|
Icons.schedule_outlined,
|
|
|
|
color: categoryIconColor,
|
|
|
|
),
|
|
|
|
title: Text(
|
|
|
|
'search_page_recently_added',
|
|
|
|
style: categoryTitleStyle,
|
|
|
|
).tr(),
|
|
|
|
onTap: () => context.pushRoute(const RecentlyAddedRoute()),
|
|
|
|
),
|
2024-10-10 10:44:14 +02:00
|
|
|
const CategoryDivider(),
|
2024-06-17 17:47:04 +02:00
|
|
|
ListTile(
|
|
|
|
title: Text('search_page_videos', style: categoryTitleStyle).tr(),
|
|
|
|
leading: Icon(
|
|
|
|
Icons.play_circle_outline,
|
|
|
|
color: categoryIconColor,
|
|
|
|
),
|
|
|
|
onTap: () => context.pushRoute(const AllVideosRoute()),
|
|
|
|
),
|
|
|
|
const CategoryDivider(),
|
|
|
|
ListTile(
|
|
|
|
title: Text(
|
|
|
|
'search_page_motion_photos',
|
|
|
|
style: categoryTitleStyle,
|
|
|
|
).tr(),
|
|
|
|
leading: Icon(
|
|
|
|
Icons.motion_photos_on_outlined,
|
|
|
|
color: categoryIconColor,
|
|
|
|
),
|
|
|
|
onTap: () => context.pushRoute(const AllMotionPhotosRoute()),
|
2024-04-01 16:45:11 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class CategoryDivider extends StatelessWidget {
|
|
|
|
const CategoryDivider({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return const Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
left: 56,
|
|
|
|
right: 16,
|
|
|
|
),
|
|
|
|
child: Divider(
|
|
|
|
height: 0,
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|