diff --git a/lib/Components/QuickReminder.dart b/lib/Components/QuickReminder.dart new file mode 100644 index 0000000..93e71b1 --- /dev/null +++ b/lib/Components/QuickReminder.dart @@ -0,0 +1,25 @@ +import 'package:flutter/material.dart'; + +class QuickReminder extends StatefulWidget { + const QuickReminder({super.key}); + + @override + State createState() => _QuickReminderState(); +} + +class _QuickReminderState extends State { + @override + Widget build(BuildContext context) { + return const ListTile( + leading: Checkbox( + value: false, + onChanged: null, + ), + title: TextField( + decoration: InputDecoration( + labelText: 'New Reminder', + ), + ), + ); + } +} diff --git a/lib/Components/Reminder.dart b/lib/Components/Reminder.dart index c9da672..ac59dd5 100644 --- a/lib/Components/Reminder.dart +++ b/lib/Components/Reminder.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import '../Components/EditReminderButton.dart'; +import '../pages/EditReminder.dart'; class Reminder extends StatefulWidget { const Reminder({super.key}); @@ -27,7 +28,12 @@ class _ReminderState extends State { ), title: Text("Reminder"), subtitle: Text(DateTime.now().toString()), - trailing: EditReminderButton(), + onTap: () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) => EditReminder()), + ); + }, ); } } diff --git a/lib/model/promemoria.dart b/lib/model/promemoria.dart index 5326c1d..7061abf 100644 --- a/lib/model/promemoria.dart +++ b/lib/model/promemoria.dart @@ -5,14 +5,12 @@ import 'identifiers/enum/priority.dart'; const String promemoriaTable = 'promemoria'; class Promemoria extends BaseEntity { - static String id = BaseEntity.getId; - static String title = BaseEntity.getTitle; - static String creationDate = BaseEntity.getCreationDate; - static String lastModificationDate = BaseEntity.getLastEditDate; static String expirationDate = ''; static String arrayPromemoria = ''; static String description = ''; static Priority priority = Priority.none; static Color color = Color.none; + + } diff --git a/lib/myApp.dart b/lib/myApp.dart index 9cc3f55..49d3545 100644 --- a/lib/myApp.dart +++ b/lib/myApp.dart @@ -10,6 +10,9 @@ class MyApp extends StatelessWidget { title: 'My App', theme: ThemeData( useMaterial3: true, + colorSchemeSeed: Colors.blue, + + ), home: Navigation() ); diff --git a/lib/navigation.dart b/lib/navigation.dart index d36e44d..5ab31e1 100644 --- a/lib/navigation.dart +++ b/lib/navigation.dart @@ -1,9 +1,12 @@ +import 'dart:ffi'; + import 'package:flutter/material.dart'; import 'pages/testUI.dart'; import 'pages/TodayView.dart'; import 'pages/InboxView.dart'; import 'pages/NotesView.dart'; + class Navigation extends StatefulWidget { const Navigation({super.key}); diff --git a/lib/pages/EditReminder.dart b/lib/pages/EditReminder.dart index cc08858..334012a 100644 --- a/lib/pages/EditReminder.dart +++ b/lib/pages/EditReminder.dart @@ -10,7 +10,12 @@ class EditReminder extends StatefulWidget { class _EditReminderState extends State { String _title = "ciaciao"; String _description = "description"; - DateTime _date = DateTime.now(); + DateTime? _date; + + //Arraylist of promemoria + + bool _hasDate = true; + @override Widget build(BuildContext context) { return Scaffold( @@ -18,37 +23,112 @@ class _EditReminderState extends State { title: Text("Edit Reminder"), ), body: SafeArea( - child: Padding( - padding: EdgeInsets.all(16.0), - child: Column( - children: [ - TextField( - controller: TextEditingController(text: _title), - decoration: const InputDecoration( - border: OutlineInputBorder(), - labelText: 'Title', - ), + child: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + TextField( + controller: TextEditingController(text: _title), + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Title', ), - const SizedBox(height: 10), - Expanded(child: TextField( - onChanged: (text) { - setState(() { - _description = text; - }); - }, - controller: TextEditingController(text: _description), - decoration: const InputDecoration( - border: OutlineInputBorder(), - labelText: 'Description', + ), + const SizedBox(height: 10), + TextField( + onChanged: (text) { + setState(() { + _description = text; + }); + }, + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Description', + ), + maxLines: 6, + keyboardType: TextInputType.multiline, + ), + const SizedBox(height: 10), + Row( + children: [ + FilledButton( + onPressed: () async { + DateTime? newDate = await showDatePicker( + context: context, + initialDate: DateTime.now(), + firstDate: DateTime(1), + lastDate: DateTime(9999)); + if (newDate != null) { + setState(() { + _date = newDate; + }); + } + }, + child: Row(children: [ + if (_date != null) Text("${_date?.day}/${_date?.month}/${_date?.year}"), + //if (_date == null) Text("Add Date"), + if (_date != null) const SizedBox(width: 10), + const Icon(Icons.calendar_month) + ])), + if (_date != null) IconButton( + onPressed: () { + setState(() { + _date = null; + }); + print("setting _date to ${_date}"); + }, + icon: Icon(Icons.close)), + if (_date == null) TextButton( + onPressed: () { + setState(() { + _date = DateTime.now(); + }); + print("setting _date to ${_date}"); + }, + child: const Row( + children: [ + Icon(Icons.add), + SizedBox(width: 5), + Text("Add Today") + ], + ) + ) + ], + ), + const SizedBox(height: 10), + const Spacer(), + Row( + children: [ + Expanded( + child: FilledButton( + onPressed: () { + print("ciao"); + }, + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all(Colors.red)), + child: const Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon(Icons.delete), + Text("Delete"), + ], + )), ), - maxLines: 6, - keyboardType: TextInputType.multiline, - ),), - const SizedBox(height: 10), - ], - ), - ) - ), + const SizedBox(width: 10), + Expanded( + child: FilledButton( + onPressed: () { + Navigator.pop(context); + }, + child: const Text("Save"), + ), + ), + ], + ) + ], + ), + )), ); } } diff --git a/lib/pages/InboxView.dart b/lib/pages/InboxView.dart index 98c083e..62b429d 100644 --- a/lib/pages/InboxView.dart +++ b/lib/pages/InboxView.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; -import 'CreateNewNote.dart'; -import 'NoteDetailView.dart'; + +//import components +import '../Components/Reminder.dart'; class InboxView extends StatefulWidget { const InboxView({super.key}); @@ -10,55 +11,18 @@ class InboxView extends StatefulWidget { } class _InboxViewState extends State { - List _values = [false, false, false, false, false]; - - void _onChanged(int index, bool? newValue){ - setState(() { - _values[index] = newValue ?? false; - }); - } - @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar( - title: Text( - 'Inbox', - style: TextStyle(color: Colors.white), + appBar: AppBar( + title: const Text('Inbox'), ), - backgroundColor: Colors.cyan.shade700, - ), - floatingActionButton: FloatingActionButton( - onPressed: () { - }, - child: Icon(Icons.add, color: Colors.white), - backgroundColor: Colors.cyan.shade700, - ), - body: Container( - child: ListView.builder( - itemCount: 5, - itemBuilder: (context, index) { - return Card( - color: Colors.white, - child: ListTile( - leading: Checkbox( - value: _values[index], - onChanged: (newValue) => _onChanged(index, newValue), - ), - title: Text("ciao", style: TextStyle(color: Colors.cyan.shade700, fontWeight: FontWeight.bold)), - subtitle: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Text('Descrizione della nota:')]), - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const NoteDetailView(), - ), - ); - }, - ), - ); - }, - ), - ), + body: ListView( + children: const [ + Reminder(), + Reminder(), + ], + ) ); } } diff --git a/lib/pages/TodayView.dart b/lib/pages/TodayView.dart index e522032..ef53685 100644 --- a/lib/pages/TodayView.dart +++ b/lib/pages/TodayView.dart @@ -2,7 +2,8 @@ import 'package:flutter/material.dart'; //import components import '../Components/Reminder.dart'; -import '../Components/EditReminderButton.dart'; +import '../Components/QuickReminder.dart'; +import '../model/promemoria.dart'; class TodayView extends StatefulWidget { const TodayView({super.key}); @@ -12,21 +13,31 @@ class TodayView extends StatefulWidget { } class _TodayViewState extends State { + + var _selectedDate = DateTime.now(); + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text( - 'Today', - style: TextStyle(color: Colors.white), + title: FilledButton( + onPressed: () async { + DateTime? newDate = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1), lastDate: DateTime(9999)); + if (newDate != null) { + setState(() { + _selectedDate = newDate; + }); + } + }, + child: Text(_selectedDate.day.toString() + "/" + _selectedDate.month.toString() + "/" + _selectedDate.year.toString()) ), - backgroundColor: Colors.cyan.shade700, ), - body: Container( - child: ListView(children: [ - Reminder(), - Reminder(), - ]), + body: ListView( + children: const [ + Reminder(), + Reminder(), + QuickReminder() + ], ), ); }