Skip to content

Commit

Permalink
Merge branch 'feature/copy-meals' into feature/copy-meals-without-app…
Browse files Browse the repository at this point in the history
…name-change
  • Loading branch information
doktormerlin committed Dec 18, 2024
2 parents 00fa35c + 84c6b98 commit 8a9e8a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 30 deletions.
30 changes: 4 additions & 26 deletions lib/features/diary/presentation/widgets/day_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,35 +221,13 @@ class DayInfoWidget extends StatelessWidget {
}
}

void showCopyOrDeleteActivityDialog(
BuildContext context, UserActivityEntity activityEntity) async {
final copyOrDelete = await showDialog<bool>(
context: context, builder: (context) => const CopyOrDeleteDialog());

if (copyOrDelete != null && !copyOrDelete) {
if (context.mounted) {
showDeleteActivityDialog(context, activityEntity);
}
} else if (copyOrDelete != null && copyOrDelete) {
onCopyActivity(activityEntity, null);
}
}

void showDeleteActivityDialog(
void onActivityItemLongPressed(
BuildContext context, UserActivityEntity activityEntity) async {
final shouldDeleteIntake = await showDialog<bool>(
final shouldDeleteActivity = await showDialog<bool>(
context: context, builder: (context) => const DeleteDialog());
if (shouldDeleteIntake != null) {
onDeleteActivity(activityEntity, trackedDayEntity);
}
}

void onActivityItemLongPressed(
BuildContext context, UserActivityEntity activityEntity) async {
if (DateUtils.isSameDay(selectedDay, DateTime.now())) {
showDeleteActivityDialog(context, activityEntity);
} else {
showCopyOrDeleteActivityDialog(context, activityEntity);
if (shouldDeleteActivity != null) {
onDeleteActivity(activityEntity, trackedDayEntity);
}
}
}
2 changes: 1 addition & 1 deletion lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Choose Weight Goal"),
"cmLabel": MessageLookupByLibrary.simpleMessage("cm"),
"copyDialogTitle": MessageLookupByLibrary.simpleMessage(
"Which meal type di you want to copy to?"),
"Which meal type do you want to copy to?"),
"copyOrDeleteTimeDialogContent": MessageLookupByLibrary.simpleMessage(
"With \"Copy to today\" you can copy the meal to today. With \"Delete\" you can delete the meal."),
"copyOrDeleteTimeDialogTitle":
Expand Down
4 changes: 2 additions & 2 deletions lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"deleteTimeDialogContent": "Do want to delete the selected item?",
"itemDeletedSnackbar": "Item deleted",

"copyDialogTitle": "Which meal type di you want to copy to?",
"copyDialogTitle": "Which meal type do you want to copy to?",

"copyOrDeleteTimeDialogTitle": "What do you want to do?",
"copyOrDeleteTimeDialogContent": "With \"Copy to today\" you can copy the meal to today. With \"Delete\" you can delete the meal.",
Expand Down

0 comments on commit 8a9e8a8

Please sign in to comment.