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;
|
||||
});
|
||||
|
||||
@@ -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,46 @@ class TodayView extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _TodayViewState extends State<TodayView> {
|
||||
|
||||
var _selectedDate = DateTime.now();
|
||||
|
||||
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"),
|
||||
];
|
||||
|
||||
|
||||
|
||||
@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: <Widget>[
|
||||
Reminder(),
|
||||
Reminder(),
|
||||
]),
|
||||
body: ListView(
|
||||
children: [
|
||||
ListView.builder(
|
||||
scrollDirection: Axis.vertical,
|
||||
shrinkWrap: true,
|
||||
itemCount: listaPromemoria?.length,
|
||||
itemBuilder: (BuildContext context, int index){
|
||||
return Reminder(
|
||||
listaPromemoria?[index]
|
||||
);
|
||||
},
|
||||
),
|
||||
QuickReminder(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user