Skip to content

Commit

Permalink
Merge pull request #91 from simonoppowa/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
simonoppowa authored Jun 1, 2024
2 parents 3b95178 + 06f4cd0 commit 51ab1e3
Show file tree
Hide file tree
Showing 6 changed files with 1,013 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/features/home/presentation/widgets/intake_vertical_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:opennutritracker/features/diary/presentation/bloc/calendar_day_b
import 'package:opennutritracker/features/diary/presentation/bloc/diary_bloc.dart';
import 'package:opennutritracker/features/home/presentation/bloc/home_bloc.dart';
import 'package:opennutritracker/features/meal_detail/presentation/bloc/meal_detail_bloc.dart';
import 'package:opennutritracker/generated/l10n.dart';

class IntakeVerticalList extends StatefulWidget {
final DateTime day;
Expand Down Expand Up @@ -46,6 +47,10 @@ class _IntakeVerticalListState extends State<IntakeVerticalList> {
super.initState();
}

double get totalKcal {
return widget.intakeList.fold(0, (previousValue, element) => previousValue + element.totalKcal);
}

@override
Widget build(BuildContext context) {
return Column(
Expand All @@ -63,6 +68,16 @@ class _IntakeVerticalListState extends State<IntakeVerticalList> {
style: Theme.of(context).textTheme.titleLarge?.copyWith(
color: Theme.of(context).colorScheme.onBackground),
),
const Spacer(),
if (totalKcal > 0)
Text(
'${totalKcal.toInt()} ${S.of(context).kcalLabel}',
style: Theme.of(context).textTheme.titleSmall?.copyWith(
color: Theme.of(context)
.colorScheme
.onBackground
.withOpacity(0.7)),
),
],
),
),
Expand Down
4 changes: 4 additions & 0 deletions lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ import 'package:intl/src/intl_helpers.dart';

import 'messages_de.dart' as messages_de;
import 'messages_en.dart' as messages_en;
import 'messages_tr.dart' as messages_tr;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'de': () => new SynchronousFuture(null),
'en': () => new SynchronousFuture(null),
'tr': () => new SynchronousFuture(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
Expand All @@ -31,6 +33,8 @@ MessageLookupByLibrary? _findExact(String localeName) {
return messages_de.messages;
case 'en':
return messages_en.messages;
case 'tr':
return messages_tr.messages;
default:
return null;
}
Expand Down
Loading

0 comments on commit 51ab1e3

Please sign in to comment.