Compare commits
49 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 10a690a2df | |||
|
|
3cff59cfd3 | ||
|
|
982fb5df54 | ||
| c26e04c8c0 | |||
|
|
b586755f7b | ||
|
|
98c04bfc16 | ||
|
|
e67357fe5d | ||
|
|
06e92c4c77 | ||
|
|
b78679ece2 | ||
| 56b40c9514 | |||
|
|
e76adea92b | ||
|
|
05d8c25b3e | ||
|
|
cd1f6238f8 | ||
|
|
836a637219 | ||
| c3a444f863 | |||
| 902c72d75b | |||
| 5e4a3e28da | |||
|
|
2ac4444f9e | ||
|
|
4b46c8cc01 | ||
|
|
a8074c8701 | ||
|
|
6b3208b855 | ||
|
|
542bb4265c | ||
|
|
f5709b992c | ||
|
|
a7726efb70 | ||
|
|
eba59f7cf5 | ||
|
|
a6ba19abdd | ||
|
|
6eb06f6a05 | ||
|
|
251e47ae56 | ||
|
|
335fec8793 | ||
|
|
92f3dcf84d | ||
|
|
1ff2e9da0a | ||
| 9b3634e1cd | |||
| 4fdb310e31 | |||
|
|
b24a80425b | ||
| 300062b2d2 | |||
| fd14dfe0ff | |||
|
|
f51c4c1958 | ||
|
|
42ae2d1c4c | ||
|
|
47f2b0b62a | ||
|
|
f951469e4b | ||
|
|
473f6d9a5f | ||
|
|
8363776e78 | ||
| 0e12953383 | |||
|
|
7f67bd5b16 | ||
|
|
d20ad5d532 | ||
|
|
2d7d942dc4 | ||
|
|
4d898eb5ea | ||
|
|
ce1e5223f0 | ||
|
|
0f9ee28860 |
@@ -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>
|
<key>API_KEY</key>
|
||||||
<string>ca-app-pub-3940256099942544/2934735716</string>
|
<string>AIzaSyB7BuSBQ9CHuM5C9HalgpOkGf8ZKr70H8M</string>
|
||||||
<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
|
<key>GCM_SENDER_ID</key>
|
||||||
<string>ca-app-pub-3940256099942544/4411468910</string>
|
<string>1079915493414</string>
|
||||||
<key>CLIENT_ID</key>
|
<key>PLIST_VERSION</key>
|
||||||
<string>test-do-not-use.apps.googleusercontent.com</string>
|
<string>1</string>
|
||||||
<key>REVERSED_CLIENT_ID</key>
|
<key>BUNDLE_ID</key>
|
||||||
<string>com.googleusercontent.apps.test-do-not-use</string>
|
<string>io.flutter.flutter.app</string>
|
||||||
<key>API_KEY</key>
|
<key>PROJECT_ID</key>
|
||||||
<string>000000000000000000000000000000000000000</string>
|
<string>progetto-m335-a4126</string>
|
||||||
<key>GCM_SENDER_ID</key>
|
<key>STORAGE_BUCKET</key>
|
||||||
<string>999999999999</string>
|
<string>progetto-m335-a4126.appspot.com</string>
|
||||||
<key>PLIST_VERSION</key>
|
<key>IS_ADS_ENABLED</key>
|
||||||
<string>1</string>
|
<false></false>
|
||||||
<key>BUNDLE_ID</key>
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
<string>com.google.example.BannerExample</string>
|
<false></false>
|
||||||
<key>IS_ADS_ENABLED</key>
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
<true/>
|
<true></true>
|
||||||
<key>IS_ANALYTICS_ENABLED</key>
|
<key>IS_GCM_ENABLED</key>
|
||||||
<false/>
|
<true></true>
|
||||||
<key>IS_APPINVITE_ENABLED</key>
|
<key>IS_SIGNIN_ENABLED</key>
|
||||||
<false/>
|
<true></true>
|
||||||
<key>IS_GCM_ENABLED</key>
|
<key>GOOGLE_APP_ID</key>
|
||||||
<true/>
|
<string>1:1079915493414:ios:3f77c278459dca655d8ee7</string>
|
||||||
<key>IS_SIGNIN_ENABLED</key>
|
|
||||||
<true/>
|
|
||||||
<key>GOOGLE_APP_ID</key>
|
|
||||||
<string>1:999999999999:ios:0000000000000000</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,
|
||||||
|
|||||||
@@ -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,5 +1,3 @@
|
|||||||
import 'dart:ffi';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'pages/testUI.dart';
|
import 'pages/testUI.dart';
|
||||||
import 'pages/TodayView.dart';
|
import 'pages/TodayView.dart';
|
||||||
@@ -33,9 +31,6 @@ class _NavigationState extends State<Navigation> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
|
||||||
title: Text("BottomNavBar"),
|
|
||||||
),
|
|
||||||
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
|
body: Center(child: _widgetOptions.elementAt(_selectedIndex)),
|
||||||
bottomNavigationBar: BottomNavigationBar(
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
items: const <BottomNavigationBarItem>[
|
items: const <BottomNavigationBarItem>[
|
||||||
|
|||||||
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,4 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'CreateNewNote.dart';
|
||||||
|
import 'NoteDetailView.dart';
|
||||||
|
|
||||||
class InboxView extends StatefulWidget {
|
class InboxView extends StatefulWidget {
|
||||||
const InboxView({super.key});
|
const InboxView({super.key});
|
||||||
@@ -8,12 +10,55 @@ class InboxView extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _InboxViewState extends State<InboxView> {
|
class _InboxViewState extends State<InboxView> {
|
||||||
|
List<bool> _values = [false, false, false, false, false];
|
||||||
|
|
||||||
|
void _onChanged(int index, bool? newValue){
|
||||||
|
setState(() {
|
||||||
|
_values[index] = newValue ?? false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return const Scaffold(
|
return Scaffold(
|
||||||
body: Center(
|
appBar: AppBar(
|
||||||
child: Icon(Icons.inbox),
|
title: Text(
|
||||||
)
|
'Inbox',
|
||||||
|
style: TextStyle(color: Colors.white),
|
||||||
|
),
|
||||||
|
backgroundColor: Colors.cyan.shade700,
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
onPressed: () {
|
||||||
|
},
|
||||||
|
child: Icon(Icons.add, color: Colors.white),
|
||||||
|
backgroundColor: Colors.cyan.shade700,
|
||||||
|
),
|
||||||
|
body: Container(
|
||||||
|
child: ListView.builder(
|
||||||
|
itemCount: 5,
|
||||||
|
itemBuilder: (context, index) {
|
||||||
|
return Card(
|
||||||
|
color: Colors.white,
|
||||||
|
child: ListTile(
|
||||||
|
leading: Checkbox(
|
||||||
|
value: _values[index],
|
||||||
|
onChanged: (newValue) => _onChanged(index, newValue),
|
||||||
|
),
|
||||||
|
title: Text("ciao", style: TextStyle(color: Colors.cyan.shade700, fontWeight: FontWeight.bold)),
|
||||||
|
subtitle: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [Text('Descrizione della nota:')]),
|
||||||
|
onTap: () {
|
||||||
|
Navigator.of(context).push(
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const NoteDetailView(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,19 +1,41 @@
|
|||||||
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
|
||||||
|
|||||||
@@ -8,12 +8,11 @@
|
|||||||
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/myApp.dart';
|
import 'package:progetto_m335_flutter/main.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