This commit is contained in:
2023-09-27 13:43:04 +02:00
parent 929c4cc403
commit 58e013a709
2 changed files with 44 additions and 1 deletions

View File

@@ -0,0 +1,36 @@
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) {
}
}

View File

@@ -1,11 +1,18 @@
import 'dart:ui';
import 'base_entity.dart'; import 'base_entity.dart';
import 'identifiers/enum/priority.dart'; import 'identifiers/enum/priority.dart';
import 'identifiers/enum/color.dart';
class Note extends BaseEntity{ 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 expirationDate = 'expirationDate';
Priority priority = Priority.low; static String description = 'description';
Priority priority = Priority.none;
Color color = Color.none;
} }