feat(diary): fix gallery delete image

This commit is contained in:
mso7nueh
2024-11-01 12:14:30 +03:00
parent 50fe1de6ea
commit 39b43e88ec

View File

@@ -272,18 +272,18 @@ class _DiaryScreenState extends State<DiaryScreen> {
style: IconButton.styleFrom(
backgroundColor: Colors.white,
),
onPressed: () {
setState(() {
if (currentSelectedPhotoIndex == photos.length - 1 && currentSelectedPhotoIndex != 0) {
currentSelectedPhotoIndex = photos.length - 2;
}
});
diaryCubit.deletePhoto(
onPressed: () async {
await diaryCubit.deletePhoto(
photo: photos[currentSelectedPhotoIndex],
diaryId: diaryDay.id,
mealId: diaryDay.meals[currentSelectedMealNumber - 1].id,
date: _selectedDay.toString(),
);
setState(() {
if (currentSelectedPhotoIndex == photos.length - 1 && currentSelectedPhotoIndex != 0) {
currentSelectedPhotoIndex = photos.length - 2;
}
});
},
icon: Icon(
Icons.close_rounded,