forked from eatvio/eatvio_app
feat(diary): fix gallery delete image
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user