From f13353f4ee47c3e1ca343b9fecd59938decec7dd Mon Sep 17 00:00:00 2001 From: zsolt Date: Thu, 13 Aug 2026 14:07:22 +0200 Subject: [PATCH] Improve event todo visibility --- lib/calendar_widgets.dart | 64 +++++++++++++++++++++- lib/dialogs.dart | 111 +++++++++++++++++++++++++++++++++++--- 2 files changed, 166 insertions(+), 9 deletions(-) diff --git a/lib/calendar_widgets.dart b/lib/calendar_widgets.dart index cf6ba4c..67a109c 100644 --- a/lib/calendar_widgets.dart +++ b/lib/calendar_widgets.dart @@ -915,6 +915,26 @@ class WeekEventPill extends StatelessWidget { fontWeight: FontWeight.w900, ), ), + if (event.hasTodos) ...[ + const SizedBox(height: 2), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.task_alt_rounded, color: sage, size: 12), + const SizedBox(width: 3), + Text( + event.todos.isEmpty + ? 'teend\u0151' + : '${event.todos.length} db', + style: const TextStyle( + color: sage, + fontSize: 10, + fontWeight: FontWeight.w900, + ), + ), + ], + ), + ], const SizedBox(height: 1), Text( event.title, @@ -1424,7 +1444,15 @@ class EventCard extends StatelessWidget { style: const TextStyle(color: Colors.black54), ), const SizedBox(height: 6), - AudienceChip(person: person, event: event), + Wrap( + spacing: 6, + runSpacing: 6, + crossAxisAlignment: WrapCrossAlignment.center, + children: [ + AudienceChip(person: person, event: event), + if (event.hasTodos) TodoBadge(event: event), + ], + ), ], ), ), @@ -1440,6 +1468,40 @@ class EventCard extends StatelessWidget { } } +class TodoBadge extends StatelessWidget { + const TodoBadge({super.key, required this.event}); + + final CalendarEvent event; + + @override + Widget build(BuildContext context) { + final count = event.todos.length; + return Container( + padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 5), + decoration: BoxDecoration( + color: sage.withValues(alpha: .12), + borderRadius: BorderRadius.circular(999), + border: Border.all(color: sage.withValues(alpha: .18)), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.task_alt_rounded, color: sage, size: 14), + const SizedBox(width: 4), + Text( + count == 0 ? 'Teend\u0151 van' : '$count teend\u0151', + style: const TextStyle( + color: sage, + fontWeight: FontWeight.w900, + fontSize: 11, + ), + ), + ], + ), + ); + } +} + class FamilyAvatar extends StatelessWidget { const FamilyAvatar({super.key, required this.person, this.radius = 22}); diff --git a/lib/dialogs.dart b/lib/dialogs.dart index 6c44d7c..dc44778 100644 --- a/lib/dialogs.dart +++ b/lib/dialogs.dart @@ -310,15 +310,106 @@ class _EventAddDialogState extends State { maxLines: 4, decoration: const InputDecoration(labelText: 'Megjegyz\u00e9s'), ), - const SizedBox(height: 8), - CheckboxListTile( - contentPadding: EdgeInsets.zero, - value: hasTodos, - onChanged: (value) => setState(() => hasTodos = value ?? false), - title: const Text('Teend\u0151 van'), - controlAffinity: ListTileControlAffinity.leading, + const SizedBox(height: 12), + InkWell( + borderRadius: BorderRadius.circular(18), + onTap: () => setState(() => hasTodos = !hasTodos), + child: AnimatedContainer( + duration: const Duration(milliseconds: 180), + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: hasTodos ? mint : const Color(0xFFF4F4F1), + borderRadius: BorderRadius.circular(18), + border: Border.all( + color: hasTodos + ? sage.withValues(alpha: .55) + : Colors.black.withValues(alpha: .08), + width: hasTodos ? 1.4 : 1, + ), + ), + child: Row( + children: [ + Container( + width: 38, + height: 38, + decoration: BoxDecoration( + color: hasTodos ? sage : Colors.white, + borderRadius: BorderRadius.circular(14), + border: Border.all( + color: sage.withValues(alpha: .18), + ), + ), + child: Icon( + hasTodos + ? Icons.task_alt_rounded + : Icons.add_task_outlined, + color: hasTodos ? Colors.white : sage, + size: 21, + ), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + const Expanded( + child: Text( + 'Teend\u0151 van az esem\u00e9nyn\u00e9l', + style: TextStyle( + color: ink, + fontWeight: FontWeight.w900, + fontSize: 15, + ), + ), + ), + if (todos.isNotEmpty) + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, + vertical: 3, + ), + decoration: BoxDecoration( + color: sage.withValues(alpha: .12), + borderRadius: BorderRadius.circular(999), + ), + child: Text( + '${todos.length} db', + style: const TextStyle( + color: sage, + fontWeight: FontWeight.w900, + fontSize: 11, + ), + ), + ), + ], + ), + const SizedBox(height: 3), + Text( + hasTodos + ? 'Add meg, mit kell elint\u00e9zni ehhez az esem\u00e9nyhez.' + : 'Kapcsold be, ha az esem\u00e9nyhez feladatlista tartozik.', + style: const TextStyle( + color: Colors.black54, + fontSize: 12.5, + ), + ), + ], + ), + ), + const SizedBox(width: 8), + Switch( + value: hasTodos, + activeThumbColor: sage, + onChanged: (value) => setState(() => hasTodos = value), + ), + ], + ), + ), ), if (hasTodos) ...[ + const SizedBox(height: 12), Row( children: [ Expanded( @@ -591,7 +682,11 @@ class _StockAddDialogState extends State { @override Widget build(BuildContext context) { return AlertDialog( - title: Text(editing ? 'K\u00e9szlet szerkeszt\u00e9se' : 'K\u00e9szlet felv\u00e9tele'), + title: Text( + editing + ? 'K\u00e9szlet szerkeszt\u00e9se' + : 'K\u00e9szlet felv\u00e9tele', + ), content: SizedBox( width: 420, child: Column(