Improve event todo visibility

This commit is contained in:
zsolt
2026-08-13 14:07:22 +02:00
parent e56abfb2aa
commit f13353f4ee
2 changed files with 166 additions and 9 deletions
+62
View File
@@ -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),
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});
+102 -7
View File
@@ -310,15 +310,106 @@ class _EventAddDialogState extends State<EventAddDialog> {
maxLines: 4,
decoration: const InputDecoration(labelText: 'Megjegyz\u00e9s'),
),
const SizedBox(height: 8),
CheckboxListTile(
contentPadding: EdgeInsets.zero,
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,
onChanged: (value) => setState(() => hasTodos = value ?? false),
title: const Text('Teend\u0151 van'),
controlAffinity: ListTileControlAffinity.leading,
activeThumbColor: sage,
onChanged: (value) => setState(() => hasTodos = value),
),
],
),
),
),
if (hasTodos) ...[
const SizedBox(height: 12),
Row(
children: [
Expanded(
@@ -591,7 +682,11 @@ class _StockAddDialogState extends State<StockAddDialog> {
@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(