feat(profile): delete photo

This commit is contained in:
Alex
2024-12-04 15:15:28 +03:00
parent 480a26fe78
commit cb1b480c42
5 changed files with 46 additions and 1 deletions

View File

@@ -92,4 +92,9 @@ class ProfileCubit extends Cubit<ProfileState> {
await profileRepository.uploadPhoto(await ImageCompressUtility.compressFile(file));
return await getMyProfile();
}
deletePhoto() async {
await profileRepository.deletePhoto();
return await getMyProfile();
}
}

View File

@@ -737,7 +737,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
child: Row(
children: [
PopupMenuButton(
onSelected: (value) {
onSelected: (value) async {
if (value == 'view') {
context.pushTransparentRoute(
rootNavigator: true,
@@ -797,6 +797,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
),
);
}
if (value == 'delete') {
await profileCubit.deletePhoto();
await sl<ProfileAvatarCubit>().getMyProfile();
}
},
itemBuilder: (context) => [
PopupMenuItem(