Show event todos from info button

This commit is contained in:
zsolt
2026-08-13 14:20:48 +02:00
parent f13353f4ee
commit a2d2d24fc2
2 changed files with 88 additions and 11 deletions
+80 -9
View File
@@ -915,7 +915,7 @@ class WeekEventPill extends StatelessWidget {
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
), ),
if (event.hasTodos) ...[ if (event.todos.isNotEmpty) ...[
const SizedBox(height: 2), const SizedBox(height: 2),
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@@ -923,9 +923,7 @@ class WeekEventPill extends StatelessWidget {
const Icon(Icons.task_alt_rounded, color: sage, size: 12), const Icon(Icons.task_alt_rounded, color: sage, size: 12),
const SizedBox(width: 3), const SizedBox(width: 3),
Text( Text(
event.todos.isEmpty '${event.todos.length} db',
? 'teend\u0151'
: '${event.todos.length} db',
style: const TextStyle( style: const TextStyle(
color: sage, color: sage,
fontSize: 10, fontSize: 10,
@@ -1395,6 +1393,7 @@ class EventCard extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final hasTodoItems = event.todos.isNotEmpty;
return Card( return Card(
child: InkWell( child: InkWell(
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
@@ -1450,16 +1449,26 @@ class EventCard extends StatelessWidget {
crossAxisAlignment: WrapCrossAlignment.center, crossAxisAlignment: WrapCrossAlignment.center,
children: [ children: [
AudienceChip(person: person, event: event), AudienceChip(person: person, event: event),
if (event.hasTodos) TodoBadge(event: event), if (hasTodoItems) TodoBadge(event: event),
], ],
), ),
], ],
), ),
), ),
Icon( if (hasTodoItems)
event.hasTodos ? Icons.task_alt_rounded : Icons.more_horiz, IconButton.filledTonal(
color: event.hasTodos ? sage : Colors.black38, tooltip: 'Teend\u0151k megtekint\u00e9se',
), onPressed: () => showEventTodos(context, event),
icon: const Icon(Icons.info_outline_rounded, size: 20),
style: IconButton.styleFrom(
backgroundColor: sage.withValues(alpha: .12),
foregroundColor: sage,
minimumSize: const Size(36, 36),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
)
else
const Icon(Icons.more_horiz, color: Colors.black38),
], ],
), ),
), ),
@@ -1468,6 +1477,68 @@ class EventCard extends StatelessWidget {
} }
} }
void showEventTodos(BuildContext context, CalendarEvent event) {
showDialog<void>(
context: context,
builder: (context) => AlertDialog(
title: Row(
children: [
Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: sage.withValues(alpha: .12),
borderRadius: BorderRadius.circular(13),
),
child: const Icon(Icons.task_alt_rounded, color: sage),
),
const SizedBox(width: 10),
const Expanded(child: Text('Teend\u0151k')),
],
),
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
event.title,
style: const TextStyle(
color: ink,
fontWeight: FontWeight.w900,
fontSize: 16,
),
),
const SizedBox(height: 12),
...event.todos.map(
(todo) => Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Icon(Icons.check_circle_outline, color: sage, size: 20),
const SizedBox(width: 8),
Expanded(
child: Text(
todo,
style: const TextStyle(color: ink, height: 1.35),
),
),
],
),
),
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('Rendben'),
),
],
),
);
}
class TodoBadge extends StatelessWidget { class TodoBadge extends StatelessWidget {
const TodoBadge({super.key, required this.event}); const TodoBadge({super.key, required this.event});
+8 -2
View File
@@ -490,6 +490,12 @@ class _EventAddDialogState extends State<EventAddDialog> {
FilledButton( FilledButton(
onPressed: () { onPressed: () {
final eventDate = parseDate(date.text) ?? DateTime.now(); final eventDate = parseDate(date.text) ?? DateTime.now();
final cleanTodos = hasTodos
? todos
.map((item) => item.trim())
.where((item) => item.isNotEmpty)
.toList()
: <String>[];
Navigator.pop( Navigator.pop(
context, context,
EventInput( EventInput(
@@ -498,8 +504,8 @@ class _EventAddDialogState extends State<EventAddDialog> {
date: eventDate, date: eventDate,
personId: personId, personId: personId,
note: note.text, note: note.text,
hasTodos: hasTodos, hasTodos: cleanTodos.isNotEmpty,
todos: hasTodos ? todos : const [], todos: cleanTodos,
), ),
); );
}, },