[mob][photos] Show all faces in 'All' section of faces
This commit is contained in:
@@ -1,17 +1,51 @@
|
||||
import "dart:async";
|
||||
|
||||
import 'package:flutter/material.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/viewer/search_tab/people_section.dart";
|
||||
|
||||
class PeopleSectionAllPage extends StatelessWidget {
|
||||
final Future<List<SearchResult>> searchResults;
|
||||
|
||||
class PeopleSectionAllPage extends StatefulWidget {
|
||||
const PeopleSectionAllPage({
|
||||
super.key,
|
||||
required this.searchResults,
|
||||
});
|
||||
|
||||
@override
|
||||
State<PeopleSectionAllPage> createState() => _PeopleSectionAllPageState();
|
||||
}
|
||||
|
||||
class _PeopleSectionAllPageState extends State<PeopleSectionAllPage> {
|
||||
late Future<List<SearchResult>> sectionData;
|
||||
final streamSubscriptions = <StreamSubscription>[];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
sectionData = SectionType.face.getData(context);
|
||||
|
||||
final streamsToListenTo = SectionType.face.viewAllUpdateEvents();
|
||||
for (Stream<Event> stream in streamsToListenTo) {
|
||||
streamSubscriptions.add(
|
||||
stream.listen((event) async {
|
||||
setState(() {
|
||||
sectionData = SectionType.face.getData(context);
|
||||
});
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
for (var subscriptions in streamSubscriptions) {
|
||||
subscriptions.cancel();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final smallFontSize = getEnteTextTheme(context).small.fontSize!;
|
||||
@@ -24,7 +58,7 @@ class PeopleSectionAllPage extends StatelessWidget {
|
||||
title: Text(S.of(context).people),
|
||||
),
|
||||
body: FutureBuilder<List<SearchResult>>(
|
||||
future: searchResults,
|
||||
future: sectionData,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
|
||||
@@ -86,9 +86,7 @@ class _PeopleSectionState extends State<PeopleSection> {
|
||||
if (shouldShowMore) {
|
||||
routeToPage(
|
||||
context,
|
||||
PeopleSectionAllPage(
|
||||
searchResults: Future.value(widget.examples),
|
||||
),
|
||||
const PeopleSectionAllPage(),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user