Revert "[mob][photos] Move Contacts section from search tab to shared tab"

This reverts commit 628f195c0e.
This commit is contained in:
ashilkn
2025-01-30 16:11:29 +05:30
parent d8b995c3d6
commit d37af17445
3 changed files with 28 additions and 46 deletions

View File

@@ -3,16 +3,13 @@ import "dart:math";
import 'package:flutter/material.dart';
import 'package:logging/logging.dart';
import "package:photos/core/constants.dart";
import 'package:photos/core/event_bus.dart';
import 'package:photos/events/collection_updated_event.dart';
import 'package:photos/events/local_photos_updated_event.dart';
import 'package:photos/events/user_logged_out_event.dart';
import "package:photos/generated/l10n.dart";
import 'package:photos/models/collection/collection_items.dart';
import "package:photos/models/search/generic_search_result.dart";
import 'package:photos/services/collections_service.dart';
import "package:photos/services/search_service.dart";
import "package:photos/ui/collections/album/row_item.dart";
import "package:photos/ui/collections/collection_list_page.dart";
import 'package:photos/ui/common/loading_widget.dart';
@@ -23,7 +20,6 @@ import "package:photos/ui/tabs/shared/empty_state.dart";
import "package:photos/ui/tabs/shared/quick_link_album_item.dart";
import "package:photos/ui/viewer/gallery/collect_photos_card_widget.dart";
import "package:photos/ui/viewer/gallery/collection_page.dart";
import "package:photos/ui/viewer/search_tab/contacts_section.dart";
import "package:photos/utils/debouncer.dart";
import "package:photos/utils/navigation_util.dart";
@@ -294,27 +290,6 @@ class _SharedCollectionsTabState extends State<SharedCollectionsTab>
),
)
: const SizedBox.shrink(),
const SizedBox(height: 2),
FutureBuilder(
future: SearchService.instance
.getAllContactsSearchResults(kSearchSectionLimit),
builder: (context, snapshot) {
if (snapshot.hasData) {
return ContactsSection(
snapshot.data as List<GenericSearchResult>,
);
} else if (snapshot.hasError) {
_logger.severe(
"failed to load contacts section",
snapshot.error,
snapshot.stackTrace,
);
return const EnteLoadingWidget();
} else {
return const EnteLoadingWidget();
}
},
),
const SizedBox(height: 4),
const CollectPhotosCardWidget(),
const SizedBox(height: 32),

View File

@@ -100,23 +100,30 @@ class _ContactsSectionState extends State<ContactsSection> {
),
const ContactCTA(),
];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SectionHeader(
SectionType.contacts,
hasMore: (_contactSearchResults.length >= kSearchSectionLimit - 1),
),
SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 4.5),
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: recommendations,
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SectionHeader(
SectionType.contacts,
hasMore:
(_contactSearchResults.length >= kSearchSectionLimit - 1),
),
),
],
const SizedBox(height: 2),
SizedBox(
child: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 4.5),
physics: const BouncingScrollPhysics(),
scrollDirection: Axis.horizontal,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: recommendations,
),
),
),
],
),
);
}
}

View File

@@ -17,6 +17,7 @@ import "package:photos/ui/viewer/search/result/no_result_widget.dart";
import "package:photos/ui/viewer/search/search_suggestions.dart";
import "package:photos/ui/viewer/search/tab_empty_state.dart";
import 'package:photos/ui/viewer/search_tab/albums_section.dart';
import "package:photos/ui/viewer/search_tab/contacts_section.dart";
import "package:photos/ui/viewer/search_tab/file_type_section.dart";
import "package:photos/ui/viewer/search_tab/locations_section.dart";
import "package:photos/ui/viewer/search_tab/magic_section.dart";
@@ -144,11 +145,10 @@ class _AllSearchSectionsState extends State<AllSearchSections> {
as List<GenericSearchResult>,
);
case SectionType.contacts:
// return ContactsSection(
// snapshot.data!.elementAt(index)
// as List<GenericSearchResult>,
// );
return const SizedBox.shrink();
return ContactsSection(
snapshot.data!.elementAt(index)
as List<GenericSearchResult>,
);
case SectionType.fileTypesAndExtension:
return FileTypeSection(
snapshot.data!.elementAt(index)