π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update person editor design
Neeraj Gupta3fc6fefbe205
diff --git a/mobile/apps/photos/lib/ui/viewer/people/people_util.dart b/mobile/apps/photos/lib/ui/viewer/people/people_util.dartdeleted file mode 100644index 5446737997..0000000000--- a/mobile/apps/photos/lib/ui/viewer/people/people_util.dart+++ /dev/null@@ -1,12 +0,0 @@-import "package:photos/services/machine_learning/face_ml/person/person_service.dart";-import "package:photos/utils/person_contact_linking_util.dart";--Future<bool> isMeAssigned() async {- final personEntities = await PersonService.instance.getPersons();- return personEntities.any(- (person) => isCurrentUserContactLink(- email: person.data.email,- userID: person.data.userID,- ),- );-}diff --git a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dartindex 572e201024..5552fa2b36 100644--- a/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart+++ b/mobile/apps/photos/lib/ui/viewer/people/save_or_edit_person.dart@@ -1,10 +1,8 @@-import 'dart:async';import "dart:math" as math;import "package:ente_components/ente_components.dart";-import "package:ente_pure_utils/ente_pure_utils.dart";import "package:flutter/material.dart";-import "package:flutter_animate/flutter_animate.dart";+import "package:hugeicons/hugeicons.dart";import "package:logging/logging.dart";import "package:photos/core/configuration.dart";import "package:photos/core/event_bus.dart";@@ -12,27 +10,19 @@ import "package:photos/ente_theme_data.dart";import "package:photos/events/people_changed_event.dart";import "package:photos/generated/l10n.dart";import "package:photos/l10n/l10n.dart";-import "package:photos/models/api/collection/user.dart";import "package:photos/models/file/file.dart";import "package:photos/models/ml/face/person.dart";-import "package:photos/services/account/user_service.dart";import "package:photos/services/machine_learning/face_ml/feedback/cluster_feedback.dart";import "package:photos/services/machine_learning/face_ml/person/person_service.dart";import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/common/date_input.dart";-import "package:photos/ui/common/loading_widget.dart";import "package:photos/ui/components/action_sheet_widget.dart";import "package:photos/ui/components/buttons/button_widget.dart";import "package:photos/ui/components/models/button_type.dart";import "package:photos/ui/notification/toast.dart";-import "package:photos/ui/sharing/album_share_info_widget.dart";-import "package:photos/ui/sharing/user_avator_widget.dart";import "package:photos/ui/viewer/file/no_thumbnail_widget.dart";import "package:photos/ui/viewer/gallery/hooks/pick_person_avatar.dart";import "package:photos/ui/viewer/people/face_thumbnail_squircle.dart";-import "package:photos/ui/viewer/people/link_email_screen.dart";import "package:photos/ui/viewer/people/merge_clusters_to_person_sheet.dart";-import "package:photos/ui/viewer/people/people_util.dart";import "package:photos/ui/viewer/people/person_clusters_page.dart";import "package:photos/ui/viewer/people/person_face_widget.dart";import "package:photos/utils/dialog_util.dart";@@ -69,17 +59,18 @@ String? _trimEmptyToNull(String? value) {class _SaveOrEditPersonState extends State<SaveOrEditPerson> {static const int _maxSuggestedPersons = 3;- bool isKeypadOpen = false;String _inputName = "";String? _selectedDate;String? _email;+ bool _isMe = false;+ bool _isMeAssignedToAnotherPerson = true;bool _isPinned = false;bool _hideFromMemories = false;bool userAlreadyAssigned = false;late final Logger _logger = Logger("_SavePersonState");- Timer? _debounce;PersonEntity? person;final _nameFocsNode = FocusNode();+ late final TextEditingController _nameController;List<PersonEntity> _allPersons = [];String? get _emailToSave => _trimEmptyToNull(_email);@@ -87,13 +78,20 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {int? get _currentUserIDToSave =>currentUserIDForContactLinkEmail(_emailToSave);+ bool get _initiallyIsMe => isCurrentUserContactLink(+ email: widget.person?.data.email,+ userID: widget.person?.data.userID,+ );++ bool get _isMeChanged => widget.isEditing && _isMe != _initiallyIsMe;+bool get _contactLinkEmailChanged =>widget.isEditing && _emailToSave != _trimEmptyToNull(person?.data.email);bool get _shouldClearContactUserID =>- _contactLinkEmailChanged &&person?.data.userID != null &&- _currentUserIDToSave == null;+ ((_isMeChanged && !_isMe) ||+ (_contactLinkEmailChanged && _currentUserIDToSave == null));bool get _shouldSetCurrentUserID =>widget.isEditing &&@@ -107,9 +105,14 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {void initState() {super.initState();_inputName = widget.person?.data.name ?? "";+ _nameController = TextEditingController(text: _inputName);_selectedDate = widget.person?.data.birthDate;_email = widget.person?.data.email;person = widget.person;+ _isMe = isCurrentUserContactLink(+ email: widget.person?.data.email,+ userID: widget.person?.data.userID,+ );_isPinned = widget.person?.data.isPinned ?? false;_hideFromMemories = widget.person?.data.hideFromMemories ?? false;_nameFocsNode.addListener(_handleNameFocusChange);@@ -118,16 +121,15 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {@overridevoid dispose() {- _debounce?.cancel();_nameFocsNode.removeListener(_handleNameFocusChange);_nameFocsNode.dispose();+ _nameController.dispose();super.dispose();}@overrideWidget build(BuildContext context) {- final textTheme = getEnteTextTheme(context);- final colorScheme = getEnteColorScheme(context);+ final colors = context.componentColors;final suggestions = _shouldShowSuggestions? _getPersonSuggestions(): const <PersonEntity>[];@@ -161,276 +163,249 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {}},child: Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,- appBar: AppBar(- title: Align(- alignment: Alignment.centerLeft,- child: Text(- widget.isEditing- ? context.l10n.editPerson- : context.l10n.savePerson,- ),- ),- ),+ resizeToAvoidBottomInset: true,+ backgroundColor: colors.backgroundBase,body: GestureDetector(- onTap: () {- FocusScope.of(context).unfocus();- },- child: SafeArea(- child: Column(- children: [- Expanded(- child: SingleChildScrollView(- padding: const EdgeInsets.only(- bottom: 32.0,- left: 16.0,- right: 16.0,- ),- child: Column(- children: [- const SizedBox(height: 48),- if (person != null)- Stack(- children: [- SizedBox(- height: 110,- width: 110,- child: FaceThumbnailSquircleClip(- child: PersonFaceWidget(- key: ValueKey(- person?.data.avatarFaceID ?? "",- ),- personId: person!.remoteID,- ),- ),- ),- if (person != null)- Positioned(- right: 0,- bottom: 0,- child: Container(- width: 28,- height: 28,- decoration: BoxDecoration(- borderRadius: BorderRadius.circular(8.0),- boxShadow: Theme.of(- context,- ).colorScheme.enteTheme.shadowMenu,- color: getEnteColorScheme(- context,- ).backgroundElevated2,- ),- child: IconButton(- 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(- context,- person!,- );- if (result != null) {- _logger.info('Person avatar updated');- setState(() {- person = result;- });- Bus.instance.fire(- PeopleChangedEvent(- type: PeopleEventType- .saveOrEditPerson,- source: "_SaveOrEditPersonState",- person: result,- ),- );- }- },- ),- ),- ),- ],- ),- if (person == null)- SizedBox(- height: 110,- width: 110,- child: FaceThumbnailSquircleClip(- child: widget.clusterID != null- ? PersonFaceWidget(- clusterID: widget.clusterID,- )- : const NoThumbnailWidget(addBorder: false),- ),- ),- const SizedBox(height: 36),- TextFormField(- keyboardType: TextInputType.name,- textCapitalization: TextCapitalization.words,- autocorrect: false,- focusNode: _nameFocsNode,- onChanged: (value) {- if (_debounce?.isActive ?? false) {- _debounce?.cancel();- }- _debounce = Timer(- const Duration(milliseconds: 300),- () {- setState(() {- _inputName = value;- });- },- );- },- initialValue: _inputName,- decoration: InputDecoration(- focusedBorder: OutlineInputBorder(- borderRadius: const BorderRadius.all(- Radius.circular(8.0),- ),- borderSide: BorderSide(- color: getEnteColorScheme(context).strokeMuted,- ),- ),- fillColor: getEnteColorScheme(context).fillFaint,- filled: true,- hintText: context.l10n.enterName,- hintStyle: getEnteTextTheme(context).bodyFaint,- contentPadding: const EdgeInsets.symmetric(- horizontal: 16,- vertical: 14,+ onTap: () => FocusScope.of(context).unfocus(),+ child: Column(+ children: [+ Expanded(+ child: AppBarComponent(+ title: widget.isEditing+ ? context.l10n.editPerson+ : context.l10n.savePerson,+ onBack: () => Navigator.of(context).maybePop(),+ physics: const BouncingScrollPhysics(),+ slivers: [+ SliverPadding(+ padding: const EdgeInsets.fromLTRB(24, 20, 24, 32),+ sliver: SliverToBoxAdapter(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Center(child: _buildAvatar()),+ const SizedBox(height: Spacing.xxl),+ TextInputComponent(+ label: context.l10n.name,+ hintText: context.l10n.enterName,+ controller: _nameController,+ focusNode: _nameFocsNode,+ keyboardType: TextInputType.name,+ textCapitalization: TextCapitalization.words,+ autocorrect: false,+ isRequired: true,+ onChanged: (value) =>+ setState(() => _inputName = value),),- border: UnderlineInputBorder(- borderSide: BorderSide.none,- borderRadius: BorderRadius.circular(8),+ AnimatedSize(+ duration: const Duration(milliseconds: 200),+ curve: Curves.easeInOutQuad,+ child: suggestions.isEmpty+ ? const SizedBox.shrink()+ : Padding(+ padding: const EdgeInsets.only(+ top: Spacing.sm,+ ),+ child: _PersonSuggestionsDropdown(+ persons: suggestions,+ onPersonTap: _onSuggestionSelected,+ ),+ ),),- ),- ),- AnimatedSize(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOutQuad,- child: suggestions.isEmpty- ? const SizedBox.shrink()- : Padding(- padding: const EdgeInsets.only(top: 8),- child: _PersonSuggestionsDropdown(- persons: suggestions,- onPersonTap: _onSuggestionSelected,- ),+ if (_showThisIsMe) ...[+ const SizedBox(height: Spacing.sm),+ LabeledControlComponent(+ control: CheckboxComponent(+ selected: _isMe,+ onChanged: _setIsMe,),- ),- const SizedBox(height: 16),- DatePickerField(- hintText: context.l10n.enterDateOfBirth,- firstDate: DateTime(100),- lastDate: DateTime.now(),- initialValue: _selectedDate,- isRequired: false,- onChanged: (date) {- setState(() {- // format date to yyyy-MM-dd- _selectedDate = date- ?.toIso8601String()- .split("T")- .first;- });- },- ),- const SizedBox(height: 16),- AnimatedSize(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOutQuad,- child: _EmailSection(_email, person?.remoteID),- ),- const SizedBox(height: 24),- ButtonWidget(- buttonType: ButtonType.primary,- labelText: context.l10n.save,- isDisabled: !changed || _inputName.isEmpty,- onTap: () async {- if (widget.isEditing) {- final updatedPersonEntity = await updatePerson(- context,- );- if (updatedPersonEntity != null) {- if (!context.mounted) return;- Navigator.pop(context, updatedPersonEntity);- }- } else {- final newPersonEntity =- await addNewPerson(- context,- text: _inputName,- clusterID: widget.clusterID!,- birthdate: _selectedDate,- email: _email,- ).catchError((e) {- _logger.severe(- "Error adding new person",- e,- );- return null;- });- if (newPersonEntity != null) {- if (!context.mounted) return;- Navigator.pop(context, newPersonEntity);- }- }- },- ),- if (!widget.isEditing) ...[- const SizedBox(height: 24),- Align(- alignment: Alignment.center,- child: TextButton(- onPressed: _onMergeWithExisting,- style: TextButton.styleFrom(- padding: EdgeInsets.zero,- minimumSize: Size.zero,- tapTargetSize: MaterialTapTargetSize.shrinkWrap,+ label: context.l10n.thisIsMeExclamation,+ foreground: colors.textLighter,+ onTap: () => _setIsMe(!_isMe),),- child: Text(- context.l10n.mergeWithExisting,- style: textTheme.small.copyWith(- fontWeight: FontWeight.w500,- color: colorScheme.primary500,- decoration: TextDecoration.underline,- decorationColor: colorScheme.primary500,+ ],+ const SizedBox(height: Spacing.xxl),+ _buildBirthdayInput(),+ if (widget.isEditing) ...[+ const SizedBox(height: 28),+ Text(+ context.l10n.mergedPhotos,+ style: TextStyles.h2.copyWith(+ color: colors.textBase,),),- ),- ),- ],- if (widget.isEditing) ...[- const SizedBox(height: 32),- Align(- alignment: Alignment.centerLeft,- child: Text(- context.l10n.mergedPhotos,- style: textTheme.body,- ),- ),- Padding(- padding: const EdgeInsets.only(- bottom: 12.0,- top: 24.0,- ),- child: PersonClustersWidget(person!),- ),- ],- ],+ const SizedBox(height: Spacing.md),+ PersonClustersWidget(person!),+ ],+ ],+ ),+ ),),- ),+ ],),- ],- ),+ ),+ Padding(+ padding: const EdgeInsets.all(Spacing.xxl),+ child: Column(+ children: [+ ButtonComponent(+ label: context.l10n.savePerson,+ isDisabled: !changed || _inputName.trim().isEmpty,+ shouldShowSuccessState: false,+ onTap: changed && _inputName.trim().isNotEmpty+ ? _savePerson+ : null,+ ),+ if (!widget.isEditing) ...[+ const SizedBox(height: Spacing.sm),+ ButtonComponent(+ label: context.l10n.mergeWithExisting,+ variant: ButtonComponentVariant.link,+ size: ButtonComponentSize.small,+ shouldSurfaceExecutionStates: false,+ onTap: _onMergeWithExisting,+ ),+ ],+ ],+ ),+ ),+ ],),),),);}+ bool get _showThisIsMe =>+ Configuration.instance.getEmail() != null &&+ (_isMe || !_isMeAssignedToAnotherPerson);++ Widget _buildAvatar() {+ const size = 108.0;+ final avatar = SizedBox(+ width: size,+ height: size,+ child: FaceThumbnailSquircleClip(+ borderRadius: faceThumbnailSquircleBorderRadius(size),+ child: person != null+ ? PersonFaceWidget(+ key: ValueKey(person!.data.avatarFaceID ?? ""),+ personId: person!.remoteID,+ )+ : widget.clusterID != null+ ? PersonFaceWidget(clusterID: widget.clusterID)+ : const NoThumbnailWidget(addBorder: false),+ ),+ );+ if (person == null) {+ return avatar;+ }+ return Stack(+ clipBehavior: Clip.none,+ children: [+ avatar,+ Positioned(+ right: 0,+ bottom: 0,+ child: _AvatarEditButton(onTap: _editAvatar),+ ),+ ],+ );+ }++ Widget _buildBirthdayInput() {+ final date = DateTime.tryParse(_selectedDate ?? "");+ final hasBirthday = date != null;+ return GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: _pickBirthday,+ child: TextInputComponent(+ key: ValueKey(_selectedDate),+ label: context.l10n.birthday,+ hintText: context.l10n.enterDateOfBirth,+ initialValue: date == null+ ? null+ : MaterialLocalizations.of(context).formatMediumDate(date),+ readOnly: true,+ suffix: HugeIcon(+ icon: hasBirthday+ ? HugeIcons.strokeRoundedCancel01+ : HugeIcons.strokeRoundedCalendar03,+ color: context.componentColors.textLighter,+ size: IconSizes.small,+ ),+ onSuffixTap: hasBirthday+ ? () => setState(() => _selectedDate = null)+ : _pickBirthday,+ ),+ );+ }++ Future<void> _editAvatar() async {+ final result = await showPersonAvatarPhotoSheet(context, person!);+ if (!mounted || result == null) {+ return;+ }+ _logger.info('Person avatar updated');+ setState(() => person = result);+ Bus.instance.fire(+ PeopleChangedEvent(+ type: PeopleEventType.saveOrEditPerson,+ source: "_SaveOrEditPersonState",+ person: result,+ ),+ );+ }++ Future<void> _pickBirthday() async {+ final locale = await getFormatLocale();+ if (!mounted) return;+ final picked = await showDatePicker(+ context: context,+ locale: locale,+ initialDate: DateTime.tryParse(_selectedDate ?? "") ?? DateTime.now(),+ firstDate: DateTime(100),+ lastDate: DateTime.now(),+ );+ if (picked != null && mounted) {+ setState(() => _selectedDate = picked.toIso8601String().split("T").first);+ }+ }++ void _setIsMe(bool selected) {+ setState(() {+ _isMe = selected;+ _email = selected+ ? Configuration.instance.getEmail()+ : isCurrentUserContactLink(+ email: widget.person?.data.email,+ userID: widget.person?.data.userID,+ )+ ? null+ : widget.person?.data.email;+ });+ }++ Future<void> _savePerson() async {+ if (widget.isEditing) {+ final updatedPersonEntity = await updatePerson(context);+ if (updatedPersonEntity != null && mounted) {+ Navigator.pop(context, updatedPersonEntity);+ }+ return;+ }+ final newPersonEntity = await addNewPerson(+ context,+ text: _inputName,+ clusterID: widget.clusterID!,+ birthdate: _selectedDate,+ email: _email,+ );+ if (newPersonEntity != null && mounted) {+ Navigator.pop(context, newPersonEntity);+ }+ }+Future<void> _onMergeWithExisting() async {final clusterId = widget.clusterID;if (clusterId == null || userAlreadyAssigned) {@@ -479,6 +454,14 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {}setState(() {_allPersons = persons;+ _isMeAssignedToAnotherPerson = persons.any(+ (candidate) =>+ candidate.remoteID != person?.remoteID &&+ isCurrentUserContactLink(+ email: candidate.data.email,+ userID: candidate.data.userID,+ ),+ );});}@@ -679,6 +662,7 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {? (_inputName.trim() != person!.data.name ||_selectedDate != person!.data.birthDate ||_emailToSave != _trimEmptyToNull(person!.data.email) ||+ _isMeChanged ||_shouldUpdateContactUserID ||_isPinned != person!.data.isPinned ||_hideFromMemories != person!.data.hideFromMemories)@@ -744,6 +728,36 @@ class _SaveOrEditPersonState extends State<SaveOrEditPerson> {}}+class _AvatarEditButton extends StatelessWidget {+ const _AvatarEditButton({required this.onTap});++ final VoidCallback onTap;++ @override+ Widget build(BuildContext context) {+ return GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: onTap,+ child: Container(+ width: 28,+ height: 28,+ decoration: BoxDecoration(+ color: context.componentColors.fillLight,+ borderRadius: BorderRadius.circular(Radii.md),+ boxShadow: Theme.of(context).colorScheme.enteTheme.shadowMenu,+ ),+ alignment: Alignment.center,+ child: HugeIcon(+ icon: HugeIcons.strokeRoundedEdit03,+ color: context.componentColors.iconColor,+ size: IconSizes.small,+ strokeWidth: 2,+ ),+ ),+ );+ }+}+class _PersonSuggestionsDropdown extends StatelessWidget {final List<PersonEntity> persons;final ValueChanged<PersonEntity> onPersonTap;@@ -990,220 +1004,3 @@ class _MergeFaceThumbnail extends StatelessWidget {);}}--class _EmailSection extends StatefulWidget {- final String? personID;- final String? email;- const _EmailSection(this.email, this.personID);-- @override- State<_EmailSection> createState() => _EmailSectionState();-}--class _EmailSectionState extends State<_EmailSection> {- String? _email;- final _logger = Logger("_EmailSectionState");- bool _initialEmailIsUserEmail = false;- late final List<User> _contacts;-- @override- void initState() {- super.initState();- _email = widget.email;- _initialEmailIsUserEmail = Configuration.instance.getEmail() == _email;- _contacts = _getContacts();- }-- @override- void didUpdateWidget(covariant _EmailSection oldWidget) {- super.didUpdateWidget(oldWidget);- if (oldWidget.email != widget.email) {- setState(() {- _email = widget.email;- });- }- }-- @override- Widget build(BuildContext context) {- const limitCountTo = 5;- final avatarSize = getAvatarSize(AvatarType.large);- final overlapPadding = getOverlapPadding(AvatarType.large);- if (_email == null || _email!.isEmpty) {- return AnimatedSize(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOutQuad,- child: Padding(- padding: const EdgeInsets.only(top: 20),- child:- Container(- padding: const EdgeInsets.symmetric(- horizontal: 8.0,- vertical: 16,- ),- decoration: BoxDecoration(- color: getEnteColorScheme(context).fillFaint,- borderRadius: BorderRadius.circular(12.0),- ),- child: Column(- crossAxisAlignment: CrossAxisAlignment.center,- children: [- if (_contacts.isNotEmpty)- Padding(- padding: const EdgeInsets.only(top: 20),- child: Container(- padding: const EdgeInsets.symmetric(horizontal: 1.0),- height: 32 + 2 * UserAvatarWidget.strokeWidth,- width:- ((avatarSize) * (limitCountTo + 1)) -- (((avatarSize) - overlapPadding) * limitCountTo) +- (2 * UserAvatarWidget.strokeWidth),- child: AlbumSharesIcons(- sharees: _contacts,- limitCountTo: limitCountTo,- type: AvatarType.large,- padding: EdgeInsets.zero,- stackAlignment: Alignment.center,- ),- ),- ),- if (_contacts.isNotEmpty) const SizedBox(height: 38),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 8.0),- child: FutureBuilder<bool>(- future: isMeAssigned(),- builder: (context, snapshot) {- if (snapshot.hasData) {- final isMeAssigned = snapshot.data!;- if (!isMeAssigned || _initialEmailIsUserEmail) {- return Row(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Expanded(- child: ButtonWidget(- buttonType: ButtonType.secondary,- labelText:- context.l10n.thisIsMeExclamation,- onTap: () async {- _updateEmailField(- Configuration.instance.getEmail(),- );- },- ),- ),- const SizedBox(width: 8),- Expanded(- child: ButtonWidget(- buttonType: ButtonType.primary,- labelText: context.l10n.linkEmail,- shouldSurfaceExecutionStates: false,- onTap: () async {- final newEmail = await routeToPage(- context,- LinkEmailScreen(- widget.personID,- isFromSaveOrEditPerson: true,- ),- );- if (newEmail != null) {- _updateEmailField(newEmail as String);- }- },- ),- ),- ],- );- } else {- return ButtonWidget(- buttonType: ButtonType.primary,- labelText: context.l10n.linkEmail,- shouldSurfaceExecutionStates: false,- onTap: () async {- final newEmail = await routeToPage(- context,- LinkEmailScreen(- widget.personID,- isFromSaveOrEditPerson: true,- ),- );- if (newEmail != null) {- _updateEmailField(newEmail as String);- }- },- );- }- } else if (snapshot.hasError) {- _logger.severe(- "Error getting isMeAssigned",- snapshot.error,- );- return const EnteLoadingWidget();- } else {- return const EnteLoadingWidget();- }- },- ),- ),- ],- ),- ).animate().fadeIn(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOutQuad,- ),- ),- );- } else {- return TextFormField(- canRequestFocus: false,- autocorrect: false,- decoration: InputDecoration(- suffixIcon: GestureDetector(- onTap: () {- _updateEmailField("");- },- child: Icon(- Icons.close_outlined,- color: getEnteColorScheme(context).strokeMuted,- ),- ),- fillColor: getEnteColorScheme(context).fillFaint,- filled: true,- hintText: _email,- hintStyle: getEnteTextTheme(context).bodyFaint,- contentPadding: const EdgeInsets.symmetric(- horizontal: 16,- vertical: 14,- ),- border: UnderlineInputBorder(- borderSide: BorderSide.none,- borderRadius: BorderRadius.circular(8),- ),- ),- ).animate().fadeIn(- duration: const Duration(milliseconds: 200),- curve: Curves.easeInOutQuad,- );- }- }-- void _updateEmailField(String? newEmail) {- final saveOrEditPersonState = context- .findAncestorStateOfType<_SaveOrEditPersonState>()!;- saveOrEditPersonState.setState(() {- saveOrEditPersonState._email = newEmail;- });- }-- List<User> _getContacts() {- final userEmailsToAviod =- PersonService.instance.emailToPartialPersonDataMapCache.keys;- final ownerEmail = Configuration.instance.getEmail();- final relevantUsers = UserService.instance.getRelevantContacts()- ..add(User(email: ownerEmail!))- ..removeWhere((user) => userEmailsToAviod.contains(user.email));-- relevantUsers.sort((a, b) => (a.email).compareTo(b.email));-- return relevantUsers;- }-}