diff --git a/android/app/google-services.json b/android/app/google-services.json
new file mode 100644
index 0000000..0c8bebd
--- /dev/null
+++ b/android/app/google-services.json
@@ -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"
+}
\ No newline at end of file
diff --git a/ios/Runner/GoogleService-Info.plist b/ios/Runner/GoogleService-Info.plist
index 0632985..209e6e5 100644
--- a/ios/Runner/GoogleService-Info.plist
+++ b/ios/Runner/GoogleService-Info.plist
@@ -2,36 +2,29 @@
- AD_UNIT_ID_FOR_BANNER_TEST
- ca-app-pub-3940256099942544/2934735716
- AD_UNIT_ID_FOR_INTERSTITIAL_TEST
- ca-app-pub-3940256099942544/4411468910
- CLIENT_ID
- test-do-not-use.apps.googleusercontent.com
- REVERSED_CLIENT_ID
- com.googleusercontent.apps.test-do-not-use
- API_KEY
- 000000000000000000000000000000000000000
- GCM_SENDER_ID
- 999999999999
- PLIST_VERSION
- 1
- BUNDLE_ID
- com.google.example.BannerExample
- IS_ADS_ENABLED
-
- IS_ANALYTICS_ENABLED
-
- IS_APPINVITE_ENABLED
-
- IS_GCM_ENABLED
-
- IS_SIGNIN_ENABLED
-
- GOOGLE_APP_ID
- 1:999999999999:ios:0000000000000000
- DATABASE_URL
- https://test-do-not-use.firebaseio.com
+ API_KEY
+ AIzaSyB7BuSBQ9CHuM5C9HalgpOkGf8ZKr70H8M
+ GCM_SENDER_ID
+ 1079915493414
+ PLIST_VERSION
+ 1
+ BUNDLE_ID
+ io.flutter.flutter.app
+ PROJECT_ID
+ progetto-m335-a4126
+ STORAGE_BUCKET
+ progetto-m335-a4126.appspot.com
+ IS_ADS_ENABLED
+
+ IS_ANALYTICS_ENABLED
+
+ IS_APPINVITE_ENABLED
+
+ IS_GCM_ENABLED
+
+ IS_SIGNIN_ENABLED
+
+ GOOGLE_APP_ID
+ 1:1079915493414:ios:3f77c278459dca655d8ee7
-
-
+
\ No newline at end of file
diff --git a/lib/Components/EditReminderButton.dart b/lib/Components/EditReminderButton.dart
deleted file mode 100644
index cb38d88..0000000
--- a/lib/Components/EditReminderButton.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-import 'package:flutter/material.dart';
-import '../pages/EditReminder.dart';
-
-class EditReminderButton extends StatelessWidget{
- @override
- Widget build(BuildContext context) {
- return FilledButton(
- onPressed: () {
- Navigator.push(
- context,
- MaterialPageRoute(builder: (context) => EditReminder()),
- );
- },
- child: Icon(Icons.list),
- );
- }
-}
diff --git a/lib/Components/QuickReminder.dart b/lib/Components/QuickReminder.dart
index 93e71b1..5d4152f 100644
--- a/lib/Components/QuickReminder.dart
+++ b/lib/Components/QuickReminder.dart
@@ -1,4 +1,7 @@
import 'package:flutter/material.dart';
+import '../database/controller.dart';
+import '../model/promemoria.dart';
+import '../navigation.dart';
class QuickReminder extends StatefulWidget {
const QuickReminder({super.key});
@@ -8,18 +11,34 @@ class QuickReminder extends StatefulWidget {
}
class _QuickReminderState extends State {
+ Controller controller = Controller();
+
@override
Widget build(BuildContext context) {
- return const ListTile(
- leading: Checkbox(
+ return ListTile(
+ leading: const Checkbox(
value: false,
onChanged: null,
),
title: TextField(
- decoration: InputDecoration(
- labelText: 'New Reminder',
- ),
- ),
+ decoration: const InputDecoration(
+ labelText: 'New Reminder',
+ ),
+ onSubmitted: (String value) {
+ controller.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)),
+ );
+ }),
);
}
}
diff --git a/lib/Components/Reminder.dart b/lib/Components/Reminder.dart
index e9d82d6..51e684c 100644
--- a/lib/Components/Reminder.dart
+++ b/lib/Components/Reminder.dart
@@ -30,7 +30,7 @@ class _ReminderState extends State {
onChanged: _onChanged,
),
title: Text(widget.promemoria?.getTitle() ?? 'Nessun titolo'),
- subtitle: Text(DateTime.now().toString()),
+ subtitle: Text(widget.promemoria!.getExpirationDate().toString()),
onTap: () {
Navigator.push(
context,
diff --git a/lib/model/promemoria.dart b/lib/model/promemoria.dart
index 10ba5ce..75f5261 100644
--- a/lib/model/promemoria.dart
+++ b/lib/model/promemoria.dart
@@ -1,4 +1,3 @@
-import 'base_entity.dart';
import 'identifiers/enum/color.dart';
import 'identifiers/enum/priority.dart';
@@ -6,14 +5,14 @@ const String promemoriaTable = 'promemoria';
class Promemoria {
String id = '';
- String title;
- String creationDate;
- String lastModificationDate;
- String expirationDate;
- String? arrayPromemoria;
- String description;
- String priority;
- String color;
+ String title = '';
+ String creationDate = '';
+ String lastModificationDate = '';
+ String expirationDate = '';
+ String? arrayPromemoria = '';
+ String description = '';
+ String priority = '';
+ String color = '';
Promemoria(
this.id,
diff --git a/lib/pages/TodayView.dart b/lib/pages/TodayView.dart
index 1c2c39c..f3f2750 100644
--- a/lib/pages/TodayView.dart
+++ b/lib/pages/TodayView.dart
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import '../Components/Reminder.dart';
import '../Components/QuickReminder.dart';
import '../model/promemoria.dart';
+import '../database/controller.dart';
class TodayView extends StatefulWidget {
const TodayView({super.key});
@@ -14,14 +15,30 @@ class TodayView extends StatefulWidget {
class _TodayViewState extends State {
+ Controller controller = Controller();
+
var _selectedDate = DateTime.now();
- List listaPromemoria = [
+ List listaPromemoria = [];
+
+ /*[
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 {
+ List temp = await controller.getAllPromemoria();
+ setState(() {
+ listaPromemoria = temp;
+ });
+ }
+ @override
+ void initState() {
+ // TODO: implement initState
+ getAllPromemoria();
+ super.initState();
+ }
@override
Widget build(BuildContext context) {
@@ -29,30 +46,31 @@ class _TodayViewState extends State {
appBar: AppBar(
title: FilledButton(
onPressed: () async {
- DateTime? newDate = await showDatePicker(context: context, initialDate: DateTime.now(), firstDate: DateTime(1), lastDate: DateTime(9999));
+ DateTime? newDate = await showDatePicker(context: context,
+ initialDate: DateTime.now(),
+ firstDate: DateTime(1),
+ lastDate: DateTime(9999));
if (newDate != null) {
setState(() {
_selectedDate = newDate;
});
}
},
- child: Text(_selectedDate.day.toString() + "/" + _selectedDate.month.toString() + "/" + _selectedDate.year.toString())
+ child: Text("${_selectedDate.day}/${_selectedDate.month}/${_selectedDate.year}")
),
),
- body: ListView(
- children: [
- ListView.builder(
- scrollDirection: Axis.vertical,
- shrinkWrap: true,
- itemCount: listaPromemoria?.length,
- itemBuilder: (BuildContext context, int index){
- return Reminder(
- listaPromemoria?[index]
- );
- },
- ),
- QuickReminder(),
- ],
+ 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]);
+ }
+ },
),
);
}