fix init database
This commit is contained in:
@@ -11,7 +11,7 @@ class QuickReminder extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _QuickReminderState extends State<QuickReminder> {
|
||||
NoteDatabase db = NoteDatabase.instance;
|
||||
NoteDatabase noteDatabase = NoteDatabase.instance;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -24,8 +24,9 @@ class _QuickReminderState extends State<QuickReminder> {
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'New Reminder',
|
||||
),
|
||||
onSubmitted: (String value) {
|
||||
db.addPromemoria(Promemoria.today(
|
||||
onSubmitted: (String value) async{
|
||||
final db = await noteDatabase.database;
|
||||
noteDatabase.addPromemoria(Promemoria.today(
|
||||
value,
|
||||
DateTime.now().toString(),
|
||||
DateTime.now().toString(),
|
||||
|
||||
@@ -19,7 +19,7 @@ class _TodayViewState extends State<TodayView> {
|
||||
|
||||
List<Promemoria> listaPromemoria = [];
|
||||
|
||||
NoteDatabase db = NoteDatabase.instance;
|
||||
NoteDatabase noteDatabase = NoteDatabase.instance;
|
||||
|
||||
/*[
|
||||
Promemoria.today("Primo promemoria", DateTime.now().toString(), DateTime.now().toString(), DateTime.now().toString(), "Descrizione primo promemoria"),
|
||||
@@ -27,7 +27,8 @@ class _TodayViewState extends State<TodayView> {
|
||||
];*/
|
||||
|
||||
getAllPromemoria() async {
|
||||
List<Promemoria> temp = await db.getAllPromemoria() as List<Promemoria>;
|
||||
final db = await noteDatabase.database;
|
||||
List<Promemoria> temp = await noteDatabase.getAllPromemoria() as List<Promemoria>;
|
||||
setState(() {
|
||||
listaPromemoria = temp;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user