Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Make 'all' screen of people section more similar to 'all' screen of other sections

ashilkn58887ce0449c
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.dart
index 95603dda06..26af6d0382 100644
--- a/mobile/lib/ui/viewer/search/result/people_section_all_page.dart
+++ b/mobile/lib/ui/viewer/search/result/people_section_all_page.dart
@@ -1,11 +1,12 @@
import "dart:async";
import 'package:flutter/material.dart';
+import "package:flutter_animate/flutter_animate.dart";
import "package:photos/events/event.dart";
-import "package:photos/generated/l10n.dart";
import "package:photos/models/search/search_result.dart";
import "package:photos/models/search/search_types.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/components/title_bar_title_widget.dart";
import "package:photos/ui/viewer/search_tab/people_section.dart";
class PeopleSectionAllPage extends StatefulWidget {
@@ -54,52 +55,111 @@ class _PeopleSectionAllPageState extends State<PeopleSectionAllPage> {
const horizontalEdgePadding = 20.0;
const gridPadding = 16.0;
return Scaffold(
+ // appBar: AppBar(
+ // title: Text(S.of(context).people),
+ // centerTitle: false,
+ // ),
appBar: AppBar(
- title: Text(S.of(context).people),
+ toolbarHeight: 48,
+ leadingWidth: 48,
+ leading: GestureDetector(
+ onTap: () {
+ Navigator.pop(context);
+ },
+ child: const Icon(
+ Icons.arrow_back_outlined,
+ ),
+ ),
),
- body: FutureBuilder<List<SearchResult>>(
- future: sectionData,
- 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();
+ body: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ TitleBarTitleWidget(
+ title: SectionType.face.sectionTitle(context),
+ ),
+ FutureBuilder(
+ future: sectionData,
+ builder: (context, snapshot) {
+ if (snapshot.hasData) {
+ final sectionResults = snapshot.data!;
+ return Text(sectionResults.length.toString())
+ .animate()
+ .fadeIn(
+ duration: const Duration(milliseconds: 150),
+ curve: Curves.easeIn,
+ );
+ } else {
+ return const SizedBox.shrink();
+ }
+ },
+ ),
+ ],
+ ),
+ ),
+ Expanded(
+ child: FutureBuilder<List<SearchResult>>(
+ future: sectionData,
+ 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 - 1) * gridPadding))) /
- crossAxisCount;
+ final itemSize = (screenWidth -
+ ((horizontalEdgePadding * 2) +
+ ((crossAxisCount - 1) * gridPadding))) /
+ crossAxisCount;
- return GridView.builder(
- padding: const EdgeInsets.fromLTRB(
- horizontalEdgePadding,
- 0,
- horizontalEdgePadding,
- 96,
- ),
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- mainAxisSpacing: gridPadding,
- crossAxisSpacing: gridPadding,
- crossAxisCount: crossAxisCount,
- childAspectRatio:
- itemSize / (itemSize + (24 * textScaleFactor)),
- ),
- itemCount: results.length,
- itemBuilder: (context, index) {
- return PersonSearchExample(
- searchResult: results[index],
- size: itemSize,
- );
+ return GridView.builder(
+ padding: const EdgeInsets.fromLTRB(
+ horizontalEdgePadding,
+ 16,
+ horizontalEdgePadding,
+ 96,
+ ),
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+ mainAxisSpacing: gridPadding,
+ crossAxisSpacing: gridPadding,
+ crossAxisCount: crossAxisCount,
+ childAspectRatio:
+ itemSize / (itemSize + (24 * textScaleFactor)),
+ ),
+ itemCount: results.length,
+ itemBuilder: (context, index) {
+ return PersonSearchExample(
+ searchResult: results[index],
+ size: itemSize,
+ )
+ .animate(delay: Duration(milliseconds: index * 12))
+ .fadeIn(
+ duration: const Duration(milliseconds: 225),
+ curve: Curves.easeIn,
+ )
+ .slide(
+ begin: const Offset(0, -0.05),
+ curve: Curves.easeInOut,
+ duration: const Duration(
+ milliseconds: 225,
+ ),
+ );
+ },
+ );
+ }
},
- );
- }
- },
+ ),
+ ),
+ ],
),
);
}