bo non lo so
This commit is contained in:
@@ -1,17 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../pages/EditReminder.dart';
|
||||
|
||||
class EditReminderButton extends StatelessWidget{
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FilledButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => EditReminder()),
|
||||
);
|
||||
},
|
||||
child: Icon(Icons.list),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../database/controller.dart';
|
||||
import '../model/promemoria.dart';
|
||||
import '../navigation.dart';
|
||||
|
||||
class QuickReminder extends StatefulWidget {
|
||||
const QuickReminder({super.key});
|
||||
@@ -8,18 +11,34 @@ class QuickReminder extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _QuickReminderState extends State<QuickReminder> {
|
||||
Controller controller = Controller();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const ListTile(
|
||||
leading: Checkbox(
|
||||
return ListTile(
|
||||
leading: const Checkbox(
|
||||
value: false,
|
||||
onChanged: null,
|
||||
),
|
||||
title: TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'New Reminder',
|
||||
),
|
||||
),
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'New Reminder',
|
||||
),
|
||||
onSubmitted: (String value) {
|
||||
controller.addPromemoria(Promemoria.today(
|
||||
value,
|
||||
DateTime.now().toString(),
|
||||
DateTime.now().toString(),
|
||||
DateTime.now().toString(),
|
||||
"description"));
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
PageRouteBuilder(pageBuilder: (context, animation1, animation2) {
|
||||
return Navigation();
|
||||
},
|
||||
transitionDuration: const Duration(seconds: 0)),
|
||||
);
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ class _ReminderState extends State<Reminder> {
|
||||
onChanged: _onChanged,
|
||||
),
|
||||
title: Text(widget.promemoria?.getTitle() ?? 'Nessun titolo'),
|
||||
subtitle: Text(DateTime.now().toString()),
|
||||
subtitle: Text(widget.promemoria!.getExpirationDate().toString()),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'base_entity.dart';
|
||||
import 'identifiers/enum/color.dart';
|
||||
import 'identifiers/enum/priority.dart';
|
||||
|
||||
@@ -6,14 +5,14 @@ const String promemoriaTable = 'promemoria';
|
||||
|
||||
class Promemoria {
|
||||
String id = '';
|
||||
String title;
|
||||
String creationDate;
|
||||
String lastModificationDate;
|
||||
String expirationDate;
|
||||
String? arrayPromemoria;
|
||||
String description;
|
||||
String priority;
|
||||
String color;
|
||||
String title = '';
|
||||
String creationDate = '';
|
||||
String lastModificationDate = '';
|
||||
String expirationDate = '';
|
||||
String? arrayPromemoria = '';
|
||||
String description = '';
|
||||
String priority = '';
|
||||
String color = '';
|
||||
|
||||
Promemoria(
|
||||
this.id,
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
|
||||
import '../Components/Reminder.dart';
|
||||
import '../Components/QuickReminder.dart';
|
||||
import '../model/promemoria.dart';
|
||||
import '../database/controller.dart';
|
||||
|
||||
class TodayView extends StatefulWidget {
|
||||
const TodayView({super.key});
|
||||
@@ -14,14 +15,30 @@ class TodayView extends StatefulWidget {
|
||||
|
||||
class _TodayViewState extends State<TodayView> {
|
||||
|
||||
Controller controller = Controller();
|
||||
|
||||
var _selectedDate = DateTime.now();
|
||||
|
||||
List<Promemoria> listaPromemoria = [
|
||||
List<Promemoria> listaPromemoria = [];
|
||||
|
||||
/*[
|
||||
Promemoria.today("Primo promemoria", DateTime.now().toString(), DateTime.now().toString(), DateTime.now().toString(), "Descrizione primo promemoria"),
|
||||
Promemoria.today("Secondo promemoria", DateTime.now().toString(), DateTime.now().toString(), DateTime.now().toString(), "Descrizione secondo promemoria"),
|
||||
];
|
||||
];*/
|
||||
|
||||
getAllPromemoria() async {
|
||||
List<Promemoria> temp = await controller.getAllPromemoria();
|
||||
setState(() {
|
||||
listaPromemoria = temp;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
getAllPromemoria();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -29,30 +46,31 @@ class _TodayViewState extends State<TodayView> {
|
||||
appBar: AppBar(
|
||||
title: FilledButton(
|
||||
onPressed: () async {
|
||||
DateTime? newDate = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1), lastDate: DateTime(9999));
|
||||
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())
|
||||
child: Text("${_selectedDate.day}/${_selectedDate.month}/${_selectedDate.year}")
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: listaPromemoria?.length,
|
||||
itemBuilder: (BuildContext context, int index){
|
||||
return Reminder(
|
||||
listaPromemoria?[index]
|
||||
);
|
||||
},
|
||||
),
|
||||
QuickReminder(),
|
||||
],
|
||||
body:
|
||||
ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: (listaPromemoria!.length + 1),
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
if (index == listaPromemoria.length) {
|
||||
return QuickReminder();
|
||||
} else {
|
||||
return Reminder(listaPromemoria[index]);
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user