Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5b02be9ae7 | ||
|
|
8049165f44 | ||
|
|
34a73c62f7 | ||
| b75903e3cb | |||
|
|
039fde6dbe | ||
|
|
7aa8c8dcbc | ||
|
|
a58721a6f4 | ||
| 64b4f64f8c | |||
| 52d7defb75 | |||
| 782bbebce9 | |||
| 05386ac20f | |||
| 9f26bc8595 | |||
|
|
c35684c8f1 | ||
| 205f575db5 | |||
|
|
67aa0d4341 | ||
| ecf7011302 | |||
| 58e013a709 | |||
| 929c4cc403 | |||
| 8eff19cecc | |||
|
|
416c230a33 | ||
|
|
e793631ab0 | ||
|
|
dfc0d43060 | ||
|
|
d598a41475 | ||
|
|
5a3aea16ba |
@@ -50,7 +50,6 @@ android {
|
|||||||
targetSdkVersion flutter.targetSdkVersion
|
targetSdkVersion flutter.targetSdkVersion
|
||||||
versionCode flutterVersionCode.toInteger()
|
versionCode flutterVersionCode.toInteger()
|
||||||
versionName flutterVersionName
|
versionName flutterVersionName
|
||||||
multiDexEnabled true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"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.14'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
// 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,29 +2,36 @@
|
|||||||
<!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>AIzaSyB7BuSBQ9CHuM5C9HalgpOkGf8ZKr70H8M</string>
|
<string>000000000000000000000000000000000000000</string>
|
||||||
<key>GCM_SENDER_ID</key>
|
<key>GCM_SENDER_ID</key>
|
||||||
<string>1079915493414</string>
|
<string>999999999999</string>
|
||||||
<key>PLIST_VERSION</key>
|
<key>PLIST_VERSION</key>
|
||||||
<string>1</string>
|
<string>1</string>
|
||||||
<key>BUNDLE_ID</key>
|
<key>BUNDLE_ID</key>
|
||||||
<string>io.flutter.flutter.app</string>
|
<string>com.google.example.BannerExample</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>
|
||||||
<false></false>
|
<true/>
|
||||||
<key>IS_ANALYTICS_ENABLED</key>
|
<key>IS_ANALYTICS_ENABLED</key>
|
||||||
<false></false>
|
<false/>
|
||||||
<key>IS_APPINVITE_ENABLED</key>
|
<key>IS_APPINVITE_ENABLED</key>
|
||||||
<true></true>
|
<false/>
|
||||||
<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:1079915493414:ios:3f77c278459dca655d8ee7</string>
|
<string>1:999999999999:ios:0000000000000000</string>
|
||||||
|
<key>DATABASE_URL</key>
|
||||||
|
<string>https://test-do-not-use.firebaseio.com</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
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(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
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)),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
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,26 +63,14 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,8 +102,6 @@ class NoteDatabase {
|
|||||||
'${note.description}'
|
'${note.description}'
|
||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
|
|
||||||
syncData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//add Promemoria
|
//add Promemoria
|
||||||
@@ -141,8 +127,6 @@ 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,9 +11,7 @@ class MyApp extends StatelessWidget {
|
|||||||
title: 'My App',
|
title: 'My App',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
colorSchemeSeed: Colors.blue,
|
primaryColor: Colors.red,
|
||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
home: Navigation()
|
home: Navigation()
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
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';
|
||||||
@@ -31,6 +33,9 @@ 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>[
|
||||||
|
|||||||
@@ -1,90 +0,0 @@
|
|||||||
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"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
], //
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
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,6 +1,4 @@
|
|||||||
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});
|
||||||
@@ -10,55 +8,12 @@ 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 Scaffold(
|
return const Scaffold(
|
||||||
appBar: AppBar(
|
body: Center(
|
||||||
title: Text(
|
child: Icon(Icons.inbox),
|
||||||
'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,90 +1,19 @@
|
|||||||
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({Key? key}) : super(key: key);
|
const NoteDetailView({super.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 Scaffold(
|
return const Scaffold(
|
||||||
appBar: AppBar(
|
body: Center(
|
||||||
title: Text('Edit note'),
|
child: Text('NoteDetailView'),
|
||||||
),
|
)
|
||||||
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,40 +1,18 @@
|
|||||||
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({Key? key}) : super(key: key);
|
const NotesView({super.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 Scaffold(
|
return const Scaffold(
|
||||||
appBar: AppBar(
|
body: Center(
|
||||||
title: Text('Note'),
|
child: Icon(Icons.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,10 +1,4 @@
|
|||||||
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});
|
||||||
@@ -14,65 +8,12 @@ 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 Scaffold(
|
return const Scaffold(
|
||||||
appBar: AppBar(
|
body: Center(
|
||||||
title: FilledButton(
|
child: Icon(Icons.calendar_today)
|
||||||
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,6 +31,7 @@ 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,11 +8,12 @@
|
|||||||
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 {
|
||||||
// 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