Merge remote-tracking branch 'origin/firebase' into dev
# Conflicts: # lib/database/database.dart # lib/model/note.dart # lib/model/promemoria.dart # lib/navigation.dart # lib/pages/InboxView.dart # lib/pages/TodayView.dart # pubspec.yaml
This commit is contained in:
@@ -2,6 +2,7 @@ plugins {
|
|||||||
id "com.android.application"
|
id "com.android.application"
|
||||||
id "kotlin-android"
|
id "kotlin-android"
|
||||||
id "dev.flutter.flutter-gradle-plugin"
|
id "dev.flutter.flutter-gradle-plugin"
|
||||||
|
id 'com.google.gms.google-services'
|
||||||
}
|
}
|
||||||
|
|
||||||
def localProperties = new Properties()
|
def localProperties = new Properties()
|
||||||
@@ -64,4 +65,7 @@ flutter {
|
|||||||
source '../..'
|
source '../..'
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {}
|
dependencies {
|
||||||
|
implementation platform('com.google.firebase:firebase-bom:32.3.1')
|
||||||
|
implementation 'com.google.firebase:firebase-analytics-ktx'
|
||||||
|
}
|
||||||
|
|||||||
167
lib/database/FireDb.dart
Normal file
167
lib/database/FireDb.dart
Normal file
@@ -0,0 +1,167 @@
|
|||||||
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/model/promemoria.dart';
|
||||||
|
import 'package:progetto_m335_flutter/model/note.dart';
|
||||||
|
|
||||||
|
class FireDb {
|
||||||
|
|
||||||
|
Future createPromemoria(Promemoria promemoria) async {
|
||||||
|
final docPromemoria =
|
||||||
|
FirebaseFirestore.instance.collection('promemoria').doc();
|
||||||
|
|
||||||
|
final json = {
|
||||||
|
'id': docPromemoria.id,
|
||||||
|
'title': promemoria.getTitle(),
|
||||||
|
'creationDate': promemoria.getCreationDate(),
|
||||||
|
'lastModificationDate': promemoria.getLastModificationDate(),
|
||||||
|
'expirationDate': promemoria.getExpirationDate(),
|
||||||
|
'arrayPromemoria': promemoria.getArrayPromemoria(),
|
||||||
|
'description': promemoria.getDescription(),
|
||||||
|
'priority': promemoria.getPriority(),
|
||||||
|
'color': promemoria.getColor(),
|
||||||
|
};
|
||||||
|
|
||||||
|
await docPromemoria.set(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future createAllPromemoria(List<Promemoria> promemorias) async {
|
||||||
|
for (var promemoria in promemorias) {
|
||||||
|
await createPromemoria(promemoria);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future createNote(Note note) async {
|
||||||
|
final docNote = FirebaseFirestore.instance.collection('note').doc();
|
||||||
|
|
||||||
|
final json = {
|
||||||
|
'id': docNote.id,
|
||||||
|
'title': note.getTitle(),
|
||||||
|
'creationDate': note.getCreationDate(),
|
||||||
|
'lastModificationDate': note.getLastModificationDate(),
|
||||||
|
'arrayPromemoria': note.getArrayPromemoria(),
|
||||||
|
'description': note.getDescription(),
|
||||||
|
};
|
||||||
|
|
||||||
|
await docNote.set(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future createAllNotes(List<Note> notes) async {
|
||||||
|
for (var note in notes) {
|
||||||
|
await createNote(note);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<Promemoria>> readAllPromemoria() async {
|
||||||
|
var promemorias =
|
||||||
|
await FirebaseFirestore.instance.collection('promemoria').get();
|
||||||
|
|
||||||
|
List<Promemoria> promemoriaList = [];
|
||||||
|
|
||||||
|
for (var promemoria in promemorias.docs) {
|
||||||
|
promemoriaList.add(Promemoria.fromJson(promemoria.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return promemoriaList;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<Note>> readAllNotes() async {
|
||||||
|
var notes = await FirebaseFirestore.instance.collection('note').get();
|
||||||
|
|
||||||
|
List<Note> noteList = [];
|
||||||
|
|
||||||
|
for (var note in notes.docs) {
|
||||||
|
noteList.add(Note.fromJson(note.data()));
|
||||||
|
}
|
||||||
|
|
||||||
|
return noteList;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Note?> readNoteById(String id) async {
|
||||||
|
var docNote = await FirebaseFirestore.instance.collection('note').doc(id);
|
||||||
|
final snapshot = await docNote.get();
|
||||||
|
|
||||||
|
if (snapshot.exists) {
|
||||||
|
return Note.fromJson(snapshot.data()!);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Promemoria?> readPromemoriaById(String id) async {
|
||||||
|
final docPromemoria =
|
||||||
|
await FirebaseFirestore.instance.collection('promemoria').doc(id);
|
||||||
|
final snapshot = await docPromemoria.get();
|
||||||
|
|
||||||
|
if (snapshot.exists) {
|
||||||
|
return Promemoria.fromJson(snapshot.data()!);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Future updateNote(Note note) async {
|
||||||
|
final docNote = FirebaseFirestore.instance.collection('note').doc(note.getId());
|
||||||
|
|
||||||
|
final json = {
|
||||||
|
'id': note.getId(),
|
||||||
|
'title': note.getTitle(),
|
||||||
|
'creationDate': note.getCreationDate(),
|
||||||
|
'lastModificationDate': note.getLastModificationDate(),
|
||||||
|
'arrayPromemoria': note.getArrayPromemoria(),
|
||||||
|
'description': note.getDescription(),
|
||||||
|
};
|
||||||
|
|
||||||
|
await docNote.update(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future updatePromemoria(Promemoria promemoria) async {
|
||||||
|
final docPromemoria = FirebaseFirestore.instance.collection('promemoria').doc(promemoria.getId());
|
||||||
|
|
||||||
|
final json = {
|
||||||
|
'id': docPromemoria.id,
|
||||||
|
'title': promemoria.getTitle(),
|
||||||
|
'creationDate': promemoria.getCreationDate(),
|
||||||
|
'lastModificationDate': promemoria.getLastModificationDate(),
|
||||||
|
'expirationDate': promemoria.getExpirationDate(),
|
||||||
|
'arrayPromemoria': promemoria.getArrayPromemoria(),
|
||||||
|
'description': promemoria.getDescription(),
|
||||||
|
'priority': promemoria.getPriority(),
|
||||||
|
'color': promemoria.getColor(),
|
||||||
|
};
|
||||||
|
|
||||||
|
await docPromemoria.update(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
Future deleteNoteById(String id) async {
|
||||||
|
final docNote = FirebaseFirestore.instance.collection('note').doc(id);
|
||||||
|
|
||||||
|
await docNote.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future deletePromemoriaById(String id) async {
|
||||||
|
final docPromemoria = FirebaseFirestore.instance.collection('promemoria').doc(id);
|
||||||
|
|
||||||
|
await docPromemoria.delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future deleteAllNotes() async {
|
||||||
|
var notes = await FirebaseFirestore.instance.collection('note').get();
|
||||||
|
|
||||||
|
for (var note in notes.docs) {
|
||||||
|
await deleteNoteById(note.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future deleteAllPromemoria() async {
|
||||||
|
var promemorias = await FirebaseFirestore.instance.collection('promemoria').get();
|
||||||
|
|
||||||
|
for (var promemoria in promemorias.docs) {
|
||||||
|
await deletePromemoriaById(promemoria.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -22,28 +22,26 @@ class NoteDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Database> _initDB(String filePath) async {
|
Future<Database> _initDB(String filePath) async {
|
||||||
// On Android, it is typically data/data//databases.
|
|
||||||
// On iOS and MacOS, it is the Documents directory.
|
|
||||||
final databasePath = await getDatabasesPath();
|
final databasePath = await getDatabasesPath();
|
||||||
// Directory databasePath = await getApplicationDocumentsDirectory();
|
|
||||||
|
|
||||||
final path = join(databasePath, filePath);
|
final path = join(databasePath, filePath);
|
||||||
return await openDatabase(path, version: 1, onCreate: _createDB);
|
return await openDatabase(path, version: 1, onCreate: _createDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future _createDB(Database database, int version) async {
|
Future _createDB(Database database, int version) async {
|
||||||
//check if the database is created
|
if (await isDatabaseExists()) {
|
||||||
if (database.query(noteTable) != null) {
|
|
||||||
print("Database already created");
|
print("Database already created");
|
||||||
|
deleteDatabase();
|
||||||
|
print("Database deleted");
|
||||||
|
}
|
||||||
|
|
||||||
}else{
|
|
||||||
print("demo data inserting");
|
|
||||||
await database.execute('''CREATE TABLE promemoria (
|
await database.execute('''CREATE TABLE promemoria (
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
title TEXT NOT NULL,
|
title TEXT NOT NULL,
|
||||||
creationDate TEXT NOT NULL,
|
creationDate TEXT NOT NULL,
|
||||||
lastModificationDate TEXT,
|
lastModificationDate TEXT,
|
||||||
expirationDate TEXT,
|
expirationDate TEXT,
|
||||||
|
arrayPromemoria TEXT,
|
||||||
description TEXT,
|
description TEXT,
|
||||||
priority TEXT,
|
priority TEXT,
|
||||||
color TEXT
|
color TEXT
|
||||||
@@ -55,22 +53,32 @@ class NoteDatabase {
|
|||||||
title TEXT NOT NULL,
|
title TEXT NOT NULL,
|
||||||
creationDate TEXT NOT NULL,
|
creationDate TEXT NOT NULL,
|
||||||
lastModificationDate TEXT,
|
lastModificationDate TEXT,
|
||||||
|
arrayPromemoria TEXT,
|
||||||
description TEXT
|
description TEXT
|
||||||
);
|
);
|
||||||
''');
|
''');
|
||||||
|
|
||||||
print("database created");
|
print("database created");
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
await fillDemoData(database, version);
|
await fillDemoData(database, version);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future fillDemoData(Database database, int version) async {
|
Future fillDemoData(Database database, int version) async {
|
||||||
|
|
||||||
print("boh speriamo funzioni");
|
var nota = Note();
|
||||||
// Add some fake accounts
|
nota.setTitle("Nota 1");
|
||||||
|
nota.setCreationDate("2023-09-56");
|
||||||
|
nota.setLastModificationDate("2023-09-56");
|
||||||
|
nota.setArrayPromemoria("1,2,3,4,5");
|
||||||
|
nota.setDescription("Questo è un esempio di nota 1.");
|
||||||
|
|
||||||
|
await createNote(database, nota);
|
||||||
|
|
||||||
|
print(await readNote(1));
|
||||||
|
|
||||||
|
nota.setDescription("ciao");
|
||||||
|
await updateNote (nota);
|
||||||
|
|
||||||
|
print(await readNote (1));
|
||||||
|
|
||||||
// Add fake categories
|
// Add fake categories
|
||||||
await database.execute('''
|
await database.execute('''
|
||||||
@@ -78,6 +86,7 @@ class NoteDatabase {
|
|||||||
title,
|
title,
|
||||||
creationDate,
|
creationDate,
|
||||||
lastModificationDate,
|
lastModificationDate,
|
||||||
|
arrayPromemoria,
|
||||||
description
|
description
|
||||||
) VALUES (
|
) VALUES (
|
||||||
'Nota 2',
|
'Nota 2',
|
||||||
@@ -87,12 +96,12 @@ class NoteDatabase {
|
|||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
|
|
||||||
await database.execute('''
|
await database.execute('''
|
||||||
INSERT INTO note (
|
INSERT INTO note (
|
||||||
title,
|
title,
|
||||||
creationDate,
|
creationDate,
|
||||||
lastModificationDate,
|
lastModificationDate,
|
||||||
|
arrayPromemoria,
|
||||||
description
|
description
|
||||||
) VALUES (
|
) VALUES (
|
||||||
'Nota 2',
|
'Nota 2',
|
||||||
@@ -109,6 +118,7 @@ class NoteDatabase {
|
|||||||
creationDate,
|
creationDate,
|
||||||
lastModificationDate,
|
lastModificationDate,
|
||||||
expirationDate,
|
expirationDate,
|
||||||
|
arrayPromemoria,
|
||||||
description,
|
description,
|
||||||
priority,
|
priority,
|
||||||
color
|
color
|
||||||
@@ -130,6 +140,7 @@ class NoteDatabase {
|
|||||||
creationDate,
|
creationDate,
|
||||||
lastModificationDate,
|
lastModificationDate,
|
||||||
expirationDate,
|
expirationDate,
|
||||||
|
arrayPromemoria,
|
||||||
description,
|
description,
|
||||||
priority,
|
priority,
|
||||||
color
|
color
|
||||||
@@ -159,6 +170,27 @@ class NoteDatabase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future close() async {
|
||||||
|
final database = await instance.database;
|
||||||
|
database.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> deleteDatabase() async {
|
||||||
|
final databasePath = await getDatabasesPath();
|
||||||
|
final path = join(databasePath, 'note.db');
|
||||||
|
databaseFactory.deleteDatabase(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> isDatabaseExists() async {
|
||||||
|
final databasePath = await getDatabasesPath();
|
||||||
|
final path = join(databasePath, 'note.db');
|
||||||
|
// Apre il database in modalità sola lettura.
|
||||||
|
Database database = await openDatabase(path, readOnly: true);
|
||||||
|
|
||||||
|
// Restituisce true se il database è stato aperto correttamente, altrimenti false.
|
||||||
|
return database.isOpen;
|
||||||
|
}
|
||||||
|
|
||||||
Future<List<Map>> selectAllPromemoria() async {
|
Future<List<Map>> selectAllPromemoria() async {
|
||||||
final db = await database;
|
final db = await database;
|
||||||
|
|
||||||
@@ -167,15 +199,61 @@ class NoteDatabase {
|
|||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future close() async {
|
Future<List<Map>> selectAllNotes() async {
|
||||||
final database = await instance.database;
|
final db = await database;
|
||||||
database.close();
|
|
||||||
|
final List<Map<String, dynamic>> maps = await db.query(noteTable);
|
||||||
|
|
||||||
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARNING: FOR DEV/TEST PURPOSES ONLY!!
|
Future<void> createNote(Database database, Note note) async {
|
||||||
Future<void> deleteDatabase() async {
|
await database.insert(
|
||||||
final databasePath = await getDatabasesPath();
|
'note',
|
||||||
final path = join(databasePath, 'note.db');
|
note.toMap(),
|
||||||
databaseFactory.deleteDatabase(path);
|
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
|
);
|
||||||
|
|
||||||
|
print('note $note.title inserted');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> createPromemoria(
|
||||||
|
Database database, Promemoria promemoria) async {
|
||||||
|
await database.insert(
|
||||||
|
'promemoria',
|
||||||
|
promemoria.toMap(),
|
||||||
|
conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
|
);
|
||||||
|
|
||||||
|
print('promemoria $promemoria.title inserted');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, Object?>> readPromemoria(int id) async {
|
||||||
|
final db = await database;
|
||||||
|
|
||||||
|
final results = await db.query('SELECT * FROM note where id=$id');
|
||||||
|
return results.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<Map<String, Object?>> readNote(int id) async {
|
||||||
|
final db = await database;
|
||||||
|
|
||||||
|
final results = await db.query('SELECT * FROM promemoria where id=$id');
|
||||||
|
|
||||||
|
return results.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updatePromemoria(Promemoria promemoria) async {
|
||||||
|
final db = await database;
|
||||||
|
|
||||||
|
await db.update('promemoria', promemoria.toMap(),
|
||||||
|
where: 'id = ?', whereArgs: [promemoria.getId()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateNote(Note note) async {
|
||||||
|
final db = await database;
|
||||||
|
|
||||||
|
await db.update('note', note.toMap(),
|
||||||
|
where: 'id = ?', whereArgs: [note.getId()]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
|
import 'package:firebase_core/firebase_core.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'myApp.dart';
|
import 'myApp.dart';
|
||||||
|
|
||||||
void main() {
|
Future<void> main() async {
|
||||||
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
await Firebase.initializeApp();
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
|
print("App started");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,87 @@ import 'base_entity.dart';
|
|||||||
|
|
||||||
const String noteTable = 'note';
|
const String noteTable = 'note';
|
||||||
|
|
||||||
class Note extends BaseEntity {
|
class Note{
|
||||||
static String id = BaseEntity.getId;
|
String id;
|
||||||
static String title = BaseEntity.getTitle;
|
String title;
|
||||||
static String creationDate = BaseEntity.getCreationDate;
|
String creationDate;
|
||||||
static String lastModificationDate = BaseEntity.getLastEditDate;
|
String lastModificationDate;
|
||||||
static String arrayPromemoria = '';
|
String arrayPromemoria;
|
||||||
static String description = '';
|
String description;
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'title': title,
|
||||||
|
'creationDate': creationDate,
|
||||||
|
'lastModificationDate': lastModificationDate,
|
||||||
|
'arrayPromemoria': arrayPromemoria,
|
||||||
|
'description': description
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Note(
|
||||||
|
this.id,
|
||||||
|
this.title,
|
||||||
|
this.creationDate,
|
||||||
|
this.lastModificationDate,
|
||||||
|
this.arrayPromemoria,
|
||||||
|
this.description,
|
||||||
|
);
|
||||||
|
|
||||||
|
String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setId(String id1) {
|
||||||
|
id = id1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTitle(String title1) {
|
||||||
|
title = title1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCreationDate() {
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCreationDate(String creationDate1) {
|
||||||
|
creationDate = creationDate1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getLastModificationDate() {
|
||||||
|
return lastModificationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLastModificationDate(String lastModificationDate1) {
|
||||||
|
lastModificationDate = lastModificationDate1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getArrayPromemoria() {
|
||||||
|
return arrayPromemoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setArrayPromemoria(String arrayPromemoria1) {
|
||||||
|
arrayPromemoria = arrayPromemoria1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDescription(String description1) {
|
||||||
|
description = description1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Note fromJson(Map<String, dynamic> data) => Note(
|
||||||
|
data['id'],
|
||||||
|
data['title'],
|
||||||
|
data['creationDate'],
|
||||||
|
data['lastModificationDate'],
|
||||||
|
data['arrayPromemoria'],
|
||||||
|
data['description']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,16 +4,138 @@ import 'identifiers/enum/priority.dart';
|
|||||||
|
|
||||||
const String promemoriaTable = 'promemoria';
|
const String promemoriaTable = 'promemoria';
|
||||||
|
|
||||||
class Promemoria extends BaseEntity {
|
class Promemoria {
|
||||||
static String expirationDate = '';
|
String id = '';
|
||||||
static String arrayPromemoria = '';
|
String title;
|
||||||
String description = '';
|
String creationDate;
|
||||||
static Priority priority = Priority.none;
|
String lastModificationDate;
|
||||||
|
String expirationDate;
|
||||||
|
String arrayPromemoria;
|
||||||
|
String description;
|
||||||
|
String priority;
|
||||||
|
String color;
|
||||||
|
|
||||||
static Color color = Color.none;
|
Promemoria(
|
||||||
|
this.id,
|
||||||
|
this.title,
|
||||||
|
this.creationDate,
|
||||||
|
this.lastModificationDate,
|
||||||
|
this.expirationDate,
|
||||||
|
this.arrayPromemoria,
|
||||||
|
this.description,
|
||||||
|
this.priority,
|
||||||
|
this.color);
|
||||||
|
|
||||||
Promemoria(String description){
|
Promemoria.newConstructor(
|
||||||
this.description = description;
|
this.title,
|
||||||
|
this.creationDate,
|
||||||
|
this.lastModificationDate,
|
||||||
|
this.expirationDate,
|
||||||
|
this.arrayPromemoria,
|
||||||
|
this.description,
|
||||||
|
this.priority,
|
||||||
|
this.color);
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {
|
||||||
|
'id': id,
|
||||||
|
'title': title,
|
||||||
|
'creationDate': creationDate,
|
||||||
|
'lastModificationDate': lastModificationDate,
|
||||||
|
'expirationDate': expirationDate,
|
||||||
|
'arrayPromemoria': arrayPromemoria,
|
||||||
|
'description': description,
|
||||||
|
'priority': priority,
|
||||||
|
'color': color,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setId(String id1) {
|
||||||
|
id = id1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setTitle(String title1) {
|
||||||
|
title = title1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getCreationDate() {
|
||||||
|
return creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCreationDate(String creationDate1) {
|
||||||
|
creationDate = creationDate1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getLastModificationDate() {
|
||||||
|
return lastModificationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setLastModificationDate(String lastModificationDate1) {
|
||||||
|
lastModificationDate = lastModificationDate1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getExpirationDate() {
|
||||||
|
return expirationDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setExpirationDate(String expirationDate1) {
|
||||||
|
expirationDate = expirationDate1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getArrayPromemoria() {
|
||||||
|
return arrayPromemoria;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setArrayPromemoria(String arrayPromemoria1) {
|
||||||
|
arrayPromemoria = arrayPromemoria1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDescription(String description1) {
|
||||||
|
description = description1;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setPriority(Priority priority1) {
|
||||||
|
priority = priority1.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setColor(Color color1) {
|
||||||
|
color = color1.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
static Promemoria fromJson(Map<String, dynamic> data) {
|
||||||
|
Promemoria promemoria = Promemoria(
|
||||||
|
data['id'],
|
||||||
|
data['title'],
|
||||||
|
data['creationDate'],
|
||||||
|
data['lastModificationDate'],
|
||||||
|
data['expirationDate'],
|
||||||
|
data['arrayPromemoria'],
|
||||||
|
data['description'],
|
||||||
|
data['priority'],
|
||||||
|
data['color']);
|
||||||
|
|
||||||
|
print(promemoria.getId().toString());
|
||||||
|
|
||||||
|
return promemoria;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'navigation.dart';
|
|||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({ Key? key }) : super(key: key);
|
const MyApp({ Key? key }) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ dependencies:
|
|||||||
sqflite: ^2.3.0
|
sqflite: ^2.3.0
|
||||||
path: ^1.8.3
|
path: ^1.8.3
|
||||||
sqflite_common_ffi: ^2.3.0+2
|
sqflite_common_ffi: ^2.3.0+2
|
||||||
|
cloud_firestore: ^4.9.2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in New Issue
Block a user