new ui model integration
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
import '../Components/EditReminderButton.dart';
|
|
||||||
import '../model/promemoria.dart';
|
import '../model/promemoria.dart';
|
||||||
import '../pages/EditReminder.dart';
|
import '../pages/EditReminder.dart';
|
||||||
|
|
||||||
@@ -30,12 +29,12 @@ class _ReminderState extends State<Reminder> {
|
|||||||
value: _value,
|
value: _value,
|
||||||
onChanged: _onChanged,
|
onChanged: _onChanged,
|
||||||
),
|
),
|
||||||
title: Text(widget.promemoria?.description ?? 'Nessun titolo'),
|
title: Text(widget.promemoria?.getTitle() ?? 'Nessun titolo'),
|
||||||
subtitle: Text(DateTime.now().toString()),
|
subtitle: Text(DateTime.now().toString()),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => EditReminder()),
|
MaterialPageRoute(builder: (context) => EditReminder(widget.promemoria)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,14 +6,14 @@ const String promemoriaTable = 'promemoria';
|
|||||||
|
|
||||||
class Promemoria {
|
class Promemoria {
|
||||||
String id = '';
|
String id = '';
|
||||||
String title;
|
String title = '';
|
||||||
String creationDate;
|
String creationDate = '';
|
||||||
String lastModificationDate;
|
String lastModificationDate = '';
|
||||||
String expirationDate;
|
String expirationDate = '';
|
||||||
String arrayPromemoria;
|
String arrayPromemoria = '';
|
||||||
String description;
|
String description = '';
|
||||||
String priority;
|
String priority = '';
|
||||||
String color;
|
String color = '';
|
||||||
|
|
||||||
Promemoria(
|
Promemoria(
|
||||||
this.id,
|
this.id,
|
||||||
@@ -34,7 +34,23 @@ class Promemoria {
|
|||||||
this.arrayPromemoria,
|
this.arrayPromemoria,
|
||||||
this.description,
|
this.description,
|
||||||
this.priority,
|
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() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1,20 +1,26 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/model/promemoria.dart';
|
||||||
|
|
||||||
class EditReminder extends StatefulWidget {
|
class EditReminder extends StatefulWidget {
|
||||||
const EditReminder({super.key});
|
final Promemoria? promemoria;
|
||||||
|
const EditReminder(this.promemoria, {super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<EditReminder> createState() => _EditReminderState();
|
State<EditReminder> createState() => _EditReminderState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EditReminderState extends State<EditReminder> {
|
class _EditReminderState extends State<EditReminder> {
|
||||||
String _title = "ciaciao";
|
final String _title = "ciaciao";
|
||||||
String _description = "description";
|
String _description = "";
|
||||||
DateTime? _date;
|
DateTime? _date;
|
||||||
|
|
||||||
//Arraylist of promemoria
|
//Arraylist of promemoria
|
||||||
|
@override
|
||||||
bool _hasDate = true;
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
_description = widget.promemoria?.description ?? "";
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -27,16 +33,23 @@ class _EditReminderState extends State<EditReminder> {
|
|||||||
padding: EdgeInsets.all(16.0),
|
padding: EdgeInsets.all(16.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
TextField(
|
TextFormField(
|
||||||
controller: TextEditingController(text: _title),
|
initialValue: widget.promemoria?.title ?? "",
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(),
|
||||||
labelText: 'Title',
|
labelText: 'Title',
|
||||||
),
|
),
|
||||||
|
onChanged: (text) {
|
||||||
|
setState(() {
|
||||||
|
widget.promemoria?.setTitle(text);
|
||||||
|
});
|
||||||
|
},
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
TextField(
|
TextFormField(
|
||||||
|
initialValue: widget.promemoria?.description ?? "",
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
|
print(text);
|
||||||
setState(() {
|
setState(() {
|
||||||
_description = text;
|
_description = text;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
//import components
|
//import components
|
||||||
import '../Components/Reminder.dart';
|
import '../Components/Reminder.dart';
|
||||||
import '../Components/EditReminderButton.dart';
|
import '../Components/QuickReminder.dart';
|
||||||
|
import '../model/promemoria.dart';
|
||||||
|
|
||||||
class TodayView extends StatefulWidget {
|
class TodayView extends StatefulWidget {
|
||||||
const TodayView({super.key});
|
const TodayView({super.key});
|
||||||
@@ -12,21 +13,46 @@ class TodayView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _TodayViewState extends State<TodayView> {
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(
|
title: FilledButton(
|
||||||
'Today',
|
onPressed: () async {
|
||||||
style: TextStyle(color: Colors.white),
|
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(
|
body: ListView(
|
||||||
child: ListView(children: <Widget>[
|
children: [
|
||||||
Reminder(),
|
ListView.builder(
|
||||||
Reminder(),
|
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