fix(mobile): show places in Search page on mobile (#9085)

* fix(mobile): show map on mobile

* remove ununsed code
This commit is contained in:
Alex
2024-04-26 00:49:31 -05:00
committed by GitHub
parent d52ed51aab
commit 52bcb46b42
6 changed files with 40 additions and 191 deletions
@@ -6,7 +6,6 @@ import 'package:immich_mobile/extensions/asyncvalue_extensions.dart';
import 'package:immich_mobile/modules/search/models/curated_content.dart';
import 'package:immich_mobile/modules/search/providers/search_page_state.provider.dart';
import 'package:immich_mobile/modules/search/ui/explore_grid.dart';
import 'package:openapi/api.dart';
@RoutePage()
class CuratedLocationPage extends HookConsumerWidget {
@@ -14,8 +13,7 @@ class CuratedLocationPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
AsyncValue<List<CuratedLocationsResponseDto>> curatedLocation =
ref.watch(getCuratedLocationProvider);
AsyncValue<List<CuratedContent>> places = ref.watch(getPlacesProvider);
return Scaffold(
appBar: AppBar(
@@ -27,16 +25,9 @@ class CuratedLocationPage extends HookConsumerWidget {
icon: const Icon(Icons.arrow_back_ios_rounded),
),
),
body: curatedLocation.widgetWhen(
onData: (curatedLocations) => ExploreGrid(
curatedContent: curatedLocations
.map(
(l) => CuratedContent(
label: l.city,
id: l.id,
),
)
.toList(),
body: places.widgetWhen(
onData: (data) => ExploreGrid(
curatedContent: data,
),
),
);
@@ -27,7 +27,7 @@ class SearchPage extends HookConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final curatedLocation = ref.watch(getCuratedLocationProvider);
final places = ref.watch(getPlacesProvider);
final curatedPeople = ref.watch(getAllPeopleProvider);
final isMapEnabled =
ref.watch(serverInfoProvider.select((v) => v.serverFeatures.map));
@@ -87,18 +87,11 @@ class SearchPage extends HookConsumerWidget {
buildPlaces() {
return SizedBox(
height: imageSize,
child: curatedLocation.widgetWhen(
child: places.widgetWhen(
onError: (error, stack) => const ScaffoldErrorBody(withIcon: false),
onData: (locations) => CuratedPlacesRow(
onData: (data) => CuratedPlacesRow(
isMapEnabled: isMapEnabled,
content: locations
.map(
(o) => CuratedContent(
id: o.id,
label: o.city,
),
)
.toList(),
content: data,
imageSize: imageSize,
onTap: (content, index) {
context.pushRoute(