Skip to content

Commit

Permalink
Merge pull request #1903 from matthiasn/feat/color_coded_checklists_icon
Browse files Browse the repository at this point in the history
feat: add color coding in checklist card & spacing
  • Loading branch information
matthiasn authored Jan 8, 2025
2 parents 0538cf3 + 4b20ebd commit b006cb2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 6 deletions.
16 changes: 12 additions & 4 deletions lib/features/journal/ui/widgets/entry_details/habit_summary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class HabitSummary extends StatelessWidget {
HabitSummary(
this.habitCompletion, {
this.paddingLeft = 0,
this.paddingBottom = 0,
this.showIcon = false,
this.showText = true,
super.key,
Expand All @@ -19,6 +20,7 @@ class HabitSummary extends StatelessWidget {
final JournalDb _db = getIt<JournalDb>();
final HabitCompletionEntry habitCompletion;
final double paddingLeft;
final double paddingBottom;
final bool showText;
final bool showIcon;

Expand All @@ -39,7 +41,11 @@ class HabitSummary extends StatelessWidget {
}

return Padding(
padding: EdgeInsets.only(top: 5, left: paddingLeft),
padding: EdgeInsets.only(
top: 5,
left: paddingLeft,
bottom: paddingBottom,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -53,9 +59,11 @@ class HabitSummary extends StatelessWidget {
size: 30,
),
),
EntryTextWidget(
'Habit completed: ${habitDefinition.name}',
padding: EdgeInsets.zero,
Flexible(
child: EntryTextWidget(
'Habit completed: ${habitDefinition.name}',
padding: EdgeInsets.zero,
),
),
],
),
Expand Down
1 change: 1 addition & 0 deletions lib/features/journal/ui/widgets/entry_details_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class EntryDetailsContent extends ConsumerWidget {
habitCompletion: (habit) => HabitSummary(
habit,
paddingLeft: 10,
paddingBottom: 5,
showIcon: true,
showText: false,
),
Expand Down
1 change: 1 addition & 0 deletions lib/features/journal/ui/widgets/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class EntryTextWidget extends StatelessWidget {
child: Text(
text,
maxLines: maxLines,
softWrap: true,
style: monospaceTextStyle.copyWith(
fontWeight: FontWeight.w300,
),
Expand Down
12 changes: 11 additions & 1 deletion lib/features/journal/ui/widgets/journal_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ class _JournalCardState extends ConsumerState<JournalCard> {
: errorColor.withAlpha(102),
);
},
checklist: (_) => LeadingIcon(MdiIcons.checkAll),
checklistItem: (item) {
final categoryId = item.meta.categoryId;
final category =
Expand All @@ -269,6 +268,17 @@ class _JournalCardState extends ConsumerState<JournalCard> {
: context.colorScheme.outline,
);
},
checklist: (checklist) {
final categoryId = checklist.meta.categoryId;
final category =
getIt<EntitiesCacheService>().getCategoryById(categoryId);
return LeadingIcon(
MdiIcons.checkAll,
color: category != null
? colorFromCssHex(category.color)
: context.colorScheme.outline,
);
},
quantitative: (_) => LeadingIcon(MdiIcons.heart),
measurement: (_) => LeadingIcon(MdiIcons.numeric),
habitCompletion: (habitCompletion) =>
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: lotti
description: Achieve your goals and keep your data private with Lotti.
publish_to: 'none'
version: 0.9.553+2822
version: 0.9.553+2823

msix_config:
display_name: LottiApp
Expand Down

0 comments on commit b006cb2

Please sign in to comment.