[mob][photos] Make faces loading in file info less ugly

This commit is contained in:
laurenspriem 2024-05-16 18:48:46 +05:30
parent f441a0b456
commit 288adb2e7c
2 changed files with 11 additions and 3 deletions

View file

@ -11,6 +11,7 @@ class InfoItemWidget extends StatelessWidget {
final Widget? endSection;
final Future<List<Widget>> subtitleSection;
final bool hasChipButtons;
final bool biggerSpinner;
final VoidCallback? onTap;
const InfoItemWidget({
required this.leadingIcon,
@ -19,6 +20,7 @@ class InfoItemWidget extends StatelessWidget {
this.endSection,
required this.subtitleSection,
this.hasChipButtons = false,
this.biggerSpinner = false,
this.onTap,
super.key,
});
@ -57,10 +59,11 @@ class InfoItemWidget extends StatelessWidget {
}
} else {
child = EnteLoadingWidget(
padding: 3,
size: 11,
padding: biggerSpinner ? 6 : 3,
size: biggerSpinner ? 20 : 11,
color: getEnteColorScheme(context).strokeMuted,
alignment: Alignment.centerLeft,
alignment:
biggerSpinner ? Alignment.center : Alignment.centerLeft,
);
}
return AnimatedSwitcher(

View file

@ -40,6 +40,7 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
leadingIcon: Icons.face_retouching_natural_outlined,
subtitleSection: _faceWidgets(context, widget.file, editMode),
hasChipButtons: true,
biggerSpinner: true,
editOnTap: _toggleEditMode,
);
}
@ -140,6 +141,10 @@ class _FacesItemWidgetState extends State<FacesItemWidget> {
final lastViewedClusterID = ClusterFeedbackService.lastViewedClusterID;
final faceWidgets = <FaceWidget>[];
// await generation of the face crops here, so that the file info shows one central loading spinner
final test = await getRelevantFaceCrops(faces);
final faceCrops = getRelevantFaceCrops(faces);
for (final Face face in faces) {
final int? clusterID = faceIdsToClusterIds[face.faceID];