new ui model integration
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../Components/EditReminderButton.dart';
|
||||
import '../model/promemoria.dart';
|
||||
import '../pages/EditReminder.dart';
|
||||
|
||||
@@ -30,12 +29,12 @@ class _ReminderState extends State<Reminder> {
|
||||
value: _value,
|
||||
onChanged: _onChanged,
|
||||
),
|
||||
title: Text(widget.promemoria?.description ?? 'Nessun titolo'),
|
||||
title: Text(widget.promemoria?.getTitle() ?? 'Nessun titolo'),
|
||||
subtitle: Text(DateTime.now().toString()),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => EditReminder()),
|
||||
MaterialPageRoute(builder: (context) => EditReminder(widget.promemoria)),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -6,14 +6,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,
|
||||
@@ -34,7 +34,23 @@ class Promemoria {
|
||||
this.arrayPromemoria,
|
||||
this.description,
|
||||
this.priority,
|
||||
this.color);
|
||||
this.color
|
||||
);
|
||||
|
||||
Promemoria.today(
|
||||
this.title,
|
||||
this.creationDate,
|
||||
this.lastModificationDate,
|
||||
this.expirationDate,
|
||||
this.description,
|
||||
);
|
||||
|
||||
Promemoria.inbox(
|
||||
this.title,
|
||||
this.creationDate,
|
||||
this.lastModificationDate,
|
||||
this.description,
|
||||
);
|
||||
|
||||
Map<String, dynamic> toMap() {
|
||||
return {
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:progetto_m335_flutter/model/promemoria.dart';
|
||||
|
||||
class EditReminder extends StatefulWidget {
|
||||
const EditReminder({super.key});
|
||||
final Promemoria? promemoria;
|
||||
const EditReminder(this.promemoria, {super.key});
|
||||
|
||||
@override
|
||||
State<EditReminder> createState() => _EditReminderState();
|
||||
}
|
||||
|
||||
class _EditReminderState extends State<EditReminder> {
|
||||
String _title = "ciaciao";
|
||||
String _description = "description";
|
||||
final String _title = "ciaciao";
|
||||
String _description = "";
|
||||
DateTime? _date;
|
||||
|
||||
//Arraylist of promemoria
|
||||
|
||||
bool _hasDate = true;
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
_description = widget.promemoria?.description ?? "";
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -27,16 +33,23 @@ class _EditReminderState extends State<EditReminder> {
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
TextField(
|
||||
controller: TextEditingController(text: _title),
|
||||
TextFormField(
|
||||
initialValue: widget.promemoria?.title ?? "",
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Title',
|
||||
),
|
||||
onChanged: (text) {
|
||||
setState(() {
|
||||
widget.promemoria?.setTitle(text);
|
||||
});
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
TextFormField(
|
||||
initialValue: widget.promemoria?.description ?? "",
|
||||
onChanged: (text) {
|
||||
print(text);
|
||||
setState(() {
|
||||
_description = text;
|
||||
});
|
||||
|
||||
@@ -17,9 +17,8 @@ class _TodayViewState extends State<TodayView> {
|
||||
var _selectedDate = DateTime.now();
|
||||
|
||||
List<Promemoria> listaPromemoria = [
|
||||
new Promemoria("Primo promemoria"),
|
||||
new Promemoria("Secondo promemoria"),
|
||||
new Promemoria("Terzo promemoria"),
|
||||
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"),
|
||||
];
|
||||
|
||||
|
||||
@@ -45,10 +44,10 @@ class _TodayViewState extends State<TodayView> {
|
||||
ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: listaPromemoria.length,
|
||||
itemCount: listaPromemoria?.length,
|
||||
itemBuilder: (BuildContext context, int index){
|
||||
return Reminder(
|
||||
listaPromemoria[index]
|
||||
listaPromemoria?[index]
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user