Show event todos from info button
This commit is contained in:
@@ -915,7 +915,7 @@ class WeekEventPill extends StatelessWidget {
|
||||
fontWeight: FontWeight.w900,
|
||||
),
|
||||
),
|
||||
if (event.hasTodos) ...[
|
||||
if (event.todos.isNotEmpty) ...[
|
||||
const SizedBox(height: 2),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -923,9 +923,7 @@ class WeekEventPill extends StatelessWidget {
|
||||
const Icon(Icons.task_alt_rounded, color: sage, size: 12),
|
||||
const SizedBox(width: 3),
|
||||
Text(
|
||||
event.todos.isEmpty
|
||||
? 'teend\u0151'
|
||||
: '${event.todos.length} db',
|
||||
'${event.todos.length} db',
|
||||
style: const TextStyle(
|
||||
color: sage,
|
||||
fontSize: 10,
|
||||
@@ -1395,6 +1393,7 @@ class EventCard extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasTodoItems = event.todos.isNotEmpty;
|
||||
return Card(
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
@@ -1450,16 +1449,26 @@ class EventCard extends StatelessWidget {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
AudienceChip(person: person, event: event),
|
||||
if (event.hasTodos) TodoBadge(event: event),
|
||||
if (hasTodoItems) TodoBadge(event: event),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
event.hasTodos ? Icons.task_alt_rounded : Icons.more_horiz,
|
||||
color: event.hasTodos ? sage : Colors.black38,
|
||||
if (hasTodoItems)
|
||||
IconButton.filledTonal(
|
||||
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 {
|
||||
const TodoBadge({super.key, required this.event});
|
||||
|
||||
|
||||
+8
-2
@@ -490,6 +490,12 @@ class _EventAddDialogState extends State<EventAddDialog> {
|
||||
FilledButton(
|
||||
onPressed: () {
|
||||
final eventDate = parseDate(date.text) ?? DateTime.now();
|
||||
final cleanTodos = hasTodos
|
||||
? todos
|
||||
.map((item) => item.trim())
|
||||
.where((item) => item.isNotEmpty)
|
||||
.toList()
|
||||
: <String>[];
|
||||
Navigator.pop(
|
||||
context,
|
||||
EventInput(
|
||||
@@ -498,8 +504,8 @@ class _EventAddDialogState extends State<EventAddDialog> {
|
||||
date: eventDate,
|
||||
personId: personId,
|
||||
note: note.text,
|
||||
hasTodos: hasTodos,
|
||||
todos: hasTodos ? todos : const [],
|
||||
hasTodos: cleanTodos.isNotEmpty,
|
||||
todos: cleanTodos,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user