Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ab01f8625b | |||
|
|
4759f768f3 | ||
|
|
07604bddaa | ||
|
|
2b18144691 | ||
| e07fd0d191 | |||
|
|
de4769cbb8 | ||
|
|
e4cf349cbb | ||
|
|
93b54f357b | ||
|
|
0628fcbbdb | ||
|
|
a4a13cc2ea | ||
|
|
67dd09b2dd | ||
|
|
ca504e5e24 | ||
|
|
ccb56ffa9c | ||
|
|
5c68d85b98 | ||
|
|
bf3a9c552d | ||
|
|
c2196663ae | ||
|
|
7d1bec6b0c | ||
|
|
6d9eb5f4db | ||
|
|
b284a3d6d6 | ||
|
|
d69c7ab525 | ||
|
|
c0c090085f | ||
|
|
850497301c | ||
|
|
4121239e36 | ||
|
|
abc0926f49 | ||
|
|
0d53d1421f | ||
|
|
b81cfc70fb | ||
|
|
c2824c99a4 | ||
|
|
e061871c4f | ||
|
|
0fb537d24e | ||
|
|
06a3712d0a | ||
|
|
65ed67b8f6 | ||
|
|
29a54bbcbc | ||
|
|
bf7981671d | ||
|
|
2f851bc630 | ||
|
|
4c4dcc2654 | ||
|
|
330d0e4c61 | ||
|
|
6a05861341 | ||
|
|
4006030f5b |
@@ -50,6 +50,7 @@ android {
|
|||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
|
multiDexEnabled true
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
29
android/app/google-services.json
Normal file
29
android/app/google-services.json
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"project_info": {
|
||||||
|
"project_number": "1079915493414",
|
||||||
|
"project_id": "progetto-m335-a4126",
|
||||||
|
"storage_bucket": "progetto-m335-a4126.appspot.com"
|
||||||
|
},
|
||||||
|
"client": [
|
||||||
|
{
|
||||||
|
"client_info": {
|
||||||
|
"mobilesdk_app_id": "1:1079915493414:android:1af31a3970a27c5c5d8ee7",
|
||||||
|
"android_client_info": {
|
||||||
|
"package_name": "ch.ameti.progetto_m335_flutter"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"oauth_client": [],
|
||||||
|
"api_key": [
|
||||||
|
{
|
||||||
|
"current_key": "AIzaSyDANiNzXOXgtVKheZnTw7TCw40AFyIznGg"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"services": {
|
||||||
|
"appinvite_service": {
|
||||||
|
"other_platform_oauth_client": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"configuration_version": "1"
|
||||||
|
}
|
||||||
@@ -8,7 +8,7 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.3.0'
|
classpath 'com.android.tools.build:gradle:7.3.0'
|
||||||
// START: FlutterFire Configuration
|
// START: FlutterFire Configuration
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.14'
|
||||||
// END: FlutterFire Configuration
|
// END: FlutterFire Configuration
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,36 +2,29 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>AD_UNIT_ID_FOR_BANNER_TEST</key>
|
|
||||||
<string>ca-app-pub-3940256099942544/2934735716</string>
|
|
||||||
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
|
|
||||||
<string>ca-app-pub-3940256099942544/4411468910</string>
|
|
||||||
<key>CLIENT_ID</key>
|
|
||||||
<string>test-do-not-use.apps.googleusercontent.com</string>
|
|
||||||
<key>REVERSED_CLIENT_ID</key>
|
|
||||||
<string>com.googleusercontent.apps.test-do-not-use</string>
|
|
||||||
<key>API_KEY</key>
|
<key>API_KEY</key>
|
||||||
<string>000000000000000000000000000000000000000</string>
|
<string>AIzaSyB7BuSBQ9CHuM5C9HalgpOkGf8ZKr70H8M</string>
|
||||||
<key>GCM_SENDER_ID</key>
|
<key>GCM_SENDER_ID</key>
|
||||||
<string>999999999999</string>
|
<string>1079915493414</string>
|
||||||
<key>PLIST_VERSION</key>
|
<key>PLIST_VERSION</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>BUNDLE_ID</key>
|
<key>BUNDLE_ID</key>
|
||||||
<string>com.google.example.BannerExample</string>
|
<string>io.flutter.flutter.app</string>
|
||||||
|
<key>PROJECT_ID</key>
|
||||||
|
<string>progetto-m335-a4126</string>
|
||||||
|
<key>STORAGE_BUCKET</key>
|
||||||
|
<string>progetto-m335-a4126.appspot.com</string>
|
||||||
<key>IS_ADS_ENABLED</key>
|
<key>IS_ADS_ENABLED</key>
|
||||||
<true/>
|
<false></false>
|
||||||
<key>IS_ANALYTICS_ENABLED</key>
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
<false/>
|
<false></false>
|
||||||
<key>IS_APPINVITE_ENABLED</key>
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
<false/>
|
<true></true>
|
||||||
<key>IS_GCM_ENABLED</key>
|
<key>IS_GCM_ENABLED</key>
|
||||||
<true/>
|
<true></true>
|
||||||
<key>IS_SIGNIN_ENABLED</key>
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
<true/>
|
<true></true>
|
||||||
<key>GOOGLE_APP_ID</key>
|
<key>GOOGLE_APP_ID</key>
|
||||||
<string>1:999999999999:ios:0000000000000000</string>
|
<string>1:1079915493414:ios:3f77c278459dca655d8ee7</string>
|
||||||
<key>DATABASE_URL</key>
|
|
||||||
<string>https://test-do-not-use.firebaseio.com</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
||||||
|
|||||||
27
lib/Components/Note.dart
Normal file
27
lib/Components/Note.dart
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../pages/NoteDetailView.dart';
|
||||||
|
|
||||||
|
class Note extends StatefulWidget {
|
||||||
|
const Note({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<Note> createState() => _NotesViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _NotesViewState extends State<Note> {
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text("Titolo"),
|
||||||
|
subtitle: Text('Testo'),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const NoteDetailView(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
45
lib/Components/QuickReminder.dart
Normal file
45
lib/Components/QuickReminder.dart
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/database/database.dart';
|
||||||
|
import '../model/promemoria.dart';
|
||||||
|
import '../navigation.dart';
|
||||||
|
|
||||||
|
class QuickReminder extends StatefulWidget {
|
||||||
|
const QuickReminder({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<QuickReminder> createState() => _QuickReminderState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _QuickReminderState extends State<QuickReminder> {
|
||||||
|
NoteDatabase noteDatabase = NoteDatabase.instance;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return ListTile(
|
||||||
|
leading: const Checkbox(
|
||||||
|
value: false,
|
||||||
|
onChanged: null,
|
||||||
|
),
|
||||||
|
title: TextField(
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
labelText: 'New Reminder',
|
||||||
|
),
|
||||||
|
onSubmitted: (String value) async{
|
||||||
|
final db = await noteDatabase.database;
|
||||||
|
noteDatabase.addPromemoria(Promemoria.today(
|
||||||
|
value,
|
||||||
|
DateTime.now().toString(),
|
||||||
|
DateTime.now().toString(),
|
||||||
|
DateTime.now().toString(),
|
||||||
|
"description"));
|
||||||
|
Navigator.pushReplacement(
|
||||||
|
context,
|
||||||
|
PageRouteBuilder(pageBuilder: (context, animation1, animation2) {
|
||||||
|
return Navigation();
|
||||||
|
},
|
||||||
|
transitionDuration: const Duration(seconds: 0)),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
42
lib/Components/Reminder.dart
Normal file
42
lib/Components/Reminder.dart
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
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?.getTitle() ?? 'Nessun titolo'),
|
||||||
|
subtitle: Text(widget.promemoria!.getExpirationDate().toString()),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => EditReminder(widget.promemoria)),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -63,14 +63,26 @@ class NoteDatabase {
|
|||||||
|
|
||||||
Future<List<Note>> getAllNote() async {
|
Future<List<Note>> getAllNote() async {
|
||||||
var notes = await _database?.query(noteTable);
|
var notes = await _database?.query(noteTable);
|
||||||
List<Note> noteList = notes!.map((e) => Note.fromJson(e)).toList();
|
|
||||||
|
if(notes == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Note> noteList = notes.map((e) => Note.fromJson(e)).toList();
|
||||||
return noteList;
|
return noteList;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Promemoria>> getAllPromemoria() async {
|
Future<List<Promemoria>> getAllPromemoria() async {
|
||||||
var promemorias = await _database?.query(promemoriaTable);
|
var promemorias = await _database?.query(promemoriaTable);
|
||||||
|
|
||||||
|
if(promemorias == null) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
List<Promemoria> promemoriaList =
|
List<Promemoria> promemoriaList =
|
||||||
promemorias!.map((e) => Promemoria.fromJson(e)).toList();
|
promemorias.map((e) => Promemoria.fromJson(e)).toList();
|
||||||
|
|
||||||
|
|
||||||
return promemoriaList;
|
return promemoriaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +114,8 @@ class NoteDatabase {
|
|||||||
'${note.description}'
|
'${note.description}'
|
||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
|
syncData();
|
||||||
}
|
}
|
||||||
|
|
||||||
//add Promemoria
|
//add Promemoria
|
||||||
@@ -127,6 +141,8 @@ class NoteDatabase {
|
|||||||
'${promemoria.color}'
|
'${promemoria.color}'
|
||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
|
syncData();
|
||||||
}
|
}
|
||||||
|
|
||||||
void deleteAll() async {
|
void deleteAll() async {
|
||||||
|
|||||||
@@ -5,14 +5,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,
|
||||||
@@ -33,7 +33,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 {
|
||||||
|
|||||||
@@ -11,7 +11,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,11 +1,10 @@
|
|||||||
import 'dart:ffi';
|
import 'dart:ffi';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'pages/testUI.dart';
|
|
||||||
import 'pages/TodayView.dart';
|
import 'pages/TodayView.dart';
|
||||||
import 'pages/InboxView.dart';
|
import 'pages/InboxView.dart';
|
||||||
import 'pages/NotesView.dart';
|
import 'pages/NotesView.dart';
|
||||||
import 'pages/test.dart';
|
|
||||||
|
|
||||||
class Navigation extends StatefulWidget {
|
class Navigation extends StatefulWidget {
|
||||||
const Navigation({super.key});
|
const Navigation({super.key});
|
||||||
@@ -16,12 +15,11 @@ class Navigation extends StatefulWidget {
|
|||||||
|
|
||||||
class _NavigationState extends State<Navigation> {
|
class _NavigationState extends State<Navigation> {
|
||||||
|
|
||||||
int _selectedIndex = 3;
|
int _selectedIndex = 0;
|
||||||
static const List<Widget> _widgetOptions = <Widget>[
|
static const List<Widget> _widgetOptions = <Widget>[
|
||||||
TodayView(),
|
TodayView(),
|
||||||
InboxView(),
|
InboxView(),
|
||||||
NotesView(),
|
NotesView(),
|
||||||
Test()
|
|
||||||
];
|
];
|
||||||
|
|
||||||
void _onItemTapped(int index) {
|
void _onItemTapped(int index) {
|
||||||
@@ -33,20 +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"),
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.settings), label: "Settings")
|
|
||||||
],
|
],
|
||||||
currentIndex: _selectedIndex,
|
currentIndex: _selectedIndex,
|
||||||
onTap: _onItemTapped,
|
onTap: _onItemTapped,
|
||||||
|
type: BottomNavigationBarType.fixed,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
90
lib/pages/CreateNewNote.dart
Normal file
90
lib/pages/CreateNewNote.dart
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/pages/NotesView.dart';
|
||||||
|
|
||||||
|
class CreateNewNote extends StatefulWidget {
|
||||||
|
const CreateNewNote({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<CreateNewNote> createState() => _CreateNewNoteState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CreateNewNoteState extends State<CreateNewNote> {
|
||||||
|
TextEditingController _titleController = TextEditingController();
|
||||||
|
TextEditingController _textController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_titleController.dispose();
|
||||||
|
_textController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text('Create New Note'),
|
||||||
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: _titleController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Enter a title',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
TextField(
|
||||||
|
controller: _textController,
|
||||||
|
maxLines: null,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Enter text',
|
||||||
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
print("Delete button pressed");
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.red,
|
||||||
|
),
|
||||||
|
child: const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.delete),
|
||||||
|
Text("Delete"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
String title = _titleController.text;
|
||||||
|
String text = _textController.text;
|
||||||
|
_titleController.clear();
|
||||||
|
_textController.clear();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text("Save"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
], //
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
147
lib/pages/EditReminder.dart
Normal file
147
lib/pages/EditReminder.dart
Normal file
@@ -0,0 +1,147 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/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> {
|
||||||
|
final String _title = "ciaciao";
|
||||||
|
String _description = "";
|
||||||
|
DateTime? _date;
|
||||||
|
|
||||||
|
//Arraylist of promemoria
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
_description = widget.promemoria?.description ?? "";
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
@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>[
|
||||||
|
TextFormField(
|
||||||
|
initialValue: widget.promemoria?.title ?? "",
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
labelText: 'Title',
|
||||||
|
),
|
||||||
|
onChanged: (text) {
|
||||||
|
setState(() {
|
||||||
|
widget.promemoria?.setTitle(text);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
TextFormField(
|
||||||
|
initialValue: widget.promemoria?.description ?? "",
|
||||||
|
onChanged: (text) {
|
||||||
|
print(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"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
//import components
|
||||||
|
import '../Components/Reminder.dart';
|
||||||
|
|
||||||
class InboxView extends StatefulWidget {
|
class InboxView extends StatefulWidget {
|
||||||
const InboxView({super.key});
|
const InboxView({super.key});
|
||||||
|
|
||||||
@@ -10,9 +13,15 @@ class InboxView extends StatefulWidget {
|
|||||||
class _InboxViewState extends State<InboxView> {
|
class _InboxViewState extends State<InboxView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
appBar: AppBar(
|
||||||
child: Icon(Icons.inbox),
|
title: const Text('Inbox'),
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
children: const <Widget>[
|
||||||
|
/* Reminder(),
|
||||||
|
Reminder(),*/
|
||||||
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,19 +1,90 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/pages/NotesView.dart';
|
||||||
|
|
||||||
class NoteDetailView extends StatefulWidget {
|
class NoteDetailView extends StatefulWidget {
|
||||||
const NoteDetailView({super.key});
|
const NoteDetailView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<NoteDetailView> createState() => _NoteDetailViewState();
|
State<NoteDetailView> createState() => _NoteDetailViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NoteDetailViewState extends State<NoteDetailView> {
|
class _NoteDetailViewState extends State<NoteDetailView> {
|
||||||
|
TextEditingController _titleController = TextEditingController();
|
||||||
|
TextEditingController _textController = TextEditingController();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_titleController.dispose();
|
||||||
|
_textController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
appBar: AppBar(
|
||||||
child: Text('NoteDetailView'),
|
title: Text('Edit note'),
|
||||||
)
|
),
|
||||||
|
body: Padding(
|
||||||
|
padding: const EdgeInsets.all(16.0),
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
controller: _titleController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Enter a title',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: 16),
|
||||||
|
TextField(
|
||||||
|
controller: _textController,
|
||||||
|
maxLines: null,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
hintText: 'Enter text',
|
||||||
|
border: InputBorder.none,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
const Spacer(),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
print("Delete button pressed");
|
||||||
|
},
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
primary: Colors.red,
|
||||||
|
),
|
||||||
|
child: const Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Icon(Icons.delete),
|
||||||
|
Text("Delete"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: () {
|
||||||
|
String title = _titleController.text;
|
||||||
|
String text = _textController.text;
|
||||||
|
_titleController.clear();
|
||||||
|
_textController.clear();
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
child: const Text("Save"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
], //
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,40 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import '../Components/Note.dart';
|
||||||
|
import 'CreateNewNote.dart';
|
||||||
|
import 'NoteDetailView.dart';
|
||||||
|
|
||||||
class NotesView extends StatefulWidget {
|
class NotesView extends StatefulWidget {
|
||||||
const NotesView({super.key});
|
const NotesView({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<NotesView> createState() => _NotesViewState();
|
State<NotesView> createState() => _NotesViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NotesViewState extends State<NotesView> {
|
class _NotesViewState extends State<NotesView> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
appBar: AppBar(
|
||||||
child: Icon(Icons.note),
|
title: Text('Note'),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const CreateNewNote(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Icon(Icons.add),
|
||||||
|
),
|
||||||
|
|
||||||
|
|
||||||
|
body:ListView(
|
||||||
|
children: const <Widget>[
|
||||||
|
Note(),
|
||||||
|
Note(),
|
||||||
|
],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:progetto_m335_flutter/database/database.dart';
|
||||||
|
|
||||||
|
//import components
|
||||||
|
import '../Components/Reminder.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});
|
||||||
@@ -8,12 +14,65 @@ class TodayView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _TodayViewState extends State<TodayView> {
|
class _TodayViewState extends State<TodayView> {
|
||||||
|
|
||||||
|
var _selectedDate = DateTime.now();
|
||||||
|
|
||||||
|
List<Promemoria> listaPromemoria = [];
|
||||||
|
|
||||||
|
NoteDatabase noteDatabase = NoteDatabase.instance;
|
||||||
|
|
||||||
|
/*[
|
||||||
|
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"),
|
||||||
|
];*/
|
||||||
|
|
||||||
|
getAllPromemoria() async {
|
||||||
|
final db = await noteDatabase.database;
|
||||||
|
List<Promemoria> temp = await noteDatabase.getAllPromemoria() as List<Promemoria>;
|
||||||
|
setState(() {
|
||||||
|
listaPromemoria = temp;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
// TODO: implement initState
|
||||||
|
getAllPromemoria();
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
appBar: AppBar(
|
||||||
child: Icon(Icons.calendar_today)
|
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}/${_selectedDate.month}/${_selectedDate.year}")
|
||||||
|
),
|
||||||
|
),
|
||||||
|
body:
|
||||||
|
ListView.builder(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: (listaPromemoria!.length + 1),
|
||||||
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
if (index == listaPromemoria.length) {
|
||||||
|
return QuickReminder();
|
||||||
|
} else {
|
||||||
|
return Reminder(listaPromemoria[index]);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ dependencies:
|
|||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# 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
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ 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 {
|
||||||
// Build our app and trigger a frame.
|
// Build our app and trigger a frame.
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
// Verify that our counter starts at 0.
|
||||||
expect(find.text('0'), findsOneWidget);
|
expect(find.text('0'), findsOneWidget);
|
||||||
|
|||||||
Reference in New Issue
Block a user