Compare commits
9 Commits
controller
...
Tito
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51f964833e | ||
|
|
5c68d85b98 | ||
|
|
7d1bec6b0c | ||
|
|
c2824c99a4 | ||
|
|
e061871c4f | ||
|
|
29a54bbcbc | ||
|
|
330d0e4c61 | ||
|
|
6a05861341 | ||
|
|
4006030f5b |
25
lib/Components/QuickReminder.dart
Normal file
25
lib/Components/QuickReminder.dart
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class QuickReminder extends StatefulWidget {
|
||||||
|
const QuickReminder({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<QuickReminder> createState() => _QuickReminderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _QuickReminderState extends State<QuickReminder> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const ListTile(
|
||||||
|
leading: Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged: null,
|
||||||
|
),
|
||||||
|
title: TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: 'New Reminder',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
40
lib/Components/Reminder.dart
Normal file
40
lib/Components/Reminder.dart
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../model/promemoria.dart';
|
||||||
|
import '../pages/EditReminder.dart';
|
||||||
|
|
||||||
|
class Reminder extends StatefulWidget {
|
||||||
|
final Promemoria? promemoria;
|
||||||
|
const Reminder(this.promemoria, {super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Reminder> createState() => _ReminderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _ReminderState extends State<Reminder> {
|
||||||
|
bool _value = false;
|
||||||
|
|
||||||
|
void _onChanged(bool? newValue) {
|
||||||
|
setState(() {
|
||||||
|
_value = newValue ?? false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
leading: Checkbox(
|
||||||
|
value: _value,
|
||||||
|
onChanged: _onChanged,
|
||||||
|
),
|
||||||
|
title: Text(widget.promemoria?.description ?? 'Nessun titolo'),
|
||||||
|
subtitle: Text(DateTime.now().toString()),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => EditReminder(widget.promemoria)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
abstract class BaseEntity{
|
|
||||||
static String id = 'id';
|
|
||||||
static String title = 'Title';
|
|
||||||
static String creationDate = 'CreationDate';
|
|
||||||
static String lastEditDate = 'LastEditDate';
|
|
||||||
|
|
||||||
static String get getId{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
static String get getTitle{
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
static String get getCreationDate{
|
|
||||||
return creationDate;
|
|
||||||
}
|
|
||||||
static String get getLastEditDate{
|
|
||||||
return lastEditDate;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
181
lib/database/database.dart
Normal file
181
lib/database/database.dart
Normal file
@@ -0,0 +1,181 @@
|
|||||||
|
import 'package:path/path.dart';
|
||||||
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
|
||||||
|
// Models
|
||||||
|
import 'package:progetto_m335_flutter/model/note.dart';
|
||||||
|
import 'package:progetto_m335_flutter/model/promemoria.dart';
|
||||||
|
|
||||||
|
class NoteDatabase {
|
||||||
|
static final NoteDatabase instance = NoteDatabase._init();
|
||||||
|
static Database? _database;
|
||||||
|
|
||||||
|
// Zero args constructor needed to extend this class
|
||||||
|
NoteDatabase();
|
||||||
|
|
||||||
|
NoteDatabase._init();
|
||||||
|
|
||||||
|
Future<Database> get database async {
|
||||||
|
if (_database != null) return _database!;
|
||||||
|
|
||||||
|
_database = await _initDB('note.db');
|
||||||
|
return _database!;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
// Directory databasePath = await getApplicationDocumentsDirectory();
|
||||||
|
|
||||||
|
final path = join(databasePath, filePath);
|
||||||
|
return await openDatabase(path, version: 1, onCreate: _createDB);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future _createDB(Database database, int version) async {
|
||||||
|
//check if the database is created
|
||||||
|
if (database.query(noteTable) != null) {
|
||||||
|
print("Database already created");
|
||||||
|
|
||||||
|
}else{
|
||||||
|
print("demo data inserting");
|
||||||
|
await database.execute('''CREATE TABLE promemoria (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
creationDate TEXT NOT NULL,
|
||||||
|
lastModificationDate TEXT,
|
||||||
|
expirationDate TEXT,
|
||||||
|
description TEXT,
|
||||||
|
priority TEXT,
|
||||||
|
color TEXT
|
||||||
|
);
|
||||||
|
''');
|
||||||
|
|
||||||
|
await database.execute('''CREATE TABLE note (
|
||||||
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
|
title TEXT NOT NULL,
|
||||||
|
creationDate TEXT NOT NULL,
|
||||||
|
lastModificationDate TEXT,
|
||||||
|
description TEXT
|
||||||
|
);
|
||||||
|
''');
|
||||||
|
|
||||||
|
print("database created");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
await fillDemoData(database, version);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future fillDemoData(Database database, int version) async {
|
||||||
|
|
||||||
|
print("boh speriamo funzioni");
|
||||||
|
// Add some fake accounts
|
||||||
|
|
||||||
|
|
||||||
|
// Add fake categories
|
||||||
|
await database.execute('''
|
||||||
|
INSERT INTO note (
|
||||||
|
title,
|
||||||
|
creationDate,
|
||||||
|
lastModificationDate,
|
||||||
|
description
|
||||||
|
) VALUES (
|
||||||
|
'Nota 2',
|
||||||
|
'2023-09-28',
|
||||||
|
'2023-09-28',
|
||||||
|
'Questo è un esempio di nota 2.'
|
||||||
|
)
|
||||||
|
''');
|
||||||
|
|
||||||
|
|
||||||
|
await database.execute('''
|
||||||
|
INSERT INTO note (
|
||||||
|
title,
|
||||||
|
creationDate,
|
||||||
|
lastModificationDate,
|
||||||
|
description
|
||||||
|
) VALUES (
|
||||||
|
'Nota 2',
|
||||||
|
'2023-09-28',
|
||||||
|
'2023-09-28',
|
||||||
|
'Questo è un esempio di nota 2.'
|
||||||
|
)
|
||||||
|
''');
|
||||||
|
|
||||||
|
// Add currencies
|
||||||
|
await database.execute('''
|
||||||
|
INSERT INTO promemoria (
|
||||||
|
title,
|
||||||
|
creationDate,
|
||||||
|
lastModificationDate,
|
||||||
|
expirationDate,
|
||||||
|
description,
|
||||||
|
priority,
|
||||||
|
color
|
||||||
|
) VALUES (
|
||||||
|
'Promemoria 1',
|
||||||
|
'2023-09-27',
|
||||||
|
'2023-09-27',
|
||||||
|
'2023-10-05',
|
||||||
|
'Questo è un esempio di promemoria 1.',
|
||||||
|
'Alta',
|
||||||
|
'Rosso'
|
||||||
|
)
|
||||||
|
''');
|
||||||
|
|
||||||
|
// Add fake budgets
|
||||||
|
await database.execute('''
|
||||||
|
INSERT INTO promemoria (
|
||||||
|
title,
|
||||||
|
creationDate,
|
||||||
|
lastModificationDate,
|
||||||
|
expirationDate,
|
||||||
|
description,
|
||||||
|
priority,
|
||||||
|
color
|
||||||
|
) VALUES (
|
||||||
|
'Promemoria 2',
|
||||||
|
'2023-09-28',
|
||||||
|
'2023-09-28',
|
||||||
|
'2023-10-10',
|
||||||
|
'Questo è un esempio di promemoria 2.',
|
||||||
|
'Media',
|
||||||
|
'Verde'
|
||||||
|
)
|
||||||
|
''');
|
||||||
|
print("Demo data inserted");
|
||||||
|
}
|
||||||
|
|
||||||
|
Future clearDatabase() async {
|
||||||
|
try {
|
||||||
|
await _database?.transaction((txn) async {
|
||||||
|
var batch = txn.batch();
|
||||||
|
batch.delete(noteTable);
|
||||||
|
batch.delete(promemoriaTable);
|
||||||
|
await batch.commit();
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
throw Exception('DbBase.cleanDatabase: $error');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<List<Map>> selectAllPromemoria() async {
|
||||||
|
final db = await database;
|
||||||
|
|
||||||
|
final List<Map<String, dynamic>> maps = await db.query(promemoriaTable);
|
||||||
|
|
||||||
|
return maps;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future close() async {
|
||||||
|
final database = await instance.database;
|
||||||
|
database.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
// WARNING: FOR DEV/TEST PURPOSES ONLY!!
|
||||||
|
Future<void> deleteDatabase() async {
|
||||||
|
final databasePath = await getDatabasesPath();
|
||||||
|
final path = join(databasePath, 'note.db');
|
||||||
|
databaseFactory.deleteDatabase(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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 +0,0 @@
|
|||||||
import 'base_entity.dart';
|
|
||||||
import 'identifiers/enum/priority.dart';
|
|
||||||
|
|
||||||
class Note extends BaseEntity{
|
|
||||||
static String id = BaseEntity.getId;
|
|
||||||
static String title = BaseEntity.getTitle;
|
|
||||||
static String creationDate = BaseEntity.getCreationDate;
|
|
||||||
static String expirationDate = 'expirationDate';
|
|
||||||
Priority priority = Priority.low;
|
|
||||||
}
|
|
||||||
|
|
||||||
8
lib/model/base_entity.dart
Normal file
8
lib/model/base_entity.dart
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
abstract class BaseEntity{
|
||||||
|
String id = 'id';
|
||||||
|
String title = 'Title';
|
||||||
|
String creationDate = 'CreationDate';
|
||||||
|
String lastEditDate = 'LastEditDate';
|
||||||
|
|
||||||
|
BaseEntity();
|
||||||
|
}
|
||||||
12
lib/model/note.dart
Normal file
12
lib/model/note.dart
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import 'base_entity.dart';
|
||||||
|
|
||||||
|
const String noteTable = 'note';
|
||||||
|
|
||||||
|
class Note extends BaseEntity {
|
||||||
|
static String id = BaseEntity.getId;
|
||||||
|
static String title = BaseEntity.getTitle;
|
||||||
|
static String creationDate = BaseEntity.getCreationDate;
|
||||||
|
static String lastModificationDate = BaseEntity.getLastEditDate;
|
||||||
|
static String arrayPromemoria = '';
|
||||||
|
static String description = '';
|
||||||
|
}
|
||||||
19
lib/model/promemoria.dart
Normal file
19
lib/model/promemoria.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'base_entity.dart';
|
||||||
|
import 'identifiers/enum/color.dart';
|
||||||
|
import 'identifiers/enum/priority.dart';
|
||||||
|
|
||||||
|
const String promemoriaTable = 'promemoria';
|
||||||
|
|
||||||
|
class Promemoria extends BaseEntity {
|
||||||
|
static String expirationDate = '';
|
||||||
|
static String arrayPromemoria = '';
|
||||||
|
String description = '';
|
||||||
|
static Priority priority = Priority.none;
|
||||||
|
|
||||||
|
static Color color = Color.none;
|
||||||
|
|
||||||
|
Promemoria(String description) : super(){
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,7 +10,9 @@ class MyApp extends StatelessWidget {
|
|||||||
title: 'My App',
|
title: 'My App',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
primaryColor: Colors.red,
|
colorSchemeSeed: Colors.blue,
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
home: Navigation()
|
home: Navigation()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'testUI.dart';
|
import 'pages/TodayView.dart';
|
||||||
|
import 'pages/InboxView.dart';
|
||||||
|
import 'pages/NotesView.dart';
|
||||||
|
|
||||||
|
|
||||||
class Navigation extends StatefulWidget {
|
class Navigation extends StatefulWidget {
|
||||||
const Navigation({super.key});
|
const Navigation({super.key});
|
||||||
@@ -14,9 +17,9 @@ class _NavigationState extends State<Navigation> {
|
|||||||
|
|
||||||
int _selectedIndex = 0;
|
int _selectedIndex = 0;
|
||||||
static const List<Widget> _widgetOptions = <Widget>[
|
static const List<Widget> _widgetOptions = <Widget>[
|
||||||
TestUI(),
|
TodayView(),
|
||||||
Text("Inbox"),
|
InboxView(),
|
||||||
Text("Notes"),
|
NotesView(),
|
||||||
];
|
];
|
||||||
|
|
||||||
void _onItemTapped(int index) {
|
void _onItemTapped(int index) {
|
||||||
@@ -28,19 +31,17 @@ class _NavigationState extends State<Navigation> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
body: SafeArea(child: _widgetOptions.elementAt(_selectedIndex)),
|
||||||
title: Text("BottomNavBar"),
|
|
||||||
),
|
|
||||||
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
|
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: const <BottomNavigationBarItem>[
|
items: const <BottomNavigationBarItem>[
|
||||||
BottomNavigationBarItem(
|
BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.calendar_today), label: "today"),
|
icon: Icon(Icons.today), label: "today"),
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.inbox), label: "Inbox"),
|
BottomNavigationBarItem(icon: Icon(Icons.inbox), label: "Inbox"),
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.note), label: "Notes"),
|
BottomNavigationBarItem(icon: Icon(Icons.note), label: "Notes"),
|
||||||
],
|
],
|
||||||
currentIndex: _selectedIndex,
|
currentIndex: _selectedIndex,
|
||||||
onTap: _onItemTapped,
|
onTap: _onItemTapped,
|
||||||
|
type: BottomNavigationBarType.fixed,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
136
lib/pages/EditReminder.dart
Normal file
136
lib/pages/EditReminder.dart
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../model/promemoria.dart';
|
||||||
|
|
||||||
|
class EditReminder extends StatefulWidget {
|
||||||
|
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";
|
||||||
|
DateTime? _date;
|
||||||
|
|
||||||
|
//Arraylist of promemoria
|
||||||
|
|
||||||
|
bool _hasDate = true;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text("Edit Reminder"),
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
children: <Widget>[
|
||||||
|
TextField(
|
||||||
|
controller: TextEditingController(text: widget.promemoria?.description ?? ""),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Title',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
TextField(
|
||||||
|
onChanged: (text) {
|
||||||
|
setState(() {
|
||||||
|
_description = text;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Description',
|
||||||
|
),
|
||||||
|
maxLines: 6,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
FilledButton(
|
||||||
|
onPressed: () async {
|
||||||
|
DateTime? newDate = await showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime(1),
|
||||||
|
lastDate: DateTime(9999));
|
||||||
|
if (newDate != null) {
|
||||||
|
setState(() {
|
||||||
|
_date = newDate;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Row(children: [
|
||||||
|
if (_date != null) Text("${_date?.day}/${_date?.month}/${_date?.year}"),
|
||||||
|
//if (_date == null) Text("Add Date"),
|
||||||
|
if (_date != null) const SizedBox(width: 10),
|
||||||
|
const Icon(Icons.calendar_month)
|
||||||
|
])),
|
||||||
|
if (_date != null) IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_date = null;
|
||||||
|
});
|
||||||
|
print("setting _date to ${_date}");
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.close)),
|
||||||
|
if (_date == null) TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
_date = DateTime.now();
|
||||||
|
});
|
||||||
|
print("setting _date to ${_date}");
|
||||||
|
},
|
||||||
|
child: const Row(
|
||||||
|
children: [
|
||||||
|
Icon(Icons.add),
|
||||||
|
SizedBox(width: 5),
|
||||||
|
Text("Add Today")
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: FilledButton(
|
||||||
|
onPressed: () {
|
||||||
|
print("ciao");
|
||||||
|
},
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor:
|
||||||
|
MaterialStateProperty.all(Colors.red)),
|
||||||
|
child: const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.delete),
|
||||||
|
Text("Delete"),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: FilledButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text("Save"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
lib/pages/InboxView.dart
Normal file
28
lib/pages/InboxView.dart
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
//import components
|
||||||
|
import '../Components/Reminder.dart';
|
||||||
|
|
||||||
|
class InboxView extends StatefulWidget {
|
||||||
|
const InboxView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<InboxView> createState() => _InboxViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InboxViewState extends State<InboxView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: const Text('Inbox'),
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: const <Widget>[
|
||||||
|
/* Reminder(),
|
||||||
|
Reminder(),*/
|
||||||
|
],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
19
lib/pages/NoteDetailView.dart
Normal file
19
lib/pages/NoteDetailView.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NoteDetailView extends StatefulWidget {
|
||||||
|
const NoteDetailView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<NoteDetailView> createState() => _NoteDetailViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NoteDetailViewState extends State<NoteDetailView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Center(
|
||||||
|
child: Text('NoteDetailView'),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
19
lib/pages/NotesView.dart
Normal file
19
lib/pages/NotesView.dart
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class NotesView extends StatefulWidget {
|
||||||
|
const NotesView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<NotesView> createState() => _NotesViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NotesViewState extends State<NotesView> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return const Scaffold(
|
||||||
|
body: Center(
|
||||||
|
child: Icon(Icons.note),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
61
lib/pages/TodayView.dart
Normal file
61
lib/pages/TodayView.dart
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
//import components
|
||||||
|
import '../Components/Reminder.dart';
|
||||||
|
import '../Components/QuickReminder.dart';
|
||||||
|
import '../model/promemoria.dart';
|
||||||
|
|
||||||
|
class TodayView extends StatefulWidget {
|
||||||
|
const TodayView({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<TodayView> createState() => _TodayViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TodayViewState extends State<TodayView> {
|
||||||
|
|
||||||
|
var _selectedDate = DateTime.now();
|
||||||
|
|
||||||
|
List<Promemoria> listaPromemoria = [
|
||||||
|
new Promemoria("Primo promemoria"),
|
||||||
|
new Promemoria("Secondo promemoria"),
|
||||||
|
new Promemoria("Terzo promemoria"),
|
||||||
|
new Promemoria("Quarto promemoria"),
|
||||||
|
new Promemoria("Quinto promemoria"),
|
||||||
|
new Promemoria("Sesto promemoria"),
|
||||||
|
];
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
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())
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: [
|
||||||
|
ListView.builder(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: listaPromemoria.length,
|
||||||
|
itemBuilder: (BuildContext context, int index){
|
||||||
|
return Reminder(
|
||||||
|
listaPromemoria[index]
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
QuickReminder(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
45
lib/pages/test.dart
Normal file
45
lib/pages/test.dart
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/database/database.dart';
|
||||||
|
import 'package:progetto_m335_flutter/model/note.dart';
|
||||||
|
|
||||||
|
import '../database/database.dart';
|
||||||
|
|
||||||
|
class Test extends StatefulWidget {
|
||||||
|
const Test({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Test> createState() => _TestState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _TestState extends State<Test> {
|
||||||
|
NoteDatabase noteDatabase = NoteDatabase.instance;
|
||||||
|
|
||||||
|
Future<void> _pressed() async {
|
||||||
|
print("Inserting demo data");
|
||||||
|
final db = await noteDatabase.database;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _printdata() async {
|
||||||
|
final db = await noteDatabase.database;
|
||||||
|
|
||||||
|
print("Printing data");
|
||||||
|
print(await db.query(noteTable));
|
||||||
|
print("Data printed");
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: Center(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
FloatingActionButton(onPressed: _pressed),
|
||||||
|
FloatingActionButton(onPressed: _printdata)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,6 +36,9 @@ dependencies:
|
|||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.2
|
cupertino_icons: ^1.0.2
|
||||||
firebase_core: ^2.16.0
|
firebase_core: ^2.16.0
|
||||||
|
sqflite: ^2.3.0
|
||||||
|
path: ^1.8.3
|
||||||
|
sqflite_common_ffi: ^2.3.0+2
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
@@ -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