Merge branch 'minor_fix_suggestion' into birthday_redirect_fix

This commit is contained in:
laurenspriem
2025-07-11 14:54:11 +02:00
2 changed files with 33 additions and 23 deletions

View File

@@ -48,10 +48,10 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
bool get personPage => widget.person != null;
PersonEntity get relevantPerson => widget.person ?? person!;
late AnimationController _slideController;
late AnimationController _fadeController;
late Animation<Offset> _slideAnimation;
late Animation<double> _fadeAnimation;
AnimationController? _slideController;
AnimationController? _fadeController;
Animation<Offset>? _slideAnimation;
Animation<double>? _fadeAnimation;
@override
void initState() {
@@ -76,7 +76,7 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
end: Offset.zero,
).animate(
CurvedAnimation(
parent: _slideController,
parent: _slideController!,
curve: Curves.easeOutCubic,
),
);
@@ -86,7 +86,7 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
end: 1.0,
).animate(
CurvedAnimation(
parent: _fadeController,
parent: _fadeController!,
curve: Curves.easeInOut,
),
);
@@ -121,8 +121,10 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
});
}
unawaited(_fadeController.forward());
unawaited(_slideController.forward());
if (mounted && _fadeController != null && _slideController != null) {
unawaited(_fadeController!.forward());
unawaited(_slideController!.forward());
}
unawaited(_precomputeNextSuggestions());
} else {
@@ -371,25 +373,29 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
}
Future<void> _animateOut() async {
await Future.wait([
_fadeController.reverse(),
_slideController.reverse(),
]);
if (mounted && _fadeController != null && _slideController != null) {
await Future.wait([
_fadeController!.reverse(),
_slideController!.reverse(),
]);
}
}
Future<void> _animateIn() async {
_slideController.reset();
_fadeController.reset();
await Future.wait([
_fadeController.forward(),
_slideController.forward(),
]);
if (mounted && _fadeController != null && _slideController != null) {
_slideController!.reset();
_fadeController!.reset();
await Future.wait([
_fadeController!.forward(),
_slideController!.forward(),
]);
}
}
@override
void dispose() {
_slideController.dispose();
_fadeController.dispose();
_slideController?.dispose();
_fadeController?.dispose();
super.dispose();
}
@@ -398,7 +404,9 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
if (isLoading ||
allSuggestions.isEmpty ||
currentSuggestionIndex >= allSuggestions.length ||
!hasCurrentSuggestion) {
!hasCurrentSuggestion ||
_slideAnimation == null ||
_fadeAnimation == null) {
return const SizedBox.shrink();
}
@@ -406,9 +414,9 @@ class _PersonGallerySuggestionState extends State<PersonGallerySuggestion>
final textTheme = getEnteTextTheme(context);
return SlideTransition(
position: _slideAnimation,
position: _slideAnimation!,
child: FadeTransition(
opacity: _fadeAnimation,
opacity: _fadeAnimation!,
child: GestureDetector(
key: ValueKey('suggestion_$currentSuggestionIndex'),
onTap: _navigateToCluster,

View File

@@ -193,6 +193,8 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {
icon: const Icon(Icons.edit),
iconSize:
16, // specify the size of the icon
padding: EdgeInsets.zero,
constraints: const BoxConstraints(),
onPressed: () async {
final result =
await showPersonAvatarPhotoSheet(