From cbe620e3c87cea39b543028ff1763324f829415e Mon Sep 17 00:00:00 2001 From: MatteoGalletta Date: Sun, 29 Aug 2021 01:23:32 +0200 Subject: [PATCH 1/5] Aggiunta Voti Scrutinio --- .flutter-plugins-dependencies | 2 +- lib/api.dart | 43 +++++++++++++++++++ lib/backdropWidgets.dart | 6 +++ lib/main.dart | 6 +++ lib/scrutinio.dart | 78 +++++++++++++++++++++++++++++++++++ lib/widgets.dart | 22 +++++++--- pubspec.lock | 8 ++-- 7 files changed, 155 insertions(+), 10 deletions(-) create mode 100644 lib/scrutinio.dart diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 02725e0..cc249d9 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-03-13 19:21:35.468884","version":"2.0.1"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-08-29 01:18:36.554890","version":"2.2.3"} \ No newline at end of file diff --git a/lib/api.dart b/lib/api.dart index 218bfbd..3057550 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -417,6 +417,49 @@ Future bacheca({var response}) async { return listaBacheca; } +Future periodiscrutinio({var response}) async { + if (response == null) { + response = await argoRequest(fullHeaders, 'periodiclasse', + {'page': '1', 'start': '0', 'limit': '25'}); + } + + if (!(response is List) && response.containsKey('error')) { + Fluttertoast.showToast(msg: 'Errore sconosciuto:\n\n' + response['error']); + return {}; + } + + return response['dati']; +} + +Future votiscruitinio({var response}) async { + if (response == null) { + response = await argoRequest(fullHeaders, 'votiscrutinio', + {'page': '1', 'start': '0', 'limit': '25'}); + } + // Si controlla che response non sia una lista, quindi che abbia il metodo .containsKey + // (la richiesta votiscrutinio non ritorna un oggetto con un campo 'dati', bensì una lista) + if (!(response is List) && response.containsKey('error')) { + Fluttertoast.showToast(msg: 'Errore sconosciuto:\n\n' + response['error']); + return {}; + } + var periodi = await periodiscrutinio(); + + Map scrutinio = {}; + for (var periodo in periodi) + scrutinio[periodo['prgPeriodo']] = { + 'titolo': periodo['desPeriodo'], + 'esito': periodo['esito'], + 'dati': [] + }; + + for (var elemento in response) { + int periodo = elemento['prgPeriodo']; + scrutinio[periodo]['dati'].add(elemento); + } + + return scrutinio; +} + bacheca_parse(elemento) { return { 'oggetto': elemento['desOggetto'], diff --git a/lib/backdropWidgets.dart b/lib/backdropWidgets.dart index 03cf836..5b02842 100644 --- a/lib/backdropWidgets.dart +++ b/lib/backdropWidgets.dart @@ -50,6 +50,12 @@ getBackdrop(context) { Icon(FontAwesomeIcons.fileAlt, color: Colors.white, size: 18.0), context), + widgetMenuBottone( + 'Scrutinio', + '/scrutinio', + Icon(FontAwesomeIcons.thumbtack, + color: Colors.white, size: 18.0), + context), widgetMenuBottone( 'Cosa è successo oggi', '/oggi', diff --git a/lib/main.dart b/lib/main.dart index 27b3faa..5a72c72 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,6 +17,7 @@ import 'debugApi.dart'; import 'aggiornamento.dart'; import 'impostazioni.dart'; import 'bacheca.dart'; +import 'scrutinio.dart'; var darkTheme = false; @@ -136,6 +137,11 @@ class MyApp extends StatelessWidget { route = OrarioRoute(); } break; + case '/scrutinio': + { + route = ScrutinioRoute(); + } + break; case '/info': { route = InfoRoute(); diff --git a/lib/scrutinio.dart b/lib/scrutinio.dart new file mode 100644 index 0000000..3f1de6a --- /dev/null +++ b/lib/scrutinio.dart @@ -0,0 +1,78 @@ +import 'package:argo_famiglia/widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:backdrop/backdrop.dart'; +import 'dart:async'; +import 'backdropWidgets.dart'; +import 'api.dart'; +import 'database.dart'; + +class ScrutinioRoute extends StatefulWidget { + @override + State createState() { + return _ScrutinioRouteState(); + } +} + +class _ScrutinioRouteState extends State { + var voti = {}; + final GlobalKey _refreshIndicatorKey = + new GlobalKey(); + + generaLista() { + var tiles = []; + voti.forEach((final idPeriodo, var periodoScrutinio) { + + var votiScrutinio = []; + print("periodoScrutinio => " + periodoScrutinio.toString()); + for (var voto in periodoScrutinio['dati']) { + votiScrutinio.add(widgetScrutinio(voto, context)); + } + + tiles.add(ExpansionTile( + title: Text(periodoScrutinio['titolo']), + children: votiScrutinio.isNotEmpty ? votiScrutinio : [new Text("Nessun voto")] + ) + ); + + }); + + return tiles; + } + + @override + Widget build(BuildContext context) { + + var lista = generaLista(); + + return BackdropScaffold( + title: Text('Voti Scrutinio'), + backLayer: getBackdrop(context), + frontLayer: RefreshIndicator( + key: _refreshIndicatorKey, + onRefresh: aggiornaVoti, + child: ListView( + children: new List.from([])..addAll(lista) + ) + ) + ); + } + + Future aggiornaVoti() async { + var nuoviVoti = await votiscruitinio(); + + if (nuoviVoti.isNotEmpty) { + await Database.put('votiscrutinio', nuoviVoti); + } + + setState(() { + voti = nuoviVoti; + }); + } + + + void initState() { + super.initState(); + WidgetsBinding.instance + .addPostFrameCallback((_) => _refreshIndicatorKey.currentState.show()); + } +} diff --git a/lib/widgets.dart b/lib/widgets.dart index ee26647..aeae308 100644 --- a/lib/widgets.dart +++ b/lib/widgets.dart @@ -43,18 +43,17 @@ widgetNota(nota) { } cerchioVoto(voto, {radius = 40.0}) { - voto = double.parse(voto); + var votoAsDouble = double.tryParse(voto) ?? 10; // Per le materie dove il voto non è numerico return CircularPercentIndicator( radius: radius, lineWidth: 5.0, - percent: voto / 10, - center: Text(voto.toString()), - progressColor: coloreVoto(voto.toString()), + percent: votoAsDouble / 10, + center: Text(voto), + progressColor: coloreVoto(votoAsDouble), ); } coloreVoto(voto) { - voto = double.parse(voto); if (voto <= 0) { return Colors.white; } else if (voto >= 6) { @@ -119,6 +118,19 @@ widgetVoto(voto, context) { ))); } +widgetScrutinio(voto, context) { + return Padding( + padding: EdgeInsets.only(left: 5, top: 5), + child: ListTile( + leading: cerchioVoto(voto['votoOrale']['codVoto']), + title: Text(voto['desMateria']), + subtitle: ListBody(children: [ + Text((voto['assenze'] ?? 0).toString() + " assenze") + ]) + ) + ); +} + widgetBacheca(elemento, {var refresh}) { var subtitle = [Text(elemento['messaggio'])]; var buttons = []; diff --git a/pubspec.lock b/pubspec.lock index 920814e..69b6227 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.1" backdrop: dependency: "direct main" description: @@ -314,7 +314,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -349,7 +349,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" typed_data: dependency: transitive description: @@ -407,5 +407,5 @@ packages: source: hosted version: "2.2.0" sdks: - dart: ">=2.12.0-0.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" flutter: ">=1.12.13+hotfix.5" From 61f4077d2fcb2c28397c06deca313ff0f4cf36d0 Mon Sep 17 00:00:00 2001 From: MatteoGalletta Date: Sun, 29 Aug 2021 21:16:33 +0200 Subject: [PATCH 2/5] Aggiunta Schermata Dati Anagrafici --- .flutter-plugins-dependencies | 2 +- lib/api.dart | 1 + lib/backdropWidgets.dart | 5 ++ lib/datianagrafici.dart | 87 +++++++++++++++++++++++++++++++++++ lib/main.dart | 6 +++ pubspec.lock | 8 ++-- 6 files changed, 104 insertions(+), 5 deletions(-) create mode 100644 lib/datianagrafici.dart diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 02725e0..b0d9256 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-03-13 19:21:35.468884","version":"2.0.1"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-08-29 20:26:33.508391","version":"2.2.3"} \ No newline at end of file diff --git a/lib/api.dart b/lib/api.dart index 218bfbd..ffe1e71 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -131,6 +131,7 @@ Future login(school, username, password) async { fullHeaders['x-prg-scheda'], fullHeaders['x-prg-alunno'], fullHeaders['x-prg-scuola']); + await Database.put('dati-anagrafici', info[0]['alunno']); return 'OK'; } else { return 'Errore sconosciuto.'; diff --git a/lib/backdropWidgets.dart b/lib/backdropWidgets.dart index 03cf836..da65ac3 100644 --- a/lib/backdropWidgets.dart +++ b/lib/backdropWidgets.dart @@ -50,6 +50,11 @@ getBackdrop(context) { Icon(FontAwesomeIcons.fileAlt, color: Colors.white, size: 18.0), context), + widgetMenuBottone( + 'Dati anagrafici', + '/datianagrafici', + Icon(FontAwesomeIcons.info, color: Colors.white, size: 18.0), + context), widgetMenuBottone( 'Cosa è successo oggi', '/oggi', diff --git a/lib/datianagrafici.dart b/lib/datianagrafici.dart new file mode 100644 index 0000000..dfef5b3 --- /dev/null +++ b/lib/datianagrafici.dart @@ -0,0 +1,87 @@ +import 'package:backdrop/backdrop.dart'; +import 'package:flutter/material.dart'; + +import 'backdropWidgets.dart'; +import 'database.dart'; + +class DatiAnagraficiRoute extends StatefulWidget { + @override + State createState() { + return _DatiAnagraficiRouteState(); + } +} + +class _DatiAnagraficiRouteState extends State { + var dati = {}; + final GlobalKey _refreshIndicatorKey = + new GlobalKey(); + + List createLines(List> elements) { + + var labelStyle = new TextStyle(color: Theme.of(context).textTheme.bodyText2.color.withOpacity(0.5)); + var valueStyle = new TextStyle(fontWeight: FontWeight.bold, fontSize: 16.0, color: Theme.of(context).textTheme.bodyText2.color); + + return elements.map((e) => [ + new TextSpan(text: e['label'], style: labelStyle), + new TextSpan(text: e['value'] ?? '', style: valueStyle), + new TextSpan(text: '\n') + ]).expand((e) => e).toList(); + } + + @override + Widget build(BuildContext context) { + + var text = dati == null + ? [] + : createLines([ + {'label': 'Nome: ', 'value': dati['desNome']}, + {'label': 'Cognome: ', 'value': dati['desCognome']}, + {'label': 'Sesso: ', 'value': dati['flgSesso'] == 'M' ? "Maschio" : "Femmina"}, + {'label': 'Cittadinanza: ', 'value': dati['desCittadinanza']}, + {'label': 'Codice Fiscale: ', 'value': dati['desCf']}, + {'label': 'Telefono: ', 'value': dati['desTelefono']}, + {'label': 'Cellulare: ', 'value': dati['desCellulare']}, + {'label': 'Data di Nascita: ', 'value': dati['datNascita']}, // List.from(dati['datNascita'].split('-').reversed).join('-') + {'label': 'Comune di Nascita: ', 'value': dati['desComuneNascita']}, + {'label': 'CAP di Nascita: ', 'value': dati['desCap']}, + {'label': 'Comune di Residenza: ', 'value': dati['desComuneResidenza']}, + {'label': 'CAP di Residenza: ', 'value': dati['desCapResidenza']}, + {'label': 'Comune di Recapito: ', 'value': dati['desComuneRecapito']}, + {'label': 'Indirizzo di Recapito: ', 'value': dati['desIndirizzoRecapito']}, + // {'label': '??: ', 'value': dati['desVia']} + ]); + + return BackdropScaffold( + title: Text('Dati Anagrafici'), + backLayer: getBackdrop(context), + frontLayer: RefreshIndicator( + key: _refreshIndicatorKey, + onRefresh: aggiornaDatiAnagrafici, + child: Container( + margin: const EdgeInsets.only(left: 20.0, right: 20.0, top: 15.0), + child: new RichText( + text: new TextSpan( + style: new TextStyle( + height: 1.6 + ), + children: text, + ), + ) + ) + ) + ); + } + + Future aggiornaDatiAnagrafici() async { + var nuoviDati = await Database.get('dati-anagrafici'); + setState(() { + dati = nuoviDati; + }); + } + + void initState() { + super.initState(); + WidgetsBinding.instance + .addPostFrameCallback((_) => _refreshIndicatorKey.currentState.show()); + } +} diff --git a/lib/main.dart b/lib/main.dart index 27b3faa..75c77d4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'dart:async'; import 'package:flutter/services.dart'; import 'package:background_fetch/background_fetch.dart'; +import 'datianagrafici.dart'; import 'redirectRoute.dart'; import 'database.dart'; import 'login.dart'; @@ -136,6 +137,11 @@ class MyApp extends StatelessWidget { route = OrarioRoute(); } break; + case '/datianagrafici': + { + route = DatiAnagraficiRoute(); + } + break; case '/info': { route = InfoRoute(); diff --git a/pubspec.lock b/pubspec.lock index 920814e..69b6227 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,7 +21,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.1" backdrop: dependency: "direct main" description: @@ -314,7 +314,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -349,7 +349,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" typed_data: dependency: transitive description: @@ -407,5 +407,5 @@ packages: source: hosted version: "2.2.0" sdks: - dart: ">=2.12.0-0.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" flutter: ">=1.12.13+hotfix.5" From a6fd9cec57b9b997da483acb65ace3b14043a58b Mon Sep 17 00:00:00 2001 From: Matteo Galletta <65461708+MatteoGalletta@users.noreply.github.com> Date: Sun, 29 Aug 2021 21:40:58 +0200 Subject: [PATCH 3/5] Merge Error Fix --- lib/backdropWidgets.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/backdropWidgets.dart b/lib/backdropWidgets.dart index 7801cba..4e8d127 100644 --- a/lib/backdropWidgets.dart +++ b/lib/backdropWidgets.dart @@ -12,7 +12,8 @@ getBackdrop(context) { widgetMenuBottone( 'I miei voti', '/voti', - Icon(FontAwesomeIcons.pen, color: Colors.white, size: 18.0), + Icon(FontAwesomeIcons.pen, + color: Colors.white, size: 18.0), context), widgetMenuBottone( 'Orario', @@ -53,7 +54,7 @@ getBackdrop(context) { widgetMenuBottone( 'Dati anagrafici', '/datianagrafici', - Icon(FontAwesomeIcons.info, color: Colors.white, size: 18.0), + Icon(FontAwesomeIcons.info, color: Colors.white, size: 18.0), context), widgetMenuBottone( @@ -71,7 +72,8 @@ getBackdrop(context) { widgetMenuBottone( 'Impostazioni', '/impostazioni', - Icon(FontAwesomeIcons.cog, color: Colors.white, size: 18.0), + Icon(FontAwesomeIcons.cog, + color: Colors.white, size: 18.0), context) ]))); } From a1622fa56d074012d20835045351b571f1f10008 Mon Sep 17 00:00:00 2001 From: MatteoGalletta Date: Mon, 30 Aug 2021 14:23:49 +0200 Subject: [PATCH 4/5] Aggiunta Pulsante Logout in Impostazioni --- .flutter-plugins-dependencies | 2 +- lib/impostazioni.dart | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 62b04b2..2bef488 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-08-29 20:26:33.508391","version":"2.2.3"} +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-08-30 14:17:38.867488","version":"2.2.3"} \ No newline at end of file diff --git a/lib/impostazioni.dart b/lib/impostazioni.dart index bdd721c..5faff6d 100644 --- a/lib/impostazioni.dart +++ b/lib/impostazioni.dart @@ -148,6 +148,14 @@ class _ImpostazioniRouteState extends State { onTap: () { Navigator.of(context).pushNamed('/info'); }))); + widgetsImpostazioni.add(Card( + child: ListTile( + title: Text('Logout'), + leading: Icon(Icons.exit_to_app), + onTap: () async { + await Database.put('auth_token', null); // forza il login + Navigator.of(context).pushReplacementNamed('/login'); + }))); return BackdropScaffold( title: Text('Impostazioni'), backLayer: getBackdrop(context), From 6771f9d1ad15d45ca077e8e8d84cb355e85bc266 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Thu, 9 Sep 2021 10:10:15 +0200 Subject: [PATCH 5/5] fix --- .flutter-plugins-dependencies | 2 +- lib/database.dart | 5 +++++ lib/datianagrafici.dart | 2 +- lib/impostazioni.dart | 28 ++++++++++++++++++++++++-- lib/login.dart | 2 +- lib/orario.dart | 6 +++--- lib/scrutinio.dart | 35 +++++++++++---------------------- lib/widgets.dart | 2 +- pubspec.lock | 37 +++++++++++++++++++++-------------- pubspec.yaml | 3 ++- 10 files changed, 73 insertions(+), 49 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 2bef488..4be3da8 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"D:\\\\Flutter SDK\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-08-30 14:17:38.867488","version":"2.2.3"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"background_fetch","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"android":[{"name":"background_fetch","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\background_fetch-0.4.0\\\\","dependencies":[]},{"name":"flutter_local_notifications","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_local_notifications-1.4.0\\\\","dependencies":[]},{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"install_plugin","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\install_plugin-2.0.1\\\\","dependencies":[]},{"name":"package_info","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\package_info-0.4.0+16\\\\","dependencies":[]},{"name":"path_provider","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider-1.6.5\\\\","dependencies":[]},{"name":"quick_actions","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\quick_actions-0.4.0+2\\\\","dependencies":[]},{"name":"restart_app","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\restart_app-1.0.3\\\\","dependencies":[]},{"name":"url_launcher","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher-5.4.2\\\\","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-0.0.4\\\\","dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_macos-0.0.1+2\\\\","dependencies":[]}],"linux":[],"windows":[],"web":[{"name":"fluttertoast","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\fluttertoast-4.0.1\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\url_launcher_web-0.1.0+2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"background_fetch","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"fluttertoast","dependencies":[]},{"name":"install_plugin","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"quick_actions","dependencies":[]},{"name":"restart_app","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_web","url_launcher_macos"]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]}],"date_created":"2021-09-09 10:05:29.896674","version":"2.0.1"} \ No newline at end of file diff --git a/lib/database.dart b/lib/database.dart index b79fe81..2e21d00 100644 --- a/lib/database.dart +++ b/lib/database.dart @@ -31,4 +31,9 @@ class Database { var r = await box.get(key); return r; } + + static Future resetDatabase() async { + await autoInit(); + await box.clear(); + } } diff --git a/lib/datianagrafici.dart b/lib/datianagrafici.dart index dfef5b3..ba639d0 100644 --- a/lib/datianagrafici.dart +++ b/lib/datianagrafici.dart @@ -36,7 +36,7 @@ class _DatiAnagraficiRouteState extends State { : createLines([ {'label': 'Nome: ', 'value': dati['desNome']}, {'label': 'Cognome: ', 'value': dati['desCognome']}, - {'label': 'Sesso: ', 'value': dati['flgSesso'] == 'M' ? "Maschio" : "Femmina"}, + {'label': 'Sesso: ', 'value': dati['flgSesso'] == 'M' ? 'Maschio' : 'Femmina'}, {'label': 'Cittadinanza: ', 'value': dati['desCittadinanza']}, {'label': 'Codice Fiscale: ', 'value': dati['desCf']}, {'label': 'Telefono: ', 'value': dati['desTelefono']}, diff --git a/lib/impostazioni.dart b/lib/impostazioni.dart index 5faff6d..16e57f9 100644 --- a/lib/impostazioni.dart +++ b/lib/impostazioni.dart @@ -4,6 +4,7 @@ import 'package:background_fetch/background_fetch.dart'; import 'package:backdrop/backdrop.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:flutter_datetime_picker/flutter_datetime_picker.dart'; +import 'package:restart_app/restart_app.dart'; import 'backdropWidgets.dart'; import 'database.dart'; import 'api.dart'; @@ -153,8 +154,31 @@ class _ImpostazioniRouteState extends State { title: Text('Logout'), leading: Icon(Icons.exit_to_app), onTap: () async { - await Database.put('auth_token', null); // forza il login - Navigator.of(context).pushReplacementNamed('/login'); + showDialog( + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text('Logout'), + content: Text( + 'Vuoi resettare tutti i dati dell\'applicazione?'), + actions: [ + FlatButton( + child: new Text('No'), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + FlatButton( + child: new Text('Sì'), + onPressed: () async { + await Database.resetDatabase(); + Restart.restartApp(); + }, + ), + ], + ); + }, + ); }))); return BackdropScaffold( title: Text('Impostazioni'), diff --git a/lib/login.dart b/lib/login.dart index b99bcf1..75ea9e0 100644 --- a/lib/login.dart +++ b/lib/login.dart @@ -136,7 +136,7 @@ class _LoginRouteState extends State { passwordField.text); }, child: Text( - "LOGIN", + 'LOGIN', ), )) ])); diff --git a/lib/orario.dart b/lib/orario.dart index 0c1041a..f1448f4 100644 --- a/lib/orario.dart +++ b/lib/orario.dart @@ -133,16 +133,16 @@ class _OrarioRouteState extends State { ])), actions: [ FlatButton( - child: Text('Salva'), + child: Text('Chiudi'), onPressed: () { Navigator.of(context).pop(); - modificaMateria(giorno, ora); }, ), FlatButton( - child: Text('Chiudi'), + child: Text('Salva'), onPressed: () { Navigator.of(context).pop(); + modificaMateria(giorno, ora); }, ), ]); diff --git a/lib/scrutinio.dart b/lib/scrutinio.dart index 3f1de6a..fcd8444 100644 --- a/lib/scrutinio.dart +++ b/lib/scrutinio.dart @@ -4,7 +4,6 @@ import 'package:backdrop/backdrop.dart'; import 'dart:async'; import 'backdropWidgets.dart'; import 'api.dart'; -import 'database.dart'; class ScrutinioRoute extends StatefulWidget { @override @@ -14,26 +13,24 @@ class ScrutinioRoute extends StatefulWidget { } class _ScrutinioRouteState extends State { - var voti = {}; + var scrutinio = {}; final GlobalKey _refreshIndicatorKey = new GlobalKey(); generaLista() { var tiles = []; - voti.forEach((final idPeriodo, var periodoScrutinio) { - + scrutinio.forEach((final idPeriodo, var periodoScrutinio) { var votiScrutinio = []; - print("periodoScrutinio => " + periodoScrutinio.toString()); + print('periodoScrutinio => ' + periodoScrutinio.toString()); for (var voto in periodoScrutinio['dati']) { votiScrutinio.add(widgetScrutinio(voto, context)); } tiles.add(ExpansionTile( title: Text(periodoScrutinio['titolo']), - children: votiScrutinio.isNotEmpty ? votiScrutinio : [new Text("Nessun voto")] - ) - ); - + children: votiScrutinio.isNotEmpty + ? votiScrutinio + : [new Text('Nessun voto')])); }); return tiles; @@ -41,7 +38,6 @@ class _ScrutinioRouteState extends State { @override Widget build(BuildContext context) { - var lista = generaLista(); return BackdropScaffold( @@ -49,27 +45,18 @@ class _ScrutinioRouteState extends State { backLayer: getBackdrop(context), frontLayer: RefreshIndicator( key: _refreshIndicatorKey, - onRefresh: aggiornaVoti, - child: ListView( - children: new List.from([])..addAll(lista) - ) - ) - ); + onRefresh: aggiornaScrutinio, + child: + ListView(children: new List.from([])..addAll(lista)))); } - Future aggiornaVoti() async { + Future aggiornaScrutinio() async { var nuoviVoti = await votiscruitinio(); - - if (nuoviVoti.isNotEmpty) { - await Database.put('votiscrutinio', nuoviVoti); - } - setState(() { - voti = nuoviVoti; + scrutinio = nuoviVoti; }); } - void initState() { super.initState(); WidgetsBinding.instance diff --git a/lib/widgets.dart b/lib/widgets.dart index aeae308..7bfceb8 100644 --- a/lib/widgets.dart +++ b/lib/widgets.dart @@ -125,7 +125,7 @@ widgetScrutinio(voto, context) { leading: cerchioVoto(voto['votoOrale']['codVoto']), title: Text(voto['desMateria']), subtitle: ListBody(children: [ - Text((voto['assenze'] ?? 0).toString() + " assenze") + Text((voto['assenze'] ?? 0).toString() + ' assenze') ]) ) ); diff --git a/pubspec.lock b/pubspec.lock index 69b6227..ca1632c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,21 +7,21 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.6.1" + version: "2.5.0" backdrop: dependency: "direct main" description: @@ -84,7 +84,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.5" cupertino_icons: dependency: "direct main" description: @@ -124,7 +124,7 @@ packages: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.7.4" + version: "0.7.5" flutter_local_notifications: dependency: "direct main" description: @@ -145,7 +145,7 @@ packages: name: flutter_markdown url: "https://pub.dartlang.org" source: hosted - version: "0.3.4" + version: "0.3.5" flutter_test: dependency: "direct dev" description: flutter @@ -176,7 +176,7 @@ packages: name: hive url: "https://pub.dartlang.org" source: hosted - version: "1.4.1+1" + version: "1.4.4+1" http_parser: dependency: transitive description: @@ -190,7 +190,7 @@ packages: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.19" install_plugin: dependency: "direct main" description: @@ -218,7 +218,7 @@ packages: name: markdown url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.8" matcher: dependency: transitive description: @@ -281,7 +281,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "3.1.0" platform: dependency: transitive description: @@ -303,6 +303,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.0+2" + restart_app: + dependency: "direct main" + description: + name: restart_app + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" sky_engine: dependency: transitive description: flutter @@ -314,7 +321,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" stack_trace: dependency: transitive description: @@ -349,7 +356,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.2.19" typed_data: dependency: transitive description: @@ -398,14 +405,14 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "4.5.1" yaml: dependency: "direct main" description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "2.2.0" + version: "2.2.1" sdks: dart: ">=2.12.0 <3.0.0" - flutter: ">=1.12.13+hotfix.5" + flutter: ">=1.20.0" diff --git a/pubspec.yaml b/pubspec.yaml index 6e9756d..2cca989 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,7 +11,7 @@ description: App non ufficiale per Argo ScuolaNext. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.6+9 +version: 1.0.7+10 apk_url: https://github.com/peppelg/argo_scuolanext_famiglia_unofficial_app/releases/latest/download/app-release.apk environment: @@ -41,6 +41,7 @@ dependencies: background_fetch: ^0.4.0 font_awesome_flutter: ^8.8.1 install_plugin: ^2.0.1 + restart_app: ^1.0.3 dev_dependencies: flutter_test: