Merge remote-tracking branch 'origin/Joe' into Zina
This commit is contained in:
37
lib/database/database.dart
Normal file
37
lib/database/database.dart
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
import 'package:progetto_m335_flutter/model/note.dart';
|
||||||
|
|
||||||
|
class Database{
|
||||||
|
static final Database _instance = Database._init();
|
||||||
|
static Database? _database;
|
||||||
|
|
||||||
|
Database._init();
|
||||||
|
|
||||||
|
Future<Database> get database async {
|
||||||
|
if (_database != null) return _database!;
|
||||||
|
_database = await _initDB('database.db');
|
||||||
|
|
||||||
|
return _database!;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _createDB(Database database) async{
|
||||||
|
const integerPrimaryKeyAutoincrement = 'INTEGER PRIMARY KEY AUTOINCREMENT';
|
||||||
|
const textNotNull = 'TEXT NOT NULL';
|
||||||
|
const integerNotNull = 'INTEGER NOT NULL';
|
||||||
|
const integer = 'INTEGER';
|
||||||
|
const real = 'REAL';
|
||||||
|
const text = 'TEXT';
|
||||||
|
|
||||||
|
|
||||||
|
await database.execute('''
|
||||||
|
CREATE TABLE $Note (
|
||||||
|
${Note.id} $integerPrimaryKeyAutoincrement,
|
||||||
|
|
||||||
|
)
|
||||||
|
''');
|
||||||
|
}
|
||||||
|
|
||||||
|
execute(String s) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import 'base_entity.dart';
|
|
||||||
|
|
||||||
class Note extends BaseEntity{
|
|
||||||
static String id = BaseEntity.getId;
|
|
||||||
static String Title = BaseEntity.getTitle;
|
|
||||||
static String CreationDate = BaseEntity.getCreationDate;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
import 'base_entity.dart';
|
import 'base_entity.dart';
|
||||||
import 'identifiers/enum/priority.dart';
|
|
||||||
|
|
||||||
class Note extends BaseEntity{
|
const String noteTable = 'note';
|
||||||
|
|
||||||
|
class Note extends BaseEntity {
|
||||||
static String id = BaseEntity.getId;
|
static String id = BaseEntity.getId;
|
||||||
static String title = BaseEntity.getTitle;
|
static String title = BaseEntity.getTitle;
|
||||||
static String creationDate = BaseEntity.getCreationDate;
|
static String creationDate = BaseEntity.getCreationDate;
|
||||||
static String expirationDate = 'expirationDate';
|
static String lastModificationDate = BaseEntity.getLastEditDate;
|
||||||
Priority priority = Priority.low;
|
static String description = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
23
lib/model/promemoria.dart
Normal file
23
lib/model/promemoria.dart
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
|
import 'base_entity.dart';
|
||||||
|
import 'identifiers/enum/color.dart';
|
||||||
|
import 'identifiers/enum/priority.dart';
|
||||||
|
|
||||||
|
const String promemoriaTable = 'promemoria';
|
||||||
|
|
||||||
|
class Promemoria extends BaseEntity{
|
||||||
|
static String id = BaseEntity.getId;
|
||||||
|
static String title = BaseEntity.getTitle;
|
||||||
|
static String creationDate = BaseEntity.getCreationDate;
|
||||||
|
static String lastModificationDate = BaseEntity.getLastEditDate;
|
||||||
|
static String expirationDate = '';
|
||||||
|
static String description = '';
|
||||||
|
|
||||||
|
static Priority priority = Priority.none;
|
||||||
|
static Color color = Color.none;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
import 'package:progetto_m335_flutter/main.dart';
|
import 'package:progetto_m335_flutter/myApp.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||||
|
|||||||
Reference in New Issue
Block a user