π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Create new 'All' page for people section
ashilkn184323429acb
diff --git a/mobile/lib/ui/viewer/search/result/people_section_all_page.dart b/mobile/lib/ui/viewer/search/result/people_section_all_page.dartnew file mode 100644index 0000000000..43ddc7f268--- /dev/null+++ b/mobile/lib/ui/viewer/search/result/people_section_all_page.dart@@ -0,0 +1,67 @@+import 'package:flutter/material.dart';+import "package:photos/generated/l10n.dart";+import "package:photos/models/search/search_result.dart";+import "package:photos/theme/ente_theme.dart";+import "package:photos/ui/viewer/search_tab/people_section.dart";++class PeopleSectionAllPage extends StatelessWidget {+ final Future<List<SearchResult>> searchResults;++ const PeopleSectionAllPage({+ super.key,+ required this.searchResults,+ });++ @override+ Widget build(BuildContext context) {+ final smallFontSize = getEnteTextTheme(context).small.fontSize!;+ final textScaleFactor =+ MediaQuery.textScalerOf(context).scale(smallFontSize) / smallFontSize;+ const horizontalEdgePadding = 4.0;+ const gridPadding = 16.0;+ return Scaffold(+ appBar: AppBar(+ title: Text(S.of(context).people),+ ),+ body: FutureBuilder<List<SearchResult>>(+ future: searchResults,+ builder: (context, snapshot) {+ if (snapshot.connectionState == ConnectionState.waiting) {+ return const Center(child: CircularProgressIndicator());+ } else if (snapshot.hasError) {+ return Center(child: Text('Error: ${snapshot.error}'));+ } else if (!snapshot.hasData || snapshot.data!.isEmpty) {+ return const Center(child: Text('No results found.'));+ } else {+ final results = snapshot.data!;+ final screenWidth = MediaQuery.of(context).size.width;+ final crossAxisCount = (screenWidth / 100).floor();++ final itemSize = (screenWidth -+ ((horizontalEdgePadding * 2) ++ (crossAxisCount * gridPadding))) /+ crossAxisCount;++ return GridView.builder(+ padding: const EdgeInsets.all(horizontalEdgePadding),+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(+ mainAxisSpacing: gridPadding,+ crossAxisSpacing: gridPadding,+ crossAxisCount: crossAxisCount,+ childAspectRatio:+ itemSize / (itemSize + (18 * textScaleFactor)),+ ),+ itemCount: results.length,+ itemBuilder: (context, index) {+ return PersonSearchExample(+ searchResult: results[index],+ size: itemSize,+ );+ },+ );+ }+ },+ ),+ );+ }+}diff --git a/mobile/lib/ui/viewer/search_tab/people_section.dart b/mobile/lib/ui/viewer/search_tab/people_section.dartindex 8b3fd21d0a..3460002583 100644--- a/mobile/lib/ui/viewer/search_tab/people_section.dart+++ b/mobile/lib/ui/viewer/search_tab/people_section.dart@@ -16,9 +16,9 @@ import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";import "package:photos/ui/viewer/file/thumbnail_widget.dart";import "package:photos/ui/viewer/people/add_person_action_sheet.dart";import "package:photos/ui/viewer/people/people_page.dart";+import "package:photos/ui/viewer/search/result/people_section_all_page.dart";import 'package:photos/ui/viewer/search/result/person_face_widget.dart';import "package:photos/ui/viewer/search/result/search_result_page.dart";-import 'package:photos/ui/viewer/search/result/search_section_all_page.dart';import "package:photos/ui/viewer/search/search_section_cta.dart";import "package:photos/utils/navigation_util.dart";@@ -86,8 +86,8 @@ class _PeopleSectionState extends State<PeopleSection> {if (shouldShowMore) {routeToPage(context,- SearchSectionAllPage(- sectionType: widget.sectionType,+ PeopleSectionAllPage(+ searchResults: Future.value(widget.examples),),);}@@ -189,7 +189,12 @@ class SearchExampleRow extends StatelessWidget {class PersonSearchExample extends StatelessWidget {final SearchResult searchResult;- const PersonSearchExample({super.key, required this.searchResult});+ final double size;+ const PersonSearchExample({+ super.key,+ required this.searchResult,+ this.size = 102,+ });@overrideWidget build(BuildContext context) {@@ -223,16 +228,16 @@ class PersonSearchExample extends StatelessWidget {),),child: Container(- width: 102,- height: 102,+ width: size,+ height: size,decoration: BoxDecoration(color: getEnteColorScheme(context).strokeFaint,),),),SizedBox(- width: 100,- height: 100,+ width: size - 2,+ height: size - 2,child: searchResult.previewThumbnail() != null? Hero(tag: heroTag,@@ -306,7 +311,7 @@ class PersonSearchExample extends StatelessWidget {padding: const EdgeInsets.only(top: 6, bottom: 0),child: Text(searchResult.name(),- maxLines: 2,+ maxLines: 1,textAlign: TextAlign.center,overflow: TextOverflow.ellipsis,style: getEnteTextTheme(context).small,