Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "OpenNutriTracker",
"request": "launch",
"type": "dart"
}
]
}
Binary file added intake_test.hive
Binary file not shown.
50 changes: 50 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,40 @@
PODS:
- app_links (0.0.2):
- Flutter
- DKImagePickerController/Core (4.3.9):
- DKImagePickerController/ImageDataManager
- DKImagePickerController/Resource
- DKImagePickerController/ImageDataManager (4.3.9)
- DKImagePickerController/PhotoGallery (4.3.9):
- DKImagePickerController/Core
- DKPhotoGallery
- DKImagePickerController/Resource (4.3.9)
- DKPhotoGallery (0.0.19):
- DKPhotoGallery/Core (= 0.0.19)
- DKPhotoGallery/Model (= 0.0.19)
- DKPhotoGallery/Preview (= 0.0.19)
- DKPhotoGallery/Resource (= 0.0.19)
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Core (0.0.19):
- DKPhotoGallery/Model
- DKPhotoGallery/Preview
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Model (0.0.19):
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Preview (0.0.19):
- DKPhotoGallery/Model
- DKPhotoGallery/Resource
- SDWebImage
- SwiftyGif
- DKPhotoGallery/Resource (0.0.19):
- SDWebImage
- SwiftyGif
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
- Flutter (1.0.0)
- flutter_keyboard_visibility (0.0.1):
- Flutter
Expand Down Expand Up @@ -60,6 +94,9 @@ PODS:
- Flutter
- FlutterMacOS
- PromisesObjC (2.4.0)
- SDWebImage (5.21.0):
- SDWebImage/Core (= 5.21.0)
- SDWebImage/Core (5.21.0)
- Sentry/HybridSDK (8.42.0)
- sentry_flutter (8.12.0):
- Flutter
Expand All @@ -71,11 +108,13 @@ PODS:
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.5)
- url_launcher_ios (0.0.1):
- Flutter

DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
- Flutter (from `Flutter`)
- flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`)
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
Expand All @@ -89,6 +128,8 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- DKImagePickerController
- DKPhotoGallery
- GoogleDataTransport
- GoogleMLKit
- GoogleToolboxForMac
Expand All @@ -100,11 +141,15 @@ SPEC REPOS:
- MLKitVision
- nanopb
- PromisesObjC
- SDWebImage
- Sentry
- SwiftyGif

EXTERNAL SOURCES:
app_links:
:path: ".symlinks/plugins/app_links/ios"
file_picker:
:path: ".symlinks/plugins/file_picker/ios"
Flutter:
:path: Flutter
flutter_keyboard_visibility:
Expand All @@ -128,6 +173,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0
DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
file_picker: b159e0c068aef54932bb15dc9fd1571818edaf49
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
flutter_secure_storage: d33dac7ae2ea08509be337e775f6b59f1ff45f12
Expand All @@ -145,10 +193,12 @@ SPEC CHECKSUMS:
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
SDWebImage: f84b0feeb08d2d11e6a9b843cb06d75ebf5b8868
Sentry: 38ed8bf38eab5812787274bf591e528074c19e02
sentry_flutter: 7d1f1df30f3768c411603ed449519bbb90a7d87b
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: ea1096d657c31e2d1110caeae903d5267e26d5a8
Expand Down
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@
<true/>
<key>NSCameraUsageDescription</key>
<string>Camera permission is required for barcode scanning.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Used for exporting data.</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions lib/core/presentation/widgets/copy_or_delete_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ class CopyOrDeleteDialog extends StatelessWidget {
onPressed: () {
Navigator.of(context).pop(true);
},
child: Text(S.of(context).dialogCopyLabel)),
child: Text(S.of(context).dialogCopyLabel.toUpperCase())),
TextButton(
onPressed: () {
Navigator.of(context).pop(false);
},
child: Text(S.of(context).dialogDeleteLabel))
child: Text(S.of(context).dialogDeleteLabel.toUpperCase()))
],
);
}
Expand Down
26 changes: 26 additions & 0 deletions lib/core/presentation/widgets/delete_all_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:opennutritracker/generated/l10n.dart';

class DeleteAllDialog extends StatelessWidget {
const DeleteAllDialog({super.key});

@override
Widget build(BuildContext context) {
return AlertDialog(
title: Text(S.of(context).deleteTimeDialogPluralTitle),
content: Text(S.of(context).deleteTimeDialogPluralContent),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop(true);
},
child: Text(S.of(context).dialogOKLabel)),
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text(S.of(context).dialogCancelLabel))
],
);
}
}
7 changes: 0 additions & 7 deletions lib/core/presentation/widgets/home_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@ class HomeAppbar extends StatelessWidget implements PreferredSizeWidget {
text: S.of(context).appTitle,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onSurface),
children: <TextSpan>[
TextSpan(
text: ' ${S.of(context).betaVersionName}',
style: TextStyle(
fontWeight: FontWeight.w500,
color: Theme.of(context).colorScheme.onSurface)),
],
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
Expand Down
4 changes: 4 additions & 0 deletions lib/core/utils/vertical_list_popup_menu_selections.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
enum VerticalListPopupMenuSelections {
onCopy,
onDelete,
}
3 changes: 1 addition & 2 deletions lib/features/diary/diary_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:logging/logging.dart';
import 'package:opennutritracker/core/domain/entity/intake_entity.dart';
import 'package:opennutritracker/core/domain/entity/intake_type_entity.dart';
import 'package:opennutritracker/core/domain/entity/tracked_day_entity.dart';
import 'package:opennutritracker/core/domain/entity/user_activity_entity.dart';
import 'package:opennutritracker/core/utils/locator.dart';
Expand All @@ -13,8 +14,6 @@ import 'package:opennutritracker/features/diary/presentation/widgets/day_info_wi
import 'package:opennutritracker/features/meal_detail/presentation/bloc/meal_detail_bloc.dart';
import 'package:opennutritracker/generated/l10n.dart';

import '../../core/domain/entity/intake_type_entity.dart';

class DiaryPage extends StatefulWidget {
const DiaryPage({super.key});

Expand Down
26 changes: 24 additions & 2 deletions lib/features/diary/presentation/widgets/day_info_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import 'package:opennutritracker/core/domain/entity/intake_entity.dart';
import 'package:opennutritracker/core/domain/entity/tracked_day_entity.dart';
import 'package:opennutritracker/core/domain/entity/user_activity_entity.dart';
import 'package:opennutritracker/core/presentation/widgets/activity_vertial_list.dart';
import 'package:opennutritracker/core/presentation/widgets/copy_or_delete_dialog.dart';
import 'package:opennutritracker/core/presentation/widgets/copy_dialog.dart';
import 'package:opennutritracker/core/presentation/widgets/delete_dialog.dart';
import 'package:opennutritracker/core/utils/custom_icons.dart';
import 'package:opennutritracker/features/add_meal/presentation/add_meal_type.dart';
import 'package:opennutritracker/features/home/presentation/widgets/intake_vertical_list.dart';
import 'package:opennutritracker/generated/l10n.dart';

import '../../../../core/presentation/widgets/copy_or_delete_dialog.dart';

class DayInfoWidget extends StatelessWidget {
final DateTime selectedDay;
final TrackedDayEntity? trackedDayEntity;
Expand Down Expand Up @@ -126,25 +125,42 @@ class DayInfoWidget extends StatelessWidget {
listIcon: Icons.bakery_dining_outlined,
addMealType: AddMealType.breakfastType,
intakeList: breakfastIntake,
onDeleteIntakeCallback: onDeleteIntake,
onItemLongPressedCallback: onIntakeItemLongPressed,
onCopyIntakeCallback:
DateUtils.isSameDay(selectedDay, DateTime.now())
? null
: onCopyIntake,
usesImperialUnits: usesImperialUnits,
trackedDayEntity: trackedDay,
),
IntakeVerticalList(
day: selectedDay,
title: S.of(context).lunchLabel,
listIcon: Icons.lunch_dining_outlined,
addMealType: AddMealType.lunchType,
intakeList: lunchIntake,
onDeleteIntakeCallback: onDeleteIntake,
onItemLongPressedCallback: onIntakeItemLongPressed,
usesImperialUnits: usesImperialUnits,
onCopyIntakeCallback:
DateUtils.isSameDay(selectedDay, DateTime.now())
? null
: onCopyIntake,
trackedDayEntity: trackedDay,
),
IntakeVerticalList(
day: selectedDay,
title: S.of(context).dinnerLabel,
listIcon: Icons.dinner_dining_outlined,
addMealType: AddMealType.dinnerType,
intakeList: dinnerIntake,
onDeleteIntakeCallback: onDeleteIntake,
onItemLongPressedCallback: onIntakeItemLongPressed,
onCopyIntakeCallback:
DateUtils.isSameDay(selectedDay, DateTime.now())
? null
: onCopyIntake,
usesImperialUnits: usesImperialUnits,
),
IntakeVerticalList(
Expand All @@ -153,8 +169,14 @@ class DayInfoWidget extends StatelessWidget {
listIcon: CustomIcons.food_apple_outline,
addMealType: AddMealType.snackType,
intakeList: snackIntake,
onDeleteIntakeCallback: onDeleteIntake,
onItemLongPressedCallback: onIntakeItemLongPressed,
usesImperialUnits: usesImperialUnits,
onCopyIntakeCallback:
DateUtils.isSameDay(selectedDay, DateTime.now())
? null
: onCopyIntake,
trackedDayEntity: trackedDay,
),
const SizedBox(height: 16.0)
],
Expand Down
13 changes: 11 additions & 2 deletions lib/features/home/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:logging/logging.dart';
import 'package:opennutritracker/core/domain/entity/intake_entity.dart';
import 'package:opennutritracker/core/domain/entity/intake_type_entity.dart';
import 'package:opennutritracker/core/domain/entity/tracked_day_entity.dart';
import 'package:opennutritracker/core/domain/entity/user_activity_entity.dart';
import 'package:opennutritracker/core/presentation/widgets/activity_vertial_list.dart';
import 'package:opennutritracker/core/presentation/widgets/edit_dialog.dart';
Expand Down Expand Up @@ -141,6 +142,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
listIcon: IntakeTypeEntity.breakfast.getIconData(),
addMealType: AddMealType.breakfastType,
intakeList: breakfastIntakeList,
onDeleteIntakeCallback: onDeleteIntake,
onItemDragCallback: onIntakeItemDrag,
onItemTappedCallback: onIntakeItemTapped,
usesImperialUnits: usesImperialUnits,
Expand All @@ -151,6 +153,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
listIcon: IntakeTypeEntity.lunch.getIconData(),
addMealType: AddMealType.lunchType,
intakeList: lunchIntakeList,
onDeleteIntakeCallback: onDeleteIntake,
onItemDragCallback: onIntakeItemDrag,
onItemTappedCallback: onIntakeItemTapped,
usesImperialUnits: usesImperialUnits,
Expand All @@ -161,6 +164,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
addMealType: AddMealType.dinnerType,
listIcon: IntakeTypeEntity.dinner.getIconData(),
intakeList: dinnerIntakeList,
onDeleteIntakeCallback: onDeleteIntake,
onItemDragCallback: onIntakeItemDrag,
onItemTappedCallback: onIntakeItemTapped,
usesImperialUnits: usesImperialUnits,
Expand All @@ -171,6 +175,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
listIcon: IntakeTypeEntity.snack.getIconData(),
addMealType: AddMealType.snackType,
intakeList: snackIntakeList,
onDeleteIntakeCallback: onDeleteIntake,
onItemDragCallback: onIntakeItemDrag,
onItemTappedCallback: onIntakeItemTapped,
usesImperialUnits: usesImperialUnits,
Expand Down Expand Up @@ -263,13 +268,17 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
}
}

void onDeleteIntake(IntakeEntity intake, TrackedDayEntity? trackedDayEntity) {
_homeBloc.deleteIntakeItem(intake);
_homeBloc.add(const LoadItemsEvent());
}

void _confirmDelete(BuildContext context, IntakeEntity intake) async {
bool? delete = await showDialog<bool>(
context: context, builder: (context) => const DeleteDialog());

if (delete == true) {
_homeBloc.deleteIntakeItem(intake);
_homeBloc.add(const LoadItemsEvent());
onDeleteIntake(intake, null);
}
setState(() {
_isDragging = false;
Expand Down
Loading