import 'package:flutter/material.dart'; import 'event.dart'; void showAddEventDialog( BuildContext context, List events, DateTime selectedDay) { showDialog( context: context, builder: (context) { return AlertDialog( title: Text('Add Event'), content: SingleChildScrollView( child: Column( mainAxisSize: MainAxisSize.min, children: [ TextFormField( decoration: InputDecoration(labelText: 'Event Name'), onSaved: (value) { if (value != null && value.isNotEmpty) { events.add(Event(date: selectedDay, name: value)); } }, ), ], ), ), actions: [ TextButton( onPressed: () { Navigator.of(context).pop(); }, child: Text('Cancel'), ), ElevatedButton( onPressed: () { Navigator.of(context).pop(); }, child: Text('Save'), ), ], ); }, ); }