diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 803de6b3..1142b7be 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -11,7 +11,7 @@ jobs: - uses: subosito/flutter-action@v2 with: channel: 'stable' - flutter-version: '3.13.7' + flutter-version: '3.19.5' - name: Statically analyze the Dart code for any errors/warnings, ignoring "info" level warnings run: | diff --git a/analysis_options.yaml b/analysis_options.yaml deleted file mode 100644 index d4fcc1ad..00000000 --- a/analysis_options.yaml +++ /dev/null @@ -1 +0,0 @@ -include: package:pedantic/analysis_options.yaml \ No newline at end of file diff --git a/assets/config/dev.json b/assets/config/dev.json index 78e6eb3b..f6c0a12c 100644 --- a/assets/config/dev.json +++ b/assets/config/dev.json @@ -1,3 +1,3 @@ { - "baseUrl": "https://webdev.mosquitoalert.com" + "baseUrl": "https://api.mosquitoalert.com/v1" } \ No newline at end of file diff --git a/assets/fonts/Nunito-Black.ttf b/assets/fonts/Nunito-Black.ttf new file mode 100644 index 00000000..81d557c5 Binary files /dev/null and b/assets/fonts/Nunito-Black.ttf differ diff --git a/assets/fonts/Nunito-BlackItalic.ttf b/assets/fonts/Nunito-BlackItalic.ttf new file mode 100644 index 00000000..b4ba5a1f Binary files /dev/null and b/assets/fonts/Nunito-BlackItalic.ttf differ diff --git a/assets/fonts/Nunito-Bold.ttf b/assets/fonts/Nunito-Bold.ttf new file mode 100644 index 00000000..886134dc Binary files /dev/null and b/assets/fonts/Nunito-Bold.ttf differ diff --git a/assets/fonts/Nunito-BoldItalic.ttf b/assets/fonts/Nunito-BoldItalic.ttf new file mode 100644 index 00000000..0cb4efae Binary files /dev/null and b/assets/fonts/Nunito-BoldItalic.ttf differ diff --git a/assets/fonts/Nunito-ExtraBold.ttf b/assets/fonts/Nunito-ExtraBold.ttf new file mode 100644 index 00000000..711765e6 Binary files /dev/null and b/assets/fonts/Nunito-ExtraBold.ttf differ diff --git a/assets/fonts/Nunito-ExtraBoldItalic.ttf b/assets/fonts/Nunito-ExtraBoldItalic.ttf new file mode 100644 index 00000000..bffce10e Binary files /dev/null and b/assets/fonts/Nunito-ExtraBoldItalic.ttf differ diff --git a/assets/fonts/Nunito-ExtraLight.ttf b/assets/fonts/Nunito-ExtraLight.ttf new file mode 100644 index 00000000..d9eabf95 Binary files /dev/null and b/assets/fonts/Nunito-ExtraLight.ttf differ diff --git a/assets/fonts/Nunito-ExtraLightItalic.ttf b/assets/fonts/Nunito-ExtraLightItalic.ttf new file mode 100644 index 00000000..2037f4a7 Binary files /dev/null and b/assets/fonts/Nunito-ExtraLightItalic.ttf differ diff --git a/assets/fonts/Nunito-Italic.ttf b/assets/fonts/Nunito-Italic.ttf new file mode 100644 index 00000000..f4ab1149 Binary files /dev/null and b/assets/fonts/Nunito-Italic.ttf differ diff --git a/assets/fonts/Nunito-Light.ttf b/assets/fonts/Nunito-Light.ttf new file mode 100644 index 00000000..e64c0fef Binary files /dev/null and b/assets/fonts/Nunito-Light.ttf differ diff --git a/assets/fonts/Nunito-LightItalic.ttf b/assets/fonts/Nunito-LightItalic.ttf new file mode 100644 index 00000000..b465e5a2 Binary files /dev/null and b/assets/fonts/Nunito-LightItalic.ttf differ diff --git a/assets/fonts/Nunito-Medium.ttf b/assets/fonts/Nunito-Medium.ttf new file mode 100644 index 00000000..e24c1d61 Binary files /dev/null and b/assets/fonts/Nunito-Medium.ttf differ diff --git a/assets/fonts/Nunito-MediumItalic.ttf b/assets/fonts/Nunito-MediumItalic.ttf new file mode 100644 index 00000000..6fec0957 Binary files /dev/null and b/assets/fonts/Nunito-MediumItalic.ttf differ diff --git a/assets/fonts/Nunito-Regular.ttf b/assets/fonts/Nunito-Regular.ttf new file mode 100644 index 00000000..9411bfbe Binary files /dev/null and b/assets/fonts/Nunito-Regular.ttf differ diff --git a/assets/fonts/Nunito-SemiBold.ttf b/assets/fonts/Nunito-SemiBold.ttf new file mode 100644 index 00000000..1326a7dc Binary files /dev/null and b/assets/fonts/Nunito-SemiBold.ttf differ diff --git a/assets/fonts/Nunito-SemiBoldItalic.ttf b/assets/fonts/Nunito-SemiBoldItalic.ttf new file mode 100644 index 00000000..d20e95f7 Binary files /dev/null and b/assets/fonts/Nunito-SemiBoldItalic.ttf differ diff --git a/assets/fonts/Rubik-Black.ttf b/assets/fonts/Rubik-Black.ttf deleted file mode 100644 index bc4626f7..00000000 Binary files a/assets/fonts/Rubik-Black.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-BlackItalic.ttf b/assets/fonts/Rubik-BlackItalic.ttf deleted file mode 100644 index f8b571c1..00000000 Binary files a/assets/fonts/Rubik-BlackItalic.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-Bold.ttf b/assets/fonts/Rubik-Bold.ttf deleted file mode 100644 index 4e77930f..00000000 Binary files a/assets/fonts/Rubik-Bold.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-BoldItalic.ttf b/assets/fonts/Rubik-BoldItalic.ttf deleted file mode 100644 index f6322472..00000000 Binary files a/assets/fonts/Rubik-BoldItalic.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-Italic.ttf b/assets/fonts/Rubik-Italic.ttf deleted file mode 100644 index 2ddac98e..00000000 Binary files a/assets/fonts/Rubik-Italic.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-Light.ttf b/assets/fonts/Rubik-Light.ttf deleted file mode 100644 index 8189d848..00000000 Binary files a/assets/fonts/Rubik-Light.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-LightItalic.ttf b/assets/fonts/Rubik-LightItalic.ttf deleted file mode 100644 index 8a9ae95a..00000000 Binary files a/assets/fonts/Rubik-LightItalic.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-Medium.ttf b/assets/fonts/Rubik-Medium.ttf deleted file mode 100644 index 9e358b2f..00000000 Binary files a/assets/fonts/Rubik-Medium.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-MediumItalic.ttf b/assets/fonts/Rubik-MediumItalic.ttf deleted file mode 100644 index 8f94b7f3..00000000 Binary files a/assets/fonts/Rubik-MediumItalic.ttf and /dev/null differ diff --git a/assets/fonts/Rubik-Regular.ttf b/assets/fonts/Rubik-Regular.ttf deleted file mode 100644 index 52b59ca4..00000000 Binary files a/assets/fonts/Rubik-Regular.ttf and /dev/null differ diff --git a/lib/api/api.dart b/lib/api/api.dart index d8e81e6b..e491161a 100644 --- a/lib/api/api.dart +++ b/lib/api/api.dart @@ -12,9 +12,7 @@ import 'package:mosquito_alert_app/models/owcampaing.dart'; import 'package:mosquito_alert_app/models/partner.dart'; import 'package:mosquito_alert_app/models/report.dart'; import 'package:mosquito_alert_app/models/response.dart'; -import 'package:mosquito_alert_app/models/session.dart'; import 'package:mosquito_alert_app/models/topic.dart'; -import 'package:mosquito_alert_app/utils/PushNotificationsManager.dart'; import 'package:mosquito_alert_app/utils/UserManager.dart'; import 'package:mosquito_alert_app/utils/Utils.dart'; import 'package:mosquito_alert_app/app_config.dart'; @@ -37,19 +35,12 @@ class ApiSingleton { //Reports static const reports = '/reports/'; - //Session - static const sessions = '/sessions/'; - static const sessionUpdate = '/session_update/'; - //Images static const photos = '/photos/'; //Notifications static const notifications = '/user_notifications/'; static const mark_notification_as_read = '/mark_notif_as_ack/'; - static const subscribe_to_topic = '/subscribe_to_topic/'; - static const unsub_from_topic = '/unsub_from_topic/'; - static const get_my_topics = '/topics_subscribed/'; static const firebaseToken = '/token/'; //Fixes @@ -80,7 +71,7 @@ class ApiSingleton { static Future initialize(String env) async { final config = await AppConfig.forEnvironment(env: env); baseUrl = config.baseUrl; - serverUrl = '$baseUrl/api'; + serverUrl = baseUrl; await UserManager.setServerUrl(serverUrl); } @@ -187,104 +178,6 @@ class ApiSingleton { } } - //Sessions - Future getLastSession(String? userUUID) async { - try { - final response = await http - .get( - Uri.parse('$serverUrl$sessions?user=$userUUID'), - headers: headers, - ) - .timeout( - Duration(seconds: _timeoutTimerInSeconds), - onTimeout: () { - print('Request timed out'); - return Future.error('Request timed out'); - }, - ); - - if (response.statusCode != 200) { - print( - 'Request: ${response.request.toString()} -> Response: ${response.body}'); - return ApiResponse.fromJson(json.decode(response.body)); - } else { - List jsonAnswer = json.decode(response.body); - var allSessions = []; - - for (var item in jsonAnswer) { - allSessions.add(Session.fromJson(item)); - } - - if (allSessions.isEmpty) { - return 0; - } - - return allSessions[0].session_ID; - } - } catch (e) { - print(e); - return false; - } - } - - Future createSession(Session session) async { - try { - final response = await http - .post(Uri.parse('$serverUrl$sessions'), - headers: headers, - body: json.encode( - session.toJson(), - )) - .timeout( - Duration(seconds: _timeoutTimerInSeconds), - onTimeout: () { - print('Request timed out'); - return Future.error('Request timed out'); - }, - ); - ; - - if (response.statusCode != 201) { - print( - 'Request: ${response.request.toString()} -> Response: ${response.body}'); - return ApiResponse.fromJson(json.decode(response.body)); - } - - var body = json.decode(response.body); - return body['id']; - } catch (e) { - // print(e); - return false; - } - } - - Future closeSession(Session session) async { - try { - final response = await http - .put(Uri.parse('$serverUrl$sessionUpdate${session.session_ID}/'), - headers: headers, - body: json.encode({'session_end_time': session.session_end_time})) - .timeout( - Duration(seconds: _timeoutTimerInSeconds), - onTimeout: () { - print('Request timed out'); - return Future.error('Request timed out'); - }, - ); - ; - - if (response.statusCode != 200) { - print( - 'Request: ${response.request.toString()} -> Response: ${response.body}'); - return ApiResponse.fromJson(json.decode(response.body)); - } - - return true; - } catch (e) { - return false; - } - } - //Reports Future createReport(Report report) async { try { @@ -395,8 +288,6 @@ class ApiSingleton { var jsonAnswer = json.decode(response.body); var newReport = await Report.fromJsonAsync(jsonAnswer); - await PushNotificationsManager.subscribeToReportResult(newReport); - await getUserScores(); return newReport; } catch (e) { @@ -674,90 +565,6 @@ class ApiSingleton { } } - Future subscribeToTopic( - String userIdentifier, String? topicIdentifier) async { - try { - final response = await http - .post( - Uri.parse( - '$serverUrl$subscribe_to_topic?user=$userIdentifier&code=$topicIdentifier'), - headers: headers) - .timeout( - Duration(seconds: _timeoutTimerInSeconds), - onTimeout: () { - print('Request timed out'); - return Future.error('Request timed out'); - }, - ); - if (response.statusCode == 201) { - print('Succes subscribing to $topicIdentifier.'); - - return true; - } - print( - 'subscribeToTopic $topicIdentifier, failed (code ${response.statusCode})'); - return false; - } catch (e) { - print('subscribeToTopic $topicIdentifier, failed for $e'); - return false; - } - } - - Future unsubscribeFromTopic( - String userIdentifier, String topicIdentifier) async { - try { - final response = await http - .post( - Uri.parse( - '$serverUrl$unsub_from_topic?user=$userIdentifier&code=$topicIdentifier'), - headers: headers) - .timeout( - Duration(seconds: _timeoutTimerInSeconds), - onTimeout: () { - print('Request timed out'); - return Future.error('Request timed out'); - }, - ); - if (response.statusCode == 204) { - return true; - } - print('unsubscribeFromTopic, failed.'); - return false; - } catch (e) { - print('unsubscribeFromTopic, failed for $e.'); - return false; - } - } - - Future?> getTopicsSubscribed(String userIdentifier) async { - try { - final response = await http - .get(Uri.parse('$serverUrl$get_my_topics?user=$userIdentifier'), - headers: headers) - .timeout( - Duration(seconds: _timeoutTimerInSeconds), - onTimeout: () { - print('Request timed out'); - return Future.error('Request timed out'); - }, - ); - if (response.statusCode == 200) { - final data = jsonDecode(response.body) as List; - var topicList = []; - for (dynamic top in data) { - var topic = Topic.fromJson(top); - topicList.add(topic); - } - return topicList; - } - print('getTopicsSubscribed, failed.'); - return null; - } catch (e) { - print('getTopicsSubscribed, failed for $e'); - return null; - } - } - Future setFirebaseToken(String? userIdentifier, String fcmToken) async { print(userIdentifier); print(fcmToken); diff --git a/lib/main.dart b/lib/main.dart index 44e59aa0..8053f57b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:mosquito_alert_app/pages/main/main_vc.dart'; import 'package:mosquito_alert_app/utils/BackgroundTracking.dart'; import 'package:workmanager/workmanager.dart'; @@ -7,7 +8,6 @@ import 'package:connectivity/connectivity.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:mosquito_alert_app/api/api.dart'; -import 'package:mosquito_alert_app/pages/main/drawer_and_header.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:mosquito_alert_app/utils/Application.dart'; import 'package:mosquito_alert_app/utils/MyLocalizationsDelegate.dart'; @@ -112,20 +112,48 @@ class _MyAppState extends State { @override Widget build(BuildContext context) { return OverlaySupport( - child: MaterialApp( - debugShowCheckedModeBanner: false, - theme: ThemeData( - primarySwatch: Colors.orange, + child: MaterialApp( + debugShowCheckedModeBanner: false, + theme: ThemeData( + fontFamily: 'Nunito', + textTheme: TextTheme( + titleMedium: TextStyle( + color: Color(0xFF000000), + fontSize: 25.0, + fontWeight: FontWeight.w400, + ), + bodyMedium: TextStyle( + color: Color(0xFF000000), + fontSize: 16.0, + fontWeight: FontWeight.w400, + ), + bodySmall: TextStyle( + color: Colors.grey[600], + fontSize: 11.0, + fontWeight: FontWeight.w400, + ), + labelMedium: TextStyle( + color: Colors.white, + fontSize: 12.0, + fontWeight: FontWeight.bold, + ), + labelSmall: TextStyle( + color: Color(0xFF979797), + fontSize: 10.0, + fontWeight: FontWeight.normal, + ), + ), + ), + navigatorKey: navigatorKey, + home: MainVC(), + localizationsDelegates: [ + _newLocaleDelegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: application.supportedLocales(), ), - navigatorKey: navigatorKey, - home: MainVC(), - localizationsDelegates: [ - _newLocaleDelegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: application.supportedLocales(), - )); + ); } } diff --git a/lib/pages/forms_pages/adult_report_page.dart b/lib/pages/forms_pages/adult_report_page.dart deleted file mode 100644 index 6b8ee22f..00000000 --- a/lib/pages/forms_pages/adult_report_page.dart +++ /dev/null @@ -1,450 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/api/api.dart'; -import 'package:mosquito_alert_app/models/owcampaing.dart'; -import 'package:mosquito_alert_app/models/report.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/biting_report_page.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/add_other_report_form.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/add_photo_button_widget.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/could_see_form.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/questions_breeding_form.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/campaign_tutorial_page.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -import 'components/biting_location_form.dart'; - -class AdultReportPage extends StatefulWidget { - final Report? editReport; - final Function? loadData; - - AdultReportPage({this.editReport, this.loadData}); - - @override - _AdultReportPageState createState() => _AdultReportPageState(); -} - -class _AdultReportPageState extends State { - PageController? _pagesController; - List? _formsRepot; - List? _initialformsRepot; - StreamController loadingStream = StreamController.broadcast(); - StreamController validStream = StreamController.broadcast(); - StreamController skipParts = StreamController.broadcast(); - StreamController percentStream = - StreamController.broadcast(); - double? index; - - List displayQuestions = [ - { - 'question': {'id': 13, 'text': 'question_13'}, - 'answers': [ - {'id': 131, 'text': 'question_13_answer_131'}, - {'id': 132, 'text': 'question_13_answer_132'}, - {'id': 133, 'text': 'question_13_answer_133'}, - ] - }, - { - 'question': {'id': 8, 'text': 'question_8'}, - 'answers': [ - {'id': 82, 'text': 'question_8_answer_82'}, - {'id': 81, 'text': 'question_8_answer_81'}, - ] - }, - ]; - - bool addBiting = false; - bool showCamera = false; - String? otherReport; - late Report toEditReport; - bool _atLeastOnePhotoAttached = false; - - void _initializeReport() async { - if (widget.editReport != null) { - toEditReport = await Report.fromJsonAsync(widget.editReport!.toJson()); - Utils.setEditReport(toEditReport); - } - } - - @override - void initState() { - super.initState(); - _initializeReport(); - _pagesController = PageController(); - index = 0.0; - _initialformsRepot = [ - AddPhotoButton(true, true, _checkAtLeastOnePhotoAttached, 'ensure_single_mosquito_photos', 'one_mosquito_reminder_badge'), - BitingLocationForm( - setValid, displayQuestions.elementAt(0)['question']['text']), - QuestionsBreedingForm( - displayQuestions.elementAt(0), setValid, false, null, ''), - CouldSeeForm( - addBitingReport, displayQuestions.elementAt(1), setValid, goNextPage), - AddOtherReportPage(_createReport, setValid, percentStream), - ]; - - _formsRepot = _initialformsRepot; - } - - void setShowCamera(data) { - setState(() { - showCamera = data; - }); - } - - void addBitingReport(addReport) { - setState(() { - addBiting = addReport; - }); - } - - void addOtherReport(String? reportType) { - setState(() { - otherReport = reportType; - }); - } - - void setValid(isValid) { - validStream.add(isValid); - } - - void goNextPage() { - if (addBiting) { - Utils.addOtherReport('bite'); - Navigator.push( - context, - MaterialPageRoute(builder: (context) => BitingReportPage()), - ); - } else { - _pagesController! - .nextPage(duration: Duration(microseconds: 300), curve: Curves.ease) - .then((value) => setValid(widget.editReport != null)); - setState(() { - index = _pagesController!.page! + 1; - }); - } - } - - void _createReport() async { - loadingStream.add(true); - setState(() { - percentStream.add(0.8); - }); - var res = await Utils.createReport(); - - if (res!=null && !res) { - _showAlertKo(); - } else { - if (Utils.savedAdultReport != null && - Utils.savedAdultReport!.country != null) { - List campaignsList = - await ApiSingleton().getCampaigns(Utils.savedAdultReport!.country); - var now = DateTime.now().toUtc(); - if (campaignsList.any((element) => - DateTime.parse(element.startDate!).isBefore(now) && - DateTime.parse(element.endDate!).isAfter(now))) { - var activeCampaign = campaignsList.firstWhere((element) => - DateTime.parse(element.startDate!).isBefore(now) && - DateTime.parse(element.endDate!).isAfter(now)); - - await Utils.showAlertCampaign( - context, - activeCampaign, - (ctx) { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => CampaignTutorialPage( - fromReport: true, - )), - ); - Utils.resetReport(); - }, - ); - } else { - _showAlertOk(); - } - } else { - _showAlertOk(); - } - - setState(() { - percentStream.add(1.0); - }); - } - loadingStream.add(false); - if (widget.editReport != null) { - widget.loadData!(); - } - } - - @override - void dispose() { - _pagesController!.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - _onWillPop(); - return false; - }, - child: Stack( - children: [ - Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - centerTitle: true, - leading: IconButton( - icon: Style.iconBack, - onPressed: () { - var currentPage = _pagesController!.page; - - if (currentPage == 0.0) { - setState(() { - index = currentPage! - 1; - }); - _onWillPop(); - } else { - if (currentPage == 2.0 && !Utils.report!.responses!.any((element) => element!.answer_id == 61)) { - setState(() { - index = 0; - }); - _pagesController! - .animateToPage(0, - duration: Duration(microseconds: 300), - curve: Curves.ease) - .then((value) { - setValid(true); - addOtherReport(null); - }); - } else if (currentPage == 4.0) { - addBitingReport(false); - _pagesController!.previousPage( - duration: Duration(microseconds: 300), - curve: Curves.ease); - setState(() { - index = currentPage! - 1; - }); - } else { - setState(() { - index = currentPage! - 1; - }); - _pagesController! - .previousPage( - duration: Duration(microseconds: 300), - curve: Curves.ease) - .then((value) { - setValid(true); - addOtherReport(null); - }); - } - } - }, - ), - title: Style.title( - MyLocalizations.of(context, 'adult_report_title'), - fontSize: 16), - ), - body: Stack( - alignment: Alignment.bottomCenter, - children: [ - PageView( - controller: _pagesController, - physics: NeverScrollableScrollPhysics(), - children: _formsRepot!, - ), - index! < 1.0 - ? continueButtonPhotos() - : index != _formsRepot!.length.toDouble() - 1 - ? SafeArea( - child: Align( - alignment: Alignment.bottomCenter, - child: StreamBuilder( - stream: validStream.stream, - initialData: false, - builder: (BuildContext ctxt, AsyncSnapshot snapshot) { - return snapshot.data! - ? continueButton(index) - : Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'continue_txt'), null), - ); - }), - )) - : SafeArea( - child: _formsRepot!.length == 2 - ? Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of( - context, 'understand_txt'), - () { - Navigator.pop(context); - Utils.resetReport(); - Utils.imagePath = null; - }, - ), - ) - : Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'send_data'), - () { - _createReport(); - }, - ), - ), - ), - ], - ), - ), - StreamBuilder( - stream: loadingStream.stream, - initialData: false, - builder: (BuildContext ctxt, AsyncSnapshot snapshot) { - if (snapshot.hasData == false || snapshot.data == false) { - return Container(); - } - return Utils.loading( - snapshot.data, - ); - }, - ) - ], - ), - ); - } - - void _checkAtLeastOnePhotoAttached(){ - setState(() { - _atLeastOnePhotoAttached = true; - }); - } - - Widget continueButtonPhotos(){ - if(!_atLeastOnePhotoAttached){ - return Container(); - } - - return Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric(vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'continue_txt'), () { - goNextPage(); - } - ) - ); - } - - Widget continueButton(double? index){ - return Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: - Style.button( - MyLocalizations.of(context, 'continue_txt'), () { - var currentPage = _pagesController!.page; - - if (currentPage == 3.0 && addBiting) { - Utils.addOtherReport('bite'); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - BitingReportPage()), - ); - } else { - setState(() { - index = currentPage! + 1; - }); - - _pagesController! - .nextPage( - duration: Duration(microseconds: 300), - curve: Curves.ease) - .then((value) => setValid(widget.editReport != null)); - } - } - ) - ); - } - - void _showAlertOk() { - loadingStream.add(false); - - Utils.showAlert( - MyLocalizations.of(context, 'app_name'), - widget.editReport == null - ? MyLocalizations.of(context, 'save_report_ok_txt') - : MyLocalizations.of(context, 'edited_report_ok_txt'), - context, - onPressed: () { - Navigator.pop(context); - if (widget.editReport != null) { - Navigator.pop(context); - } else { - Navigator.of(context).popUntil((r) => r.isFirst); - Utils.resetReport(); - } - - Utils.requestInAppReview(); - }, - barrierDismissible: false, - ); - } - - void _showAlertKo() { - loadingStream.add(false); - Utils.showAlert( - MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'save_report_ko_txt'), - context, - onPressed: () { - Navigator.pop(context); - if (widget.editReport != null) { - Navigator.pop(context); - } else { - Navigator.of(context).popUntil((r) => r.isFirst); - Utils.resetReport(); - } - }, - barrierDismissible: false, - ); - } - - void _onWillPop() { - if (Utils.report!.responses!.isNotEmpty) { - Utils.showAlertYesNo(MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'close_report_no_save_txt'), () { - if (Utils.reportsList != null && Utils.reportsList!.isNotEmpty) { - Utils.deleteLastReport(); - } else { - Utils.resetReport(); - Utils.imagePath = null; - } - Navigator.pop(context); - }, context); - } else { - Navigator.pop(context); - } - } -} diff --git a/lib/pages/forms_pages/biting_report_page.dart b/lib/pages/forms_pages/biting_report_page.dart deleted file mode 100644 index 66a5dbb6..00000000 --- a/lib/pages/forms_pages/biting_report_page.dart +++ /dev/null @@ -1,411 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/api/api.dart'; -import 'package:mosquito_alert_app/models/owcampaing.dart'; -import 'package:mosquito_alert_app/models/report.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/add_other_report_form.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/campaign_tutorial_page.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -import 'adult_report_page.dart'; -import 'components/biting_form.dart'; -import 'components/biting_location_form.dart'; - -class BitingReportPage extends StatefulWidget { - final Report? editReport; - final Function? loadData; - - BitingReportPage({this.editReport, this.loadData}); - @override - _BitingReportPageState createState() => _BitingReportPageState(); -} - -class _BitingReportPageState extends State { - PageController? _pagesController; - late List _formsRepot; - String? otherReport; - bool seeButton = false; - bool addMosquito = false; - StreamController loadingStream = StreamController.broadcast(); - StreamController validStream = StreamController.broadcast(); - StreamController percentStream = StreamController.broadcast(); - double index = 0; - - List displayQuestions = [ - { - 'question': {'id': 1, 'text': 'question_1'}, - 'answers': [ - //Number of bites - value equals TOTAL number of bites - {'id': 11, 'text': 'question_1_answer_11'} - ] - }, - { - 'question': {'id': 2, 'text': 'question_2'}, - 'answers': [ - //Bites by body are - value equals number of bites in each area, must be = to total number of bites - {'id': 21, 'text': 'question_2_answer_21'}, - {'id': 22, 'text': 'question_2_answer_22'}, - {'id': 23, 'text': 'question_2_answer_23'}, - {'id': 24, 'text': 'question_2_answer_24'}, - {'id': 25, 'text': 'question_2_answer_25'}, - {'id': 26, 'text': 'question_2_answer_26'} - ] - }, - { - 'question': {'id': 4, 'text': 'question_4'}, - 'answers': [ - {'id': 41, 'text': 'question_4_answer_41'}, - {'id': 42, 'text': 'question_4_answer_42'}, - {'id': 43, 'text': 'question_4_answer_43'}, - {'id': 44, 'text': 'question_4_answer_44'}, - ] - }, - { - 'question': {'id': 5, 'text': 'question_5'}, - 'answers': [ - {'id': 51, 'text': 'question_5_answer_51'}, - {'id': 52, 'text': 'question_5_answer_52'}, - ] - }, - { - 'question': {'id': 3, 'text': 'question_3'}, - 'answers': [ - {'id': 31, 'text': 'question_3_answer_31'}, - {'id': 32, 'text': 'question_3_answer_32'}, - {'id': 33, 'text': 'question_3_answer_33'}, - {'id': 34, 'text': 'question_3_answer_34'}, - ] - }, - { - 'question': {'id': 14, 'text': 'question_14'}, - }, - ]; - late Report toEditReport; - - void _initializeReport() async { - if (widget.editReport != null) { - toEditReport = await Report.fromJsonAsync(widget.editReport!.toJson()); - Utils.setEditReport(toEditReport); - } - } - - @override - void initState() { - super.initState(); - _initializeReport(); - _pagesController = PageController(); - _formsRepot = [ - BitingForm( - [ - displayQuestions.elementAt(0), - displayQuestions.elementAt(1), - displayQuestions.elementAt(2), - displayQuestions.elementAt(3), - displayQuestions.elementAt(4), - ], - setValid, - goNextPage, - ), - BitingLocationForm( - setValid, - displayQuestions.elementAt(5)['question']['text'], - ), - AddOtherReportPage(_saveData, setValid, percentStream), - ]; - } - - void addOtherReport(String? reportType) { - setState(() { - otherReport = reportType; - }); - } - - void addAdultReport(addReport) { - setState(() { - addMosquito = addReport; - }); - } - - void setValid(isValid) { - validStream.add(isValid); - } - - void _saveData() async { - setState(() { - percentStream.add(0.8); - }); - loadingStream.add(true); - var res = await Utils.createReport(); - - if (widget.editReport != null) { - widget.loadData!(); - } - if (!res!) { - _showAlertKo(); - } else { - if (Utils.savedAdultReport != null) { - List campaingsList = - await ApiSingleton().getCampaigns(Utils.savedAdultReport!.country); - var now = DateTime.now().toUtc(); - if (campaingsList.any((element) => - DateTime.parse(element.startDate!).isBefore(now) && - DateTime.parse(element.endDate!).isAfter(now))) { - var activeCampaign = campaingsList.firstWhere((element) => - DateTime.parse(element.startDate!).isBefore(now) && - DateTime.parse(element.endDate!).isAfter(now)); - await Utils.showAlertCampaign( - context, - activeCampaign, - (ctx) { - Navigator.pushReplacement( - context, - MaterialPageRoute( - builder: (context) => CampaignTutorialPage( - fromReport: true, - )), - ); - Utils.resetReport(); - }, - ); - } else { - _showAlertOk(); - } - } else { - _showAlertOk(); - } - - setState(() { - percentStream.add(1.0); - }); - } - } - - void goNextPage() { - _pagesController! - .nextPage(duration: Duration(microseconds: 300), curve: Curves.ease) - .then((value) { - setState(() { - seeButton = true; - }); - }); - setState(() { - index = _pagesController!.page! + 1; - }); - } - - @override - void dispose() { - _pagesController!.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - _onWillPop(); - return false; - }, - child: Stack( - children: [ - Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - centerTitle: true, - leading: IconButton( - icon: Style.iconBack, - onPressed: () { - var currentPage = _pagesController!.page; - - if (currentPage == 0.0) { - _onWillPop(); - } else if (currentPage == 1) { - _pagesController! - .previousPage( - duration: Duration(microseconds: 300), - curve: Curves.ease) - .then((value) {}); - } else { - addOtherReport(null); - _pagesController!.previousPage( - duration: Duration(microseconds: 300), - curve: Curves.ease); - } - setState(() { - index = currentPage! - 1; - }); - }, - ), - title: Style.title( - MyLocalizations.of(context, 'biting_report_txt'), - fontSize: 16), - actions: [], - ), - body: Stack( - alignment: Alignment.bottomCenter, - children: [ - PageView( - controller: _pagesController, - physics: NeverScrollableScrollPhysics(), - children: _formsRepot, - ), - index == 0.0 - ? Container() - : index != _formsRepot.length.toDouble() - 1 - ? SafeArea( - child: Align( - alignment: Alignment.bottomCenter, - child: StreamBuilder( - stream: validStream.stream, - initialData: false, - builder: (BuildContext ctxt, - AsyncSnapshot snapshot) { - return snapshot.data! - ? Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of( - context, 'continue_txt'), - () { - var currentPage = - _pagesController!.page; - - if (currentPage == 2 && - addMosquito) { - Utils.addOtherReport('adult'); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - AdultReportPage()), - ); - } else { - setState(() { - index = currentPage! + 1; - }); - _pagesController! - .nextPage( - duration: Duration( - microseconds: - 300), - curve: Curves.ease) - .then((value) => setValid( - widget.editReport != - null)); - } - }), - ) - : Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of( - context, 'continue_txt'), - null), - ); - })), - ) - : SafeArea( - child: Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'send_data'), - () { - _saveData(); - }, - ), - ), - ), - ], - ), - ), - StreamBuilder( - stream: loadingStream.stream, - initialData: false, - builder: (BuildContext ctxt, AsyncSnapshot snapshot) { - if (snapshot.hasData == false || snapshot.data == false) { - return Container(); - } - return Utils.loading( - snapshot.data, - ); - }, - ) - ], - ), - ); - } - - _showAlertOk() { - loadingStream.add(false); - Utils.showAlert( - MyLocalizations.of(context, 'app_name'), - widget.editReport == null - ? MyLocalizations.of(context, 'save_report_ok_txt') - : MyLocalizations.of(context, 'edited_report_ok_txt'), - context, - onPressed: () { - Navigator.pop(context); - if (widget.editReport != null) { - Navigator.pop(context); - } else { - Navigator.of(context).popUntil((r) => r.isFirst); - Utils.resetReport(); - } - - Utils.requestInAppReview(); - }, - barrierDismissible: false, - ); - } - - _showAlertKo() { - loadingStream.add(false); - Utils.showAlert( - MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'save_report_ko_txt'), - context, - onPressed: () { - Navigator.pop(context); - if (widget.editReport != null) { - Navigator.pop(context); - } else { - Navigator.of(context).popUntil((r) => r.isFirst); - Utils.resetReport(); - } - }, - barrierDismissible: false, - ); - } - - _onWillPop() { - if (Utils.report!.responses!.isNotEmpty) { - Utils.showAlertYesNo(MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'close_report_no_save_txt'), () { - if (Utils.reportsList != null && Utils.reportsList!.isNotEmpty) { - Utils.deleteLastReport(); - } else { - Utils.resetReport(); - Utils.imagePath = null; - } - Navigator.pop(context); - }, context); - } else { - if (Utils.reportsList!.isNotEmpty) { - Utils.deleteLastReport(); - } - Navigator.pop(context); - } - } -} diff --git a/lib/pages/forms_pages/breeding_report_page.dart b/lib/pages/forms_pages/breeding_report_page.dart deleted file mode 100644 index 37264c18..00000000 --- a/lib/pages/forms_pages/breeding_report_page.dart +++ /dev/null @@ -1,400 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/models/report.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/adult_report_page.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/biting_report_page.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/add_other_report_form.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/add_photo_button_widget.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/biting_location_form.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/questions_breeding_form.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class BreedingReportPage extends StatefulWidget { - final Report? editReport; - final Function? loadData; - - BreedingReportPage({this.editReport, this.loadData}); - - @override - _BreedingReportPageState createState() => _BreedingReportPageState(); -} - -class _BreedingReportPageState extends State { - PageController? _pagesController; - late List _formsRepot, _initialFormsReport; - StreamController loadingStream = StreamController.broadcast(); - StreamController validStream = StreamController.broadcast(); - StreamController percentStream = - StreamController.broadcast(); - - List displayQuestions = [ - { - 'question': {'id': 12, 'text': 'question_12'}, - 'answers': [ - { - 'img': 'assets/img/ic_imbornal.png', - 'id': 121, - 'text': 'question_12_answer_121' - }, - { - 'img': 'assets/img/ic_other_site.png', - 'id': 122, - 'text': 'question_12_answer_122' - } - ] - }, - { - 'question': {'id': 10, 'text': 'question_10'}, - 'answers': [ - {'id': 101, 'text': 'question_10_answer_101'}, - {'id': 81, 'text': 'question_10_answer_102'} - ] - }, - { - 'question': {'id': 17, 'text': 'question_17'}, - 'answers': [ - {'id': 101, 'text': 'question_10_answer_101'}, - {'id': 81, 'text': 'question_10_answer_102'} - ] - }, - { - 'question': {'id': 16, 'text': 'question_16'}, - }, - ]; - - bool showCamera = false; - bool touched = false; - String? otherReport; - late Report toEditReport; - - double index = 1.0; - double displayContinue = 1.0; - bool _atLeastOnePhotoAttached = false; - - void _initializeReport() async { - if (widget.editReport != null) { - toEditReport = await Report.fromJsonAsync(widget.editReport!.toJson()); - Utils.setEditReport(toEditReport); - } - } - - @override - void initState() { - super.initState(); - _initializeReport(); - _pagesController = PageController(); - - _formsRepot = [ - QuestionsBreedingForm( - displayQuestions.elementAt(0), - setValid, - true, - goNextPage, - 'assets/img/bottoms/breeding_1.png'), - AddPhotoButton(true, true, _checkAtLeastOnePhotoAttached, null, null), - QuestionsBreedingForm( - displayQuestions.elementAt(1), - setValid, - false, - goNextPage, - 'assets/img/bottoms/breeding_2.png', - skipPage3: skipPage3, - ), - QuestionsBreedingForm(displayQuestions.elementAt(2), setValid, false, - goNextPage, 'assets/img/bottoms/breeding_3.png'), - BitingLocationForm( - setValid, displayQuestions.elementAt(3)['question']['text']), - AddOtherReportPage(_createReport, setValid, percentStream), - ]; - _initialFormsReport = List.from(_formsRepot); - } - - void skipPage3(skip) { - var list = List.from(_initialFormsReport); - if (skip) { - list.removeAt(3); - setState(() { - _formsRepot = list; - displayContinue = 2.0; - }); - } else { - setState(() { - _formsRepot = List.from(_initialFormsReport); - displayContinue = 3.0; - }); - } - } - - void _checkAtLeastOnePhotoAttached(){ - setState(() { - _atLeastOnePhotoAttached = true; - }); - } - - void addOtherReport(String? reportType) { - setState(() { - otherReport = reportType; - }); - } - - void setShowCamera(data) { - setState(() { - showCamera = data; - }); - } - - void setValid(isValid) { - validStream.add(isValid); - } - - void goNextPage() { - _pagesController! - .nextPage(duration: Duration(microseconds: 300), curve: Curves.ease) - .then((value) => setValid(widget.editReport != null)); - setState(() { - index = _pagesController!.page! + 1; - }); - } - - void navigateOtherReport() async { - switch (otherReport) { - case 'bite': - Utils.addOtherReport('bite'); - await Navigator.push( - context, - MaterialPageRoute(builder: (context) => BitingReportPage()), - ); - break; - case 'adult': - Utils.addOtherReport('adult'); - await Navigator.push( - context, - MaterialPageRoute(builder: (context) => AdultReportPage()), - ); - break; - default: - break; - } - } - - void _createReport() async { - setState(() { - percentStream.add(0.8); - }); - loadingStream.add(true); - var res = await Utils.createReport(); - - if (widget.editReport != null) { - widget.loadData!(); - } - if (!res!) { - _showAlertKo(); - } else { - _showAlertOk(); - setState(() { - percentStream.add(1.0); - }); - } - } - - @override - void dispose() { - _pagesController!.dispose(); - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - _onWillPop(); - return false; - }, - child: Stack( - children: [ - Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - centerTitle: true, - leading: IconButton( - icon: Style.iconBack, - onPressed: () { - var currentPage = _pagesController!.page; - - if (currentPage == 0.0) { - _onWillPop(); - } else { - _pagesController! - .previousPage( - duration: Duration(microseconds: 300), - curve: Curves.ease) - .then((value) => addOtherReport(null)); - } - setState(() { - index = currentPage! - 1; - }); - }, - ), - title: Style.title( - MyLocalizations.of(context, 'breeding_report_title'), - fontSize: 16), - ), - body: Stack( - alignment: Alignment.bottomCenter, - children: [ - PageView( - controller: _pagesController, - physics: NeverScrollableScrollPhysics(), - children: _formsRepot, - ), - index <= displayContinue - ? index == 1 && _atLeastOnePhotoAttached ? - Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric(vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'continue_txt'), () { - goNextPage(); - } - ) - ) : Container() - : index != _formsRepot.length.toDouble() - 1 - ? SafeArea( - child: Align( - alignment: Alignment.bottomCenter, - child: StreamBuilder( - stream: validStream.stream, - initialData: false, - builder: (BuildContext ctxt, AsyncSnapshot snapshot) { - return snapshot.data! - ? Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, - horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'continue_txt'), () { - var currentPage =_pagesController!.page; - - if (currentPage == 0.0) { - goNextPage(); - } else if (currentPage == 4.0) { - if (otherReport == 'adult' || otherReport == 'bite') { - navigateOtherReport(); - } - } else { - goNextPage(); - } - } - ), - ) - : Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of( - context, 'continue_txt'), - null), - ); - }), - )) - : SafeArea( - child: Container( - width: double.infinity, - height: 54, - margin: EdgeInsets.symmetric( - vertical: 6, horizontal: 12), - child: Style.button( - MyLocalizations.of(context, 'send_data'), - () { - _createReport(); - }, - ), - ), - ), - ], - ), - ), - StreamBuilder( - stream: loadingStream.stream, - initialData: false, - builder: (BuildContext ctxt, AsyncSnapshot snapshot) { - if (snapshot.hasData == false || snapshot.data == false) { - return Container(); - } - return Utils.loading( - snapshot.data, - ); - }, - ) - ], - ), - ); - } - - void _showAlertOk() { - loadingStream.add(false); - Utils.showAlert( - MyLocalizations.of(context, 'app_name'), - widget.editReport == null - ? MyLocalizations.of(context, 'save_report_ok_txt') - : MyLocalizations.of(context, 'edited_report_ok_txt'), - context, - onPressed: () { - Navigator.pop(context); - Utils.resetReport(); - if (widget.editReport != null) { - Navigator.pop(context); - } else { - Navigator.of(context).popUntil((r) => r.isFirst); - } - - Utils.requestInAppReview(); - }, - barrierDismissible: false, - ); - } - - void _showAlertKo() { - loadingStream.add(false); - Utils.showAlert( - MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'save_report_ko_txt'), - context, - onPressed: () { - Navigator.pop(context); - Utils.resetReport(); - if (widget.editReport != null) { - Navigator.pop(context); - } else { - Navigator.of(context).popUntil((r) => r.isFirst); - } - }, - barrierDismissible: false, - ); - } - - void _onWillPop() { - if (Utils.report!.responses!.isNotEmpty) { - Utils.showAlertYesNo(MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'close_report_no_save_txt'), () { - if (Utils.reportsList != null && Utils.reportsList!.isNotEmpty) { - Utils.deleteLastReport(); - } else { - Utils.resetReport(); - Utils.imagePath = null; - } - Navigator.pop(context); - }, context); - } else { - Navigator.pop(context); - } - } -} diff --git a/lib/pages/forms_pages/components/add_other_report_form.dart b/lib/pages/forms_pages/components/add_other_report_form.dart deleted file mode 100644 index 45c2e099..00000000 --- a/lib/pages/forms_pages/components/add_other_report_form.dart +++ /dev/null @@ -1,77 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; -import 'package:percent_indicator/linear_percent_indicator.dart'; - -class AddOtherReportPage extends StatefulWidget { - final Function addReport; - final Function setValid; - final StreamController percent; - - AddOtherReportPage(this.addReport, this.setValid, this.percent); - - @override - _AddOtherReportPageState createState() => _AddOtherReportPageState(); -} - -class _AddOtherReportPageState extends State { - final TextEditingController _commentsController = TextEditingController(); - - @override - void initState() { - super.initState(); - if (Utils.report!.note != null && Utils.report!.note != '') { - _commentsController.text = Utils.report!.note!; - } - } - - @override - Widget build(BuildContext context) { - return SafeArea( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 35, - ), - Container( - width: double.infinity, - child: StreamBuilder( - stream: widget.percent.stream, - initialData: 0.0, - builder: (context, AsyncSnapshot snapshot) { - return LinearPercentIndicator( - lineHeight: 15.0, - percent: snapshot.data!, - animateFromLastPercent: true, - animation: true, - backgroundColor: Colors.grey.withOpacity(0.3), - progressColor: Style.colorPrimary, - ); - }, - ), - ), - SizedBox( - height: 20, - ), - Style.title(MyLocalizations.of(context, 'add_comments_question')), - SizedBox( - height: 12, - ), - Style.textField(MyLocalizations.of(context, 'comments_txt'), - _commentsController, context, - keyboardType: TextInputType.multiline, maxLines: 4, expands: false, handleChange: (text) { - Utils.report!.note = text; - }), - Style.bottomOffset, - ], - ), - ), - ); - } -} diff --git a/lib/pages/forms_pages/components/add_photo_button_widget.dart b/lib/pages/forms_pages/components/add_photo_button_widget.dart deleted file mode 100644 index 86cc6e69..00000000 --- a/lib/pages/forms_pages/components/add_photo_button_widget.dart +++ /dev/null @@ -1,209 +0,0 @@ -import 'dart:io'; -import 'dart:math'; - -import 'package:flutter/material.dart'; -import 'package:http/http.dart' as http; -import 'package:mosquito_alert_app/pages/forms_pages/components/whatsapp_camera.dart/camera_whatsapp.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; -import 'package:path_provider/path_provider.dart'; -import 'package:permission_handler/permission_handler.dart'; - -class AddPhotoButton extends StatefulWidget { - final bool isEditing; - final bool photoRequired; - final Function _atLeastOnePhotoAttached; - final String? subtitleKey; - final String? infoBadgeTextKey; - - AddPhotoButton(this.isEditing, this.photoRequired, this._atLeastOnePhotoAttached, this.subtitleKey, this.infoBadgeTextKey); - - @override - _AddPhotoButtonState createState() => _AddPhotoButtonState(); -} - -class _AddPhotoButtonState extends State { - List images = []; - - @override - void initState() { - _permissionsPath(); - super.initState(); - initializePhotos(); - } - - Future initializePhotos() async { - await _initImages(); - if (images.isEmpty){ - await getImageWhatsapp(); - } - } - - Future _permissionsPath() async { - var status = await Permission.storage.status; - if (!status.isGranted) { - await Permission.storage.request(); - } - } - - Future _initImages() async { - if (Utils.imagePath != null && Utils.imagePath!.isNotEmpty) { - Utils.imagePath!.forEach((element) async { - if (element['id'] == Utils.report!.version_UUID) { - if (element['image'].contains('http')) { - var file = await urlToFile(element['image']); - images.add(file.path); - element['image'] = file.path; - } else { - images.add(element['image']); - } - } - setState(() {}); - }); - } - } - - Future urlToFile(String imageUrl) async { - // generate random number. - var rng = Random(); - // get temporary directory of device. - var tempDir = await getTemporaryDirectory(); - // get temporary path from temporary directory. - var tempPath = tempDir.path; - // create a new file in temporary path with random file name. - var file = File('$tempPath' + (rng.nextInt(100)).toString() + '.png'); - // call http.get method and pass imageUrl into it to get response. - var response = await http.get(Uri.parse(imageUrl)); - // write bodyBytes received in response to file. - await file.writeAsBytes(response.bodyBytes); - // now return the file which is created with random name in - // temporary directory and image bytes from response is written to // that file. - return file; - } - - @override - Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.all(15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Style.title(MyLocalizations.of(context, 'bs_info_adult_title')), - Visibility( - visible: widget.subtitleKey != null, - child: Style.body(MyLocalizations.of(context, widget.subtitleKey)) - ), - SizedBox(height: 15), - GridView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - crossAxisSpacing: 10, - mainAxisSpacing: 10, - ), - itemCount: min(3, images.length + 1), - itemBuilder: (context, index) { - return index == (images.length) - ? GestureDetector( - onTap: () { - getImageWhatsapp(); - }, - child: Container( - decoration: BoxDecoration( - border: Border.all(color: Colors.black, width: 1), - borderRadius: BorderRadius.circular(15)), - child: Icon( - Icons.add, - size: 30, - ), - ), - ) - : Stack( - alignment: Alignment.topLeft, - children: [ - Container( - height: double.infinity, - width: double.infinity, - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: Image.file( - File(images[index]!), - fit: BoxFit.cover, - height: 100, - width: 100, - ), - ), - ), - Container( - height: double.infinity, - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: LinearGradient( - colors: [ - Colors.black54, - Colors.transparent, - ], - begin: Alignment.topLeft, - end: Alignment.center, - ), - ), - child: Align( - alignment: Alignment.topLeft, - child: IconButton( - onPressed: () { - _deleteImage(images[index], index); - }, - icon: Icon( - Icons.close, - color: Colors.white, - ), - ), - ), - ), - ], - ); - }, - ), - ], - ), - ); - } - - void _deleteImage(String? img, int index) { - if (widget.photoRequired && images.length == 1) { - Utils.showAlert(MyLocalizations.of(context, 'app_name'), - MyLocalizations.of(context, 'photo_required_alert'), context); - } else { - Utils.deleteImage(img); - setState(() { - images.removeAt(index); - }); - } - } - - Future getImageWhatsapp() async{ - var files = await Navigator.push( - context, - MaterialPageRoute( - builder: (context) => WhatsappCamera( - multiple: false, - infoBadgeTextKey: widget.infoBadgeTextKey, - ) - ), - ); - - if(files == null){ - return; - } - - var file = files[0]; - Utils.saveImgPath(file); - setState(() { - images.add(file.path); - }); - widget._atLeastOnePhotoAttached(); - } -} diff --git a/lib/pages/forms_pages/components/biting_form.dart b/lib/pages/forms_pages/components/biting_form.dart deleted file mode 100644 index 1c888cbf..00000000 --- a/lib/pages/forms_pages/components/biting_form.dart +++ /dev/null @@ -1,587 +0,0 @@ -import 'dart:math'; - -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/models/question.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/small_question_option_widget.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class BitingForm extends StatefulWidget { - final List displayQuestions; - final Function setValid, nextPage; - - BitingForm(this.displayQuestions, this.setValid, this.nextPage); - @override - _BitingFormState createState() => _BitingFormState(); -} - -class _BitingFormState extends State { - List? questions; - List displayQuestions = []; - Map bodyQuestion = {}; - int bites = 0; - - bool showDaytime = false; - bool valid = false; - - final TextEditingController _textController = TextEditingController(); - - @override - void initState() { - super.initState(); - questions = []; - - if (Utils.report != null) { - for (var q in Utils.report!.responses!) { - if (q!.question_id == 1) { - bites = int.parse(q.answer_value!); - } - if (q.question_id! <= 4 || q.question_id == 5) { - questions!.add(q); - } - if (q.answer_id == 52) { - showDaytime = true; - } - } - } - var isValid = canContinue(); - setState(() { - valid = isValid; - }); - _textController.text = bites.toString(); - displayQuestions = - widget.displayQuestions.where((q) => q['question']['id'] > 2).toList(); - bodyQuestion = widget.displayQuestions - .where((q) => q['question']['id'] == 2) - .toList()[0]; - } - - @override - Widget build(BuildContext context) { - final mediaQuery = MediaQuery.of(context).size; - return SafeArea( - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 24, - ), - Style.titleMedium( - MyLocalizations.of(context, 'bytes_and_place_report_txt'), - fontSize: 16), - SizedBox( - height: 12, - ), - Row( - children: [ - Style.button( - '-', - () { - bites = max(bites - 1, 0); - _textController.text = bites.toString(); - var question = widget.displayQuestions - .where((q) => q['question']['id'] == 1) - .toList(); - - removeBite(); - - setState(() { - questions = Utils.report!.responses; - }); - addToList(question[0]['question']['text'], '', - question_id: 1, - answer_id: 11, - answer_value: _textController.text); - - var isValid = canContinue(); - Utils.resetBitingQuestion(); - setState(() { - valid = isValid; - questions = Utils.report!.responses; - }); - }, - ), - SizedBox( - width: 12, - ), - Expanded( - flex: 1, - child: Style.textField( - 'a', - _textController, - context, - enabled: false, - )), - SizedBox( - width: 12, - ), - Style.button( - '+', - () { - bites = min(bites = bites + 1, 20); - _textController.text = bites.toString(); - var question = widget.displayQuestions - .where((q) => q['question']['id'] == 1) - .toList(); - addToList(question[0]['question']['text'], '', - question_id: 1, - answer_id: 11, - answer_value: _textController.text); - var isValid = canContinue(); - setState(() { - valid = isValid; - }); - }, - ), - ], - ), - Container( - alignment: Alignment.topLeft, - child: Stack( - children: [ - Stack( - children: [ - Image.asset( - 'assets/img/ic_full_body_off.png', - width: mediaQuery.width, - ), - Image.asset( - questions! - .any((question) => question!.answer_id == 25) - ? 'assets/img/ic_left_leg_on.png' - : 'assets/img/ic_left_leg_off.png', - width: mediaQuery.width, - ), - Image.asset( - questions! - .any((question) => question!.answer_id == 26) - ? 'assets/img/ic_right_leg_on.png' - : 'assets/img/ic_right_leg_off.png', - width: mediaQuery.width, - ), - Image.asset( - questions! - .any((question) => question!.answer_id == 22) - ? 'assets/img/ic_left_hand_on.png' - : 'assets/img/ic_left_hand_off.png', - width: mediaQuery.width, - ), - Image.asset( - questions! - .any((question) => question!.answer_id == 23) - ? 'assets/img/ic_right_hand_on.png' - : 'assets/img/ic_right_hand_off.png', - width: mediaQuery.width, - ), - Image.asset( - questions! - .any((question) => question!.answer_id == 21) - ? 'assets/img/ic_head_on.png' - : 'assets/img/ic_head_off.png', - width: mediaQuery.width, - ), - Image.asset( - questions! - .any((question) => question!.answer_id == 24) - ? 'assets/img/ic_chest_on.png' - : 'assets/img/ic_chest_off.png', - width: mediaQuery.width, - ), - Positioned( - top: mediaQuery.height * 0.05, - left: mediaQuery.width * 0.37, - child: questions! - .any((question) => question!.answer_id == 21) - ? Style.body(getIndexBody(21)) - : Container(), - ), - Positioned( - top: mediaQuery.height * 0.18, - left: mediaQuery.width * 0.21, - child: questions! - .any((question) => question!.answer_id == 23) - ? Style.body(getIndexBody(23)) - : Container(), - ), - Positioned( - top: mediaQuery.height * 0.18, - left: mediaQuery.width * 0.70, - child: questions! - .any((question) => question!.answer_id == 22) - ? Style.body(getIndexBody(22)) - : Container(), - ), - Positioned( - top: mediaQuery.height * 0.23, - left: mediaQuery.width * 0.56, - child: questions! - .any((question) => question!.answer_id == 24) - ? Style.body(getIndexBody(24)) - : Container(), - ), - Positioned( - top: mediaQuery.height * 0.37, - left: mediaQuery.width * 0.28, - child: questions! - .any((question) => question!.answer_id == 26) - ? Style.body(getIndexBody(26)) - : Container(), - ), - Positioned( - top: mediaQuery.height * 0.37, - left: mediaQuery.width * 0.63, - child: questions! - .any((question) => question!.answer_id == 25) - ? Style.body(getIndexBody(25)) - : Container(), - ), - ], - ), - Column( - children: [ - //HEAD - GestureDetector( - onTap: _validateAddBite() - ? () { - addToList(bodyQuestion['question']['text'], - bodyQuestion['answers'][0]['text'], - question_id: 2, answer_id: 21); - } - : null, - child: Center( - child: Container( - margin: EdgeInsets.only(top: 40), - color: Colors.transparent, - height: mediaQuery.height * 0.08, - width: mediaQuery.width * 0.15, - ), - ), - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //ARM - GestureDetector( - onTap: _validateAddBite() - ? () { - addToList( - bodyQuestion['question']['text'], - bodyQuestion['answers'][2]['text'], - question_id: 2, - answer_id: 23); - } - : null, - child: Container( - color: Colors.blue.withOpacity(0.0), - height: mediaQuery.height * 0.1, - width: mediaQuery.width * 0.18, - ), - ), - //CHEST - GestureDetector( - onTap: _validateAddBite() - ? () { - addToList( - bodyQuestion['question']['text'], - bodyQuestion['answers'][3]['text'], - question_id: 2, - answer_id: 24); - } - : null, - child: Container( - color: Colors.transparent, - height: mediaQuery.height * 0.13, - width: mediaQuery.width * 0.15, - ), - ), - //ARM - GestureDetector( - onTap: _validateAddBite() - ? () { - addToList( - bodyQuestion['question']['text'], - bodyQuestion['answers'][1]['text'], - question_id: 2, - answer_id: 22); - } - : null, - child: Container( - color: Colors.transparent, - height: mediaQuery.height * 0.1, - width: mediaQuery.width * 0.18, - ), - ), - ], - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - //LEG - GestureDetector( - onTap: _validateAddBite() - ? () { - addToList( - bodyQuestion['question']['text'], - bodyQuestion['answers'][5]['text'], - question_id: 2, - answer_id: 26); - } - : null, - child: Container( - color: Colors.transparent, - height: mediaQuery.height * 0.15, - width: mediaQuery.width * 0.18, - ), - ), - //LEG - GestureDetector( - onTap: _validateAddBite() - ? () { - addToList( - bodyQuestion['question']['text'], - bodyQuestion['answers'][4]['text'], - question_id: 2, - answer_id: 25); - } - : null, - child: Container( - color: Colors.transparent, - height: mediaQuery.height * 0.15, - width: mediaQuery.width * 0.18, - ), - ), - ], - ), - ], - ), - ], - ), - ), - Center( - child: Style.body( - MyLocalizations.of(context, 'tap_image_biting_txt'), - color: Colors.grey, - textAlign: TextAlign.center, - fontSize: 12, - ), - ), - SizedBox( - height: 12, - ), - Center( - child: Style.button(MyLocalizations.of(context, 'reset'), () { - Utils.resetBitingQuestion(); - - var isValid = canContinue(); - Utils.resetBitingQuestion(); - setState(() { - valid = isValid; - questions = Utils.report!.responses; - }); - }), - ), - SizedBox( - height: 24, - ), - ListView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: showDaytime - ? displayQuestions.length - : displayQuestions.length - 1, - itemBuilder: (context, i) { - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 20, - ), - Style.titleMedium( - MyLocalizations.of( - context, displayQuestions[i]['question']['text']), - fontSize: 16), - SizedBox( - height: 10, - ), - Container( - child: GridView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: displayQuestions[i]['answers'].length, - gridDelegate: - SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: 5 / 2, - ), - itemBuilder: (context, index) { - String? answerTxt = - displayQuestions[i]['answers'][index]['text']; - String? questionTxt = - displayQuestions[i]['question']['text']; - int? questionId = - displayQuestions[i]['question']['id']; - int? answerId = - displayQuestions[i]['answers'][index]['id']; - return Container( - padding: EdgeInsets.all(5), - child: InkWell( - onTap: () { - if (answerId == 52) { - setState(() { - showDaytime = true; - }); - } else if (answerId == 51) { - setState(() { - showDaytime = false; - }); - } - addToList(questionTxt, answerTxt, - question_id: questionId, - answer_id: answerId); - }, - child: SmallQuestionOption( - answerTxt, - selected: questions! - .any((q) => q!.answer_id == answerId), - ), - ), - ); - }), - ), - ], - ); - }, - ), - SizedBox( - height: 20, - ), - Container( - width: double.infinity, - height: 54, - child: Style.button( - MyLocalizations.of(context, 'continue_txt'), - valid - ? () { - widget.nextPage(); - } - : null), - ), - SizedBox( - height: 10, - ), - ], - ), - ), - ), - ); - } - - String? getIndexBody(int answer_id) { - var index = Utils.report!.responses! - .indexWhere((question) => question!.answer_id == answer_id); - - if (index != -1) { - return Utils.report!.responses![index]!.answer_value; - } - return null; - } - - String? getIndexAnswer(int answer_id) { - var index = 0; - - questions!.map((q) { - if (q!.answer_id == answer_id) { - index = index + 1; - } - }).toList(); - - if (index > 0) { - return index.toString(); - } - return null; - } - - addToList(String? question, String? answer, - {question_id, answer_id, answer_value}) { - if ((question_id != 1 && int.parse(_textController.text) > 0) || - question_id == 1) { - Utils.addBiteResponse( - question, - answer, - question_id: question_id, - answer_id: answer_id, - answer_value: answer_value, - ); - - setState(() { - questions = Utils.report!.responses; - }); - var isValid = canContinue(); - setState(() { - valid = isValid; - }); - } - } - - bool _validateAddBite() { - var totalParts = 0; - questions!.forEach((q) { - if (q!.question_id == 2) { - totalParts = totalParts + int.parse(q.answer_value!); - } - }); - return totalParts < bites; - } - - bool canContinue() { - if (questions!.length > 1 && questions!.isNotEmpty) { - var totalBites = _validateAddBite(); - var totalQ3 = 0; - var totalQ4 = 0; - var totalQ5 = 0; - - questions!.forEach((q) { - if (q!.question_id == 4) totalQ3++; - if (q.question_id == 5) totalQ4++; - if (q.question_id == 3) totalQ5++; - }); - - if (questions!.any((q) => q!.answer_id == 52)) { - if (bites > 0 && - !totalBites && - totalQ3 == 1 && - totalQ4 == 1 && - totalQ5 == 1) { - return true; - } - } else { - if (bites > 0 && !totalBites && totalQ3 == 1 && totalQ4 == 1) { - return true; - } - } - return false; - } - return false; - } - - void removeBite() { - var bodyParts = Utils.report!.responses! - .where((element) => element!.question_id == 2) - .toList(); - if (int.parse(bodyParts.last!.answer_value!) > 1) { - bodyParts.last!.answer_value = - (int.parse(bodyParts.last!.answer_value!) - 1).toString(); - } else { - bodyParts.removeLast(); - } - - Utils.report!.responses = { - ...?Utils.report!.responses, - ...bodyParts - }.cast().toList(); - } -} diff --git a/lib/pages/forms_pages/components/biting_location_form.dart b/lib/pages/forms_pages/components/biting_location_form.dart deleted file mode 100644 index 3346d12a..00000000 --- a/lib/pages/forms_pages/components/biting_location_form.dart +++ /dev/null @@ -1,340 +0,0 @@ -import 'dart:async'; - -import 'package:flutter/material.dart'; -import 'package:geolocator/geolocator.dart'; -import 'package:google_maps_flutter/google_maps_flutter.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/small_question_option_widget.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; -import 'package:flutter/foundation.dart'; -import 'package:flutter/gestures.dart'; - -class BitingLocationForm extends StatefulWidget { - final Function setValid; - final String? displayQuestion; - - BitingLocationForm(this.setValid, this.displayQuestion); - - @override - _BitingLocationFormState createState() => _BitingLocationFormState(); -} - -enum LocationType { current, selected, missing } - -class _BitingLocationFormState extends State { - late GoogleMapController controller; - List markers = []; - - LatLng? currentLocation; - - Set? circles; - - StreamController streamType = - StreamController.broadcast(); - - @override - void initState() { - super.initState(); - - if (Utils.report != null) { - switch (Utils.report!.location_choice) { - case 'selected': - streamType.add(LocationType.selected); - markers.add(Marker( - markerId: MarkerId('mk_${markers.length}'), - position: LatLng(Utils.report!.selected_location_lat!, - Utils.report!.selected_location_lon!))); - currentLocation = LatLng(Utils.report!.selected_location_lat!, Utils.report!.selected_location_lon!); - widget.setValid(true); - break; - case 'current': - streamType.add(LocationType.current); - markers.add(Marker( - markerId: MarkerId('mk_${markers.length}'), - position: LatLng(Utils.report!.current_location_lat!, - Utils.report!.current_location_lon!))); - currentLocation = LatLng(Utils.report!.current_location_lat!, Utils.report!.current_location_lon!); - widget.setValid(true); - break; - default: - streamType.add(LocationType.missing); - } - } else { - _getCurrentLocation(); - } - } - - void _getCurrentLocation() async { - updateType(LocationType.current, context: context); - } - - void _onMapCreated(GoogleMapController controller) { - this.controller = controller; - currentLocation == null ? _getCurrentLocation() : null; - } - - void updateMarker(LatLng markerPosition) { - var mk = Marker( - markerId: MarkerId('mk${markers.length}'), position: markerPosition); - Utils.setSelectedLocation(mk.position.latitude, mk.position.longitude); - widget.setValid(true); - - setState(() { - markers = [mk]; - }); - } - - void updateType(type, {context}) async { - streamType.add(type); - - var currentMarkers = []; - switch (type) { - case LocationType.current: - var geolocationEnabled = await Geolocator.isLocationServiceEnabled(); - streamType.add(type); - - if (geolocationEnabled) { - var currentPosition = await Geolocator.getCurrentPosition( - desiredAccuracy: LocationAccuracy.high); - Utils.setCurrentLocation( - currentPosition.latitude, currentPosition.longitude); - await controller.moveCamera( - CameraUpdate.newCameraPosition( - CameraPosition( - target: LatLng( - currentPosition.latitude, currentPosition.longitude), - zoom: 15.0), - ), - ); - currentMarkers = [ - Marker( - markerId: MarkerId('mk${markers.length}'), - position: - LatLng(currentPosition.latitude, currentPosition.longitude)) - ]; - widget.setValid(true); - } else { - await Utils.showAlert( - MyLocalizations.of(context, 'location_not_active_title'), - MyLocalizations.of(context, 'location_not_active_txt'), - context, onPressed: () { - Navigator.pop(context); - }); - streamType.add(LocationType.selected); - } - - break; - case LocationType.selected: - currentMarkers = []; - // get saved marker - if (Utils.report!.selected_location_lat != null && - Utils.report!.selected_location_lon != null) { - await controller.moveCamera( - CameraUpdate.newCameraPosition( - CameraPosition( - target: LatLng(Utils.report!.selected_location_lat!, - Utils.report!.selected_location_lon!), - zoom: 15.0), - ), - ); - Utils.setSelectedLocation(Utils.report!.selected_location_lat, - Utils.report!.selected_location_lon); - currentMarkers.add(Marker( - markerId: MarkerId('selected'), - position: LatLng(Utils.report!.selected_location_lat!, - Utils.report!.selected_location_lon!), - )); - widget.setValid(true); - } - //get markers in responses - try { - if (Utils.report!.responses!.any((r) => r!.question_id == 5)) { - var i = 0; - Utils.report!.responses!.forEach((q) { - i++; - if (q!.question_id == 5) { - print(q.answer_value); - - var res = q.answer_value! - .substring(q.answer_value!.indexOf('( ') + 2, - q.answer_value!.indexOf(')')) - .split(', '); - currentMarkers.add(Marker( - markerId: MarkerId('mk_$i'), - position: - LatLng(double.parse(res[0]), double.parse(res[1])))); - } - }); - } - } catch (e) { - print(e); - } - - break; - default: - streamType.add(LocationType.missing); - break; - } - setState(() { - markers = currentMarkers; - }); - } - - @override - void dispose() { - super.dispose(); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 35, - ), - Style.title( - MyLocalizations.of(context, widget.displayQuestion)), - Style.body(MyLocalizations.of(context, 'chose_option_txt')), - Container( - margin: EdgeInsets.symmetric(vertical: 30), - child: StreamBuilder( - stream: streamType.stream, - initialData: Utils.report!.location_choice != null - ? Utils.report!.location_choice == 'selected' - ? LocationType.selected - : LocationType.current - : LocationType.current, - builder: (BuildContext context, - AsyncSnapshot snapshot) { - return Column( - children: [ - Container( - height: MediaQuery.of(context).size.height * 0.08, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: GestureDetector( - onTap: () { - updateType(LocationType.current, - context: context); - }, - child: SmallQuestionOption( - 'current_location_txt', - selected: snapshot.data == - LocationType.current, - ))), - SizedBox( - width: 10, - ), - Expanded( - child: GestureDetector( - onTap: () { - widget.setValid(false); - updateType(LocationType.selected); - }, - child: SmallQuestionOption( - 'select_location_txt', - selected: - snapshot.data == LocationType.selected, - ), - )), - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - margin: EdgeInsets.symmetric(vertical: 5), - height: MediaQuery.of(context).size.height * 0.4, - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: GoogleMap( - onMapCreated: _onMapCreated, - rotateGesturesEnabled: false, - myLocationButtonEnabled: false, - zoomControlsEnabled: false, - minMaxZoomPreference: - MinMaxZoomPreference(5, 18), - mapToolbarEnabled: false, - onTap: (LatLng pos) { - if (snapshot.data == - LocationType.selected) { - updateMarker(pos); - } - }, - initialCameraPosition: CameraPosition( - target: currentLocation != null - ? LatLng(currentLocation!.latitude, - currentLocation!.longitude) - : Utils.location != null - ? LatLng(Utils.location!.latitude, - Utils.location!.longitude) - : LatLng( - Utils.defaultLocation.latitude, - Utils - .defaultLocation.longitude), - zoom: 7.0, - ), - markers: markers.isNotEmpty - ? Set.from(markers.cast< - Marker>()) // Cast elements to Marker - : {}, - gestureRecognizers: >{ - Factory( - () => EagerGestureRecognizer(), - ), - }, - )), - ), - SizedBox( - height: 10, - ), - Style.button( - MyLocalizations.of(context, 'reset'), - () { - resetLocations(); - }, - ) - ], - ); - }, - ), - ), - Style.bottomOffset, - ], - ), - ), - ), - ), - ); - } - - void resetLocations() { - Utils.report!.selected_location_lat = null; - Utils.report!.selected_location_lon = null; - Utils.report!.current_location_lat = null; - Utils.report!.current_location_lon = null; - - if (Utils.report!.type == 'bite') { - Utils.report!.responses! - .removeWhere((question) => question!.question_id == 5); - } - print(Utils.report!.responses); - - widget.setValid(false); - - setState(() { - markers = []; - }); - } -} diff --git a/lib/pages/forms_pages/components/could_see_form.dart b/lib/pages/forms_pages/components/could_see_form.dart deleted file mode 100644 index 9b92125a..00000000 --- a/lib/pages/forms_pages/components/could_see_form.dart +++ /dev/null @@ -1,79 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/small_question_option_widget.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class CouldSeeForm extends StatefulWidget { - final Function addReport; - final Map displayQuestion; - final Function setValid; - final Function? addOtherReport; - final Function nextPage; - - CouldSeeForm(this.addReport, this.displayQuestion, this.setValid, this.nextPage, - {this.addOtherReport}); - @override - _CouldSeeFormState createState() => _CouldSeeFormState(); -} - -class _CouldSeeFormState extends State { - String? selected; - - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - return SafeArea( - child: Container( - margin: EdgeInsets.symmetric(horizontal: 15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 35, - ), - Style.title(MyLocalizations.of(context, widget.displayQuestion['question']['text'])), - SizedBox( - height: 30, - ), - GridView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: widget.displayQuestion['answers'].length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: 5 / 2, - ), - itemBuilder: (context, index) { - String? text = - widget.displayQuestion['answers'][index]['text']; - int? id = widget.displayQuestion['answers'][index]['id']; - return Container( - padding: EdgeInsets.all(5), - child: GestureDetector( - onTap: () { - setState(() { - selected = text; - }); - id == 82 - ? widget.addReport(true) - : widget.addReport(false); - widget.nextPage(); - }, - child: SmallQuestionOption( - text, - selected: selected == text, - )), - ); - }, - ), - Style.bottomOffset, - ], - ), - ), - ); - } -} diff --git a/lib/pages/forms_pages/components/image_button_widget.dart b/lib/pages/forms_pages/components/image_button_widget.dart deleted file mode 100644 index a6defac4..00000000 --- a/lib/pages/forms_pages/components/image_button_widget.dart +++ /dev/null @@ -1,52 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class CustomImageButton extends StatelessWidget { - final String? img, title; - final bool? selected, disabled; - CustomImageButton({this.img, this.title, this.selected, this.disabled}); - - @override - Widget build(BuildContext context) { - final size = MediaQuery.of(context).size.height; - return Opacity( - opacity: disabled == true ? 0.5 : 1, - child: Container( - height: size * 0.1, - child: Card( - color: selected == true ? Style.colorPrimary : Colors.white, - shape: - RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), - elevation: disabled == true ? 0 : 3, - child: Padding( - padding: const EdgeInsets.all(5.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - img != null - ? Expanded( - flex: 3, - child: Image.asset( - img!, - ), - ) - : SizedBox( - height: 140, - ), - Expanded( - flex: MediaQuery.of(context).textScaleFactor < 1.23 ? 1 : 2, - child: Container( - margin: EdgeInsets.symmetric(horizontal: 5), - child: Style.titleMedium(title, - textAlign: TextAlign.center, fontSize: 16 - ), - ), - ), - ], - ), - ), - ), - ), - ); - } -} diff --git a/lib/pages/forms_pages/components/image_question_option_widget.dart b/lib/pages/forms_pages/components/image_question_option_widget.dart deleted file mode 100644 index 74e3fb37..00000000 --- a/lib/pages/forms_pages/components/image_question_option_widget.dart +++ /dev/null @@ -1,67 +0,0 @@ -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class ImageQuestionOption extends StatelessWidget { - final bool selected, disabled; - final String title; - final String? img; - - ImageQuestionOption(this.selected, this.title, this.img, - {this.disabled = false}); - - @override - Widget build(BuildContext context) { - return Opacity( - opacity: disabled ? 0.5 : 1, - child: Card( - color: selected ? Style.colorPrimary : Colors.white, - margin: EdgeInsets.symmetric(vertical: 5), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), - elevation: 2, - child: Stack( - children: [ - Container( - height: double.infinity, - width: double.infinity, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - image: DecorationImage( - image: AssetImage(img ?? ''), - fit: BoxFit.cover, - ), - ), - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15), - gradient: LinearGradient( - colors: [Colors.transparent, Colors.black87], - begin: Alignment.center, - end: Alignment.bottomCenter, - ), - ), - ), - Container( - width: double.infinity, - margin: EdgeInsets.symmetric(horizontal: 3), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AutoSizeText(title, - style: TextStyle( - color: Colors.white, - fontSize: 20, - fontWeight: FontWeight.w500), - textAlign: TextAlign.center), - SizedBox(height: 10), - ], - ), - ), - ], - ), - ), - ); - } -} diff --git a/lib/pages/forms_pages/components/question_option_widget.dart b/lib/pages/forms_pages/components/question_option_widget.dart deleted file mode 100644 index 9a50cfb3..00000000 --- a/lib/pages/forms_pages/components/question_option_widget.dart +++ /dev/null @@ -1,45 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class QuestionOption extends StatelessWidget { - final bool selected, disabled; - final String text; - final String img; - - QuestionOption(this.selected, this.text, this.img, {this.disabled = false}); - @override - Widget build(BuildContext context) { - return Opacity( - opacity: disabled ? 0.5 : 1, - child: Card( - color: selected ? Style.colorPrimary : Colors.white, - margin: EdgeInsets.symmetric(vertical: 5), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), - elevation: 2, - child: Container( - padding: EdgeInsets.all(5), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Container( - margin: EdgeInsets.only(left: 10), - child: Image.asset( - img, - height: 40, - width: 40, - ), - ), - Center( - child: Style.body( - text, - color: selected ? Colors.white : Style.textColor, - ), - ), - SizedBox(width: 40), - ], - ), - ), - ), - ); - } -} diff --git a/lib/pages/forms_pages/components/questions_breeding_form.dart b/lib/pages/forms_pages/components/questions_breeding_form.dart deleted file mode 100644 index ee55e4ab..00000000 --- a/lib/pages/forms_pages/components/questions_breeding_form.dart +++ /dev/null @@ -1,145 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/models/question.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/image_button_widget.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/small_question_option_widget.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class QuestionsBreedingForm extends StatefulWidget { - final Map displayQuestion; - final Function setValid; - final bool hasImage; - final Function? nextPage, skipPage3; - final String bottomImage; - - QuestionsBreedingForm(this.displayQuestion, this.setValid, this.hasImage, - this.nextPage, this.bottomImage, - {this.skipPage3}); - - @override - _QuestionsBreedingFormState createState() => _QuestionsBreedingFormState(); -} - -class _QuestionsBreedingFormState extends State { - Question? question; - - @override - void initState() { - super.initState(); - question = Question( - question: widget.displayQuestion['question']['text'], - question_id: widget.displayQuestion['question']['id'], - ); - if (Utils.report != null) { - var index = Utils.report!.responses!.indexWhere( - (q) => q!.question_id == widget.displayQuestion['question']['id']); - if (index != -1) { - question!.answer = Utils.report!.responses![index]!.answer; - question!.answer_id = Utils.report!.responses![index]!.answer_id; - widget.setValid(true); - } - } - } - - @override - Widget build(BuildContext context) { - return SafeArea( - child: Stack( - children: [ - widget.bottomImage.isNotEmpty - ? Container( - alignment: Alignment.bottomCenter, - child: Image.asset( - widget.bottomImage, - width: double.infinity, - fit: BoxFit.fitWidth, - alignment: Alignment.bottomCenter, - ), - ) - : Container(), - Container( - margin: EdgeInsets.symmetric(horizontal: 15), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 35, - ), - Style.title(MyLocalizations.of( - context, widget.displayQuestion['question']['text'])), - SizedBox( - height: 30, - ), - GridView.builder( - physics: NeverScrollableScrollPhysics(), - shrinkWrap: true, - itemCount: widget.displayQuestion['answers'].length, - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 2, - childAspectRatio: widget.hasImage ? 1 : 5 / 2, - crossAxisSpacing: widget.hasImage ? 10 : 0, - ), - itemBuilder: (context, index) { - String? text = - widget.displayQuestion['answers'][index]['text']; - int? id = widget.displayQuestion['answers'][index]['id']; - if (widget.hasImage) { - return Container( - child: GestureDetector( - onTap: () { - addQuestion(text, id); - widget.setValid(true); - widget.nextPage!(); - }, - child: CustomImageButton( - selected: question!.answer_id == id ? true : false, - title: MyLocalizations.of(context, text), - img: widget.displayQuestion['answers'][index] - ['img'], - ), - ), - ); - } - return Container( - padding: EdgeInsets.all(5), - child: GestureDetector( - onTap: () { - addQuestion(text, id); - widget.setValid(true); - if (question!.question_id == 10) { - if (id == 81) { - Utils.deleteResonse(17); - widget.skipPage3!(true); - } else { - widget.skipPage3!(false); - } - } - if (widget.nextPage != null) { - widget.nextPage!(); - } - }, - child: SmallQuestionOption( - text, - selected: question!.answer_id == id, - )), - ); - }, - ), - ], - ), - ), - ], - ), - ); - } - - void addQuestion(answer, answerId) { - setState(() { - question!.answer = answer; - question!.answer_id = answerId; - }); - - Utils.addResponse(question); - } -} diff --git a/lib/pages/forms_pages/components/small_question_option_widget.dart b/lib/pages/forms_pages/components/small_question_option_widget.dart deleted file mode 100644 index 37d12676..00000000 --- a/lib/pages/forms_pages/components/small_question_option_widget.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; - -class SmallQuestionOption extends StatelessWidget { - final bool? selected, disabled; - final String? text; - SmallQuestionOption( - this.text, { - this.selected, - this.disabled, - }); - - @override - Widget build(BuildContext context) { - return selected == null || !selected! - ? Opacity( - opacity: disabled == null || !disabled! ? 1.0 : 0.5, - child: Container( - alignment: Alignment.center, - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(15), - boxShadow: [ - BoxShadow( - color: Colors.grey, - blurRadius: 2, - ) - ]), - child: Style.body(MyLocalizations.of(context, text), - maxLines: 2, textAlign: TextAlign.center), - ), - ) - : Container( - alignment: Alignment.center, - decoration: BoxDecoration( - color: Style.colorPrimary, - borderRadius: BorderRadius.circular(15), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 3, - child: Style.body(MyLocalizations.of(context, text), - color: Colors.white, - maxLines: 3, - textAlign: TextAlign.center), - ), - ], - ), - ); - } -} diff --git a/lib/pages/forms_pages/components/whatsapp_camera.dart/camera_whatsapp.dart b/lib/pages/forms_pages/components/whatsapp_camera.dart/camera_whatsapp.dart deleted file mode 100644 index bf614668..00000000 --- a/lib/pages/forms_pages/components/whatsapp_camera.dart/camera_whatsapp.dart +++ /dev/null @@ -1,544 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:camera_camera/camera_camera.dart'; -import 'package:flutter/gestures.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_sliding_up_panel/flutter_sliding_up_panel.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/components/whatsapp_camera.dart/view_image.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:photo_gallery/photo_gallery.dart'; -import 'package:file_picker/file_picker.dart'; - - -class _WhatsAppCameraController extends ChangeNotifier { - /// - /// don't necessary to use this class - /// this is the class to controller the actions - /// - _WhatsAppCameraController({this.multiple = true}); - - /// permission to select multiple images - /// - /// multiple => default is true - /// - /// - /// - final bool multiple; - final selectedImages = []; - var images = []; - - Future handlerPermissions() async { - final status = await Permission.storage.request(); - if (Platform.isIOS) { - await Permission.photos.request(); - await Permission.mediaLibrary.request(); - } - return status.isGranted; - } - - bool imageIsSelected(String? fileName) { - final index = - selectedImages.indexWhere((e) => e.path.split('/').last == fileName); - return index != -1; - } - - _timer() { - Timer.periodic(const Duration(seconds: 2), (t) async { - await Permission.camera.isGranted.then((value) { - if (value) { - getPhotosToGallery(); - t.cancel(); - } - }); - }); - } - - Future getPhotosToGallery() async { - final permission = await handlerPermissions(); - if (permission) { - final albums = await PhotoGallery.listAlbums( - mediumType: MediumType.image, - ); - final res = await Future.wait(albums.map((e) => e.listMedia())); - final index = res.indexWhere((e) => e.album.name == 'All'); - if (index != -1) images.addAll(res[index].items); - if (index == -1) { - for (var e in res) { - images.addAll(e.items); - } - } - notifyListeners(); - } - } - - Future initialize() async { - _timer(); - } - - Future openGallery() async { - final res = await FilePicker.platform.pickFiles( - allowMultiple: multiple, - type: FileType.image, - ); - if (res != null) { - for (var element in res.files) { - if (element.path != null) selectedImages.add(File(element.path!)); - } - } - } - - void captureImage(File file) { - selectedImages.add(file); - } - - Future selectImage(Medium image) async { - if (multiple) { - final index = selectedImages - .indexWhere((e) => e.path.split('/').last == image.filename); - if (index != -1) { - selectedImages.removeAt(index); - } else { - final file = await image.getFile(); - selectedImages.add(file); - } - } else { - selectedImages.clear(); - final file = await image.getFile(); - selectedImages.add(file); - } - notifyListeners(); - } -} - -class WhatsappCamera extends StatefulWidget { - /// permission to select multiple images - /// - /// multiple => default is true - /// - /// - ///how use: - ///```dart - ///List? res = await Navigator.push( - /// context, - /// MaterialPageRoute( - /// builder: (context) => const WhatsappCamera()), - ///); - /// - ///``` - /// - final bool multiple; - final String? infoBadgeTextKey; - - /// how use: - ///```dart - ///List? res = await Navigator.push( - /// context, - /// MaterialPageRoute( - /// builder: (context) => const WhatsappCamera()), - ///); - /// - ///``` - /// - const WhatsappCamera({key, this.multiple = true, this.infoBadgeTextKey = ''}); - - @override - State createState() => _WhatsappCameraState(); -} - -class _WhatsappCameraState extends State - with WidgetsBindingObserver { - late _WhatsAppCameraController controller; - final painel = SlidingUpPanelController(); - - @override - void dispose() { - controller.dispose(); - painel.dispose(); - super.dispose(); - } - - @override - void didChangeAppLifecycleState(AppLifecycleState state) { - if (state == AppLifecycleState.resumed) { - Navigator.pop(context); - } - } - - @override - void initState() { - super.initState(); - controller = _WhatsAppCameraController(multiple: widget.multiple); - painel.addListener(() { - if (painel.status.name == 'hidden') { - controller.selectedImages.clear(); - } - }); - WidgetsBinding.instance.addPostFrameCallback((_) { - controller.initialize(); - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.black, - body: Stack( - children: [ - SizedBox( - width: MediaQuery.of(context).size.width, - child: CameraCamera( - enableZoom: false, - resolutionPreset: ResolutionPreset.high, - cameraSide: CameraSide.front, - onFile: (file) { - controller.captureImage(file); - Navigator.pop(context, controller.selectedImages); - }, - ), - ), - Visibility( - visible: widget.infoBadgeTextKey != null, - child:Align( - alignment: Alignment.topCenter, - child: Padding( - padding: const EdgeInsets.only(top: 70), - child: Container( - width: 0.5 * MediaQuery.of(context).size.width, - decoration: BoxDecoration( - color: Colors.orange.shade300, - borderRadius: BorderRadius.circular(10), - ), - child: Center( - heightFactor: 1.5, - child: Text( - MyLocalizations.of(context, widget.infoBadgeTextKey), - style: TextStyle(color: Colors.white)), - ) - ), - ), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 30), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - color: Colors.white, - onPressed: (() => Navigator.pop(context)), - icon: const Icon(Icons.close), - ), - ], - ), - ), - Align( - alignment: Alignment.bottomRight, - child: Padding( - padding: const EdgeInsets.only(bottom: 32, right: 64), - child: CircleAvatar( - radius: 20, - backgroundColor: Colors.black.withOpacity(0.6), - child: IconButton( - color: Colors.white, - onPressed: () async { - await controller.openGallery().then((value) { - if (controller.selectedImages.isNotEmpty) { - Navigator.pop(context, controller.selectedImages); - } - }); - }, - icon: const Icon(Icons.image), - ), - ), - ), - ), - Positioned( - bottom: 96, - left: 0.0, - right: 0.0, - child: GestureDetector( - dragStartBehavior: DragStartBehavior.down, - onVerticalDragStart: (details) => painel.expand(), - child: SizedBox( - height: 120, - child: AnimatedBuilder( - animation: controller, - builder: (context, child) { - return Column( - children: [ - if (controller.images.isNotEmpty) - const RotatedBox( - quarterTurns: 1, - child: Icon( - Icons.arrow_back_ios, - color: Colors.white, - ), - ), - Expanded( - child: ListView.builder( - itemCount: controller.images.length, - physics: const BouncingScrollPhysics(), - scrollDirection: Axis.horizontal, - itemBuilder: (context, index) { - return InkWell( - onTap: () async { - await controller - .selectImage(controller.images[index]) - .then((value) { - Navigator.pop( - context, - controller.selectedImages, - ); - }); - }, - child: Container( - height: 100, - width: 100, - margin: const EdgeInsets.symmetric( - horizontal: 5), - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - isAntiAlias: true, - filterQuality: FilterQuality.high, - image: ThumbnailProvider( - highQuality: true, - mediumId: controller.images[index].id, - ), - ), - ), - ), - ); - }, - ), - ), - ], - ); - } - ), - ), - ), - ), - Center( - child: SlidingUpPanelWidget( - controlHeight: 0, - panelController: painel, - child: AnimatedBuilder( - animation: controller, - builder: (context, child) { - return _ImagesPage( - controller: controller, - close: () { - painel.hide(); - }, - done: () { - if (controller.selectedImages.isNotEmpty) { - Navigator.pop(context, controller.selectedImages); - } else { - painel.hide(); - } - }, - ); - }), - ), - ) - ], - ), - ); - } -} - -class _ImagesPage extends StatefulWidget { - final _WhatsAppCameraController controller; - - /// - /// close action - /// how use: - /// ```dart - /// close: () { - /// //pop painel - /// } - /// ``` - /// - final void Function()? close; - - /// - /// done action - /// how use: - /// ```dart - /// done: () { - /// //send images - /// } - /// ``` - /// - final void Function()? done; - - /// - /// - /// this is thi page of swipe to up - /// and show the images of gallery - /// don`t is necessary your implementation by the final programmer - /// - /// - const _ImagesPage({ - required this.controller, - required this.close, - required this.done, - }); - - @override - State<_ImagesPage> createState() => __ImagesPageState(); -} - -class __ImagesPageState extends State<_ImagesPage> { - @override - Widget build(BuildContext context) { - return Container( - color: Colors.black, - height: MediaQuery.of(context).size.height - 40, - child: Column( - children: [ - Container( - height: 40, - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(15), - topRight: Radius.circular(15), - )), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton( - onPressed: widget.close?.call, - icon: const Icon(Icons.close), - ), - if (widget.controller.multiple) - Text(widget.controller.selectedImages.length.toString()), - IconButton( - onPressed: widget.done?.call, - icon: const Icon(Icons.check), - ) - ], - ), - ), - Expanded( - child: GridView.builder( - padding: const EdgeInsets.symmetric(horizontal: 5), - itemCount: widget.controller.images.length, - physics: const BouncingScrollPhysics(), - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: 3, - mainAxisExtent: 140, - crossAxisSpacing: 5, - mainAxisSpacing: 5, - childAspectRatio: MediaQuery.of(context).size.width / - (MediaQuery.of(context).size.height / 4), - ), - itemBuilder: (context, index) { - return InkWell( - onTap: () => widget.controller - .selectImage(widget.controller.images[index]), - child: _ImageItem( - selected: widget.controller.imageIsSelected( - widget.controller.images[index].filename, - ), - image: widget.controller.images[index], - ), - ); - }, - ), - ), - ], - ), - ); - } -} - -class _ImageItem extends StatelessWidget { - /// - /// medium image - /// is formatter usage for package: photo_gallery - /// this package list all images of device - /// - final Medium image; - - /// - /// where selected is true, apply a check in the image - /// - final bool selected; - - /// - ///this widget is usage how itemBuilder of painel: _ImagesPage - /// - const _ImageItem({required this.image, required this.selected}); - - @override - Widget build(BuildContext context) { - return InkWell( - child: Stack( - children: [ - Hero( - tag: image.id, - child: Container( - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.cover, - filterQuality: FilterQuality.high, - image: ThumbnailProvider( - mediumId: image.id, - highQuality: true, - height: 150, - width: 150, - mediumType: MediumType.image, - ), - ), - ), - ), - ), - if (selected) - Container( - color: Colors.grey.withOpacity(.3), - child: Center( - child: Stack( - children: [ - const Icon( - Icons.done, - size: 52, - color: Colors.white, - ), - Icon( - Icons.done, - size: 50, - color: Theme.of(context).primaryColor, - ), - ], - ), - ), - ), - Align( - alignment: Alignment.topRight, - child: IconButton( - color: Colors.white, - icon: const Icon(Icons.zoom_out_map_outlined), - onPressed: () async { - await image.getFile().then((value) { - Navigator.of(context).push(MaterialPageRoute( - builder: (context) { - return Hero( - tag: image.id, - child: ViewImage(image: value.path), - ); - }, - )); - }); - }, - ), - ) - ], - ), - ); - } -} \ No newline at end of file diff --git a/lib/pages/forms_pages/components/whatsapp_camera.dart/view_image.dart b/lib/pages/forms_pages/components/whatsapp_camera.dart/view_image.dart deleted file mode 100644 index 98b40585..00000000 --- a/lib/pages/forms_pages/components/whatsapp_camera.dart/view_image.dart +++ /dev/null @@ -1,53 +0,0 @@ -import 'dart:io'; -import 'package:flutter/material.dart'; -import 'package:photo_view/photo_view.dart'; - -enum ImageType { file, network, asset } - -class ViewImage extends StatefulWidget { - /// - /// image path: network url, file path or asset - /// - final String image; - - /// - /// define the image type - /// - final ImageType imageType; - const ViewImage({ - key, - required this.image, - this.imageType = ImageType.file, - }); - - @override - State createState() => _ViewImageState(); -} - -class _ViewImageState extends State { - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.black, - elevation: 0, - ), - backgroundColor: Colors.black, - body: PhotoView( - enablePanAlways: true, - imageProvider: imageProvider, - maxScale: 3.0, - ), - ); - } - - ImageProvider get imageProvider { - if (widget.imageType == ImageType.file) { - return FileImage(File(widget.image)); - } else if (widget.imageType == ImageType.network) { - return NetworkImage(widget.image); - } else { - return AssetImage(widget.image); - } - } -} \ No newline at end of file diff --git a/lib/pages/main/drawer_and_header.dart b/lib/pages/main/drawer_and_header.dart deleted file mode 100644 index c8daf1d5..00000000 --- a/lib/pages/main/drawer_and_header.dart +++ /dev/null @@ -1,319 +0,0 @@ -import 'dart:async'; -import 'dart:io'; - -import 'package:app_tracking_transparency/app_tracking_transparency.dart'; -import 'package:auto_size_text/auto_size_text.dart'; -import 'package:flutter/material.dart'; -import 'package:badges/badges.dart' as badges; -import 'package:flutter/services.dart'; -import 'package:mosquito_alert_app/api/api.dart'; -import 'package:mosquito_alert_app/models/notification.dart'; -import 'package:mosquito_alert_app/pages/info_pages/info_page_webview.dart'; -import 'package:mosquito_alert_app/pages/main/home_page.dart'; -import 'package:mosquito_alert_app/pages/my_reports_pages/my_reports_page.dart'; -import 'package:mosquito_alert_app/pages/notification_pages/notifications_page.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/gallery_page.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/info_page.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/settings_page.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/UserManager.dart'; -import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:package_info/package_info.dart'; - - -class MainVC extends StatefulWidget { - const MainVC({key}); - - @override - State createState() => _MainVCState(); -} - -class _MainVCState extends State { - int _selectedIndex = 0; - int unreadNotifications = 0; - var packageInfo; - String? userUuid; - bool isLoading = true; - - @override - void initState() { - super.initState(); - _startAsyncTasks(); - } - - @override - void dispose() { - super.dispose(); - } - - void _startAsyncTasks() async { - await UserManager.startFirstTime(context); - setState(() { - isLoading = false; - }); - await _getNotificationCount(); - await getPackageInfo(); - await initAuthStatus(); - } - - Future _getNotificationCount() async { - List notifications = await ApiSingleton().getNotifications(); - var unacknowledgedCount = notifications.where((notification) => notification.acknowledged == false).length; - updateNotificationCount(unacknowledgedCount); - } - - void updateNotificationCount(int newCount) { - setState(() { - unreadNotifications = newCount; - }); - } - - Future getPackageInfo() async { - var _packageInfo = await PackageInfo.fromPlatform(); - setState(() { - packageInfo = _packageInfo; - }); - return true; - } - - Future initAuthStatus() async { - if (Platform.isIOS) { - await AppTrackingTransparency.requestTrackingAuthorization(); - } - - userUuid = await UserManager.getUUID(); - UserManager.userScore = await ApiSingleton().getUserScores(); - await UserManager.setUserScores(UserManager.userScore); - await Utils.loadFirebase(); - await Utils.getLocation(context); - return true; - } - - late final List _widgetOptions = [ - HomePage(), - MyReportsPage(), - GalleryPage(goBackToHomepage: _onItemTapped), - SettingsPage(), - InfoPage(), - ]; - - void _onItemTapped(int index) { - setState(() { - _selectedIndex = index; - }); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Colors.white, - centerTitle: true, - title: Image.asset( - 'assets/img/ic_logo.png', - height: 40, - ), - actions: [ - badges.Badge( - position: badges.BadgePosition.topEnd(top: 4, end: 4), - showBadge: unreadNotifications > 0, - badgeContent: Text('$unreadNotifications', style: TextStyle(color: Colors.white)), - child: IconButton( - padding: EdgeInsets.only(top: 6), - icon: Icon(Icons.notifications, size: 24), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => NotificationsPage(onNotificationUpdate: updateNotificationCount)), - ); - }, - ) - ) - ], - ), - body: Center( - child: isLoading - ? CircularProgressIndicator() - : _widgetOptions[_selectedIndex], - ), - drawer: Drawer( - child: Column( - children: [ - Expanded( - child: ListView( - padding: EdgeInsets.zero, - children: [ - DrawerHeader( - child: Row( - children: [ - // User score - InkWell( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => InfoPageInWebview("${MyLocalizations.of(context, 'url_point_1')}$userUuid")), - ); - }, - child: Container( - height: 60, - width: 60, - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage('assets/img/points_box.png'), - ), - ), - child: StreamBuilder( - stream: Utils.userScoresController.stream, - initialData: UserManager.userScore, - builder: (context, snapshot) { - return Center( - child: AutoSizeText( - snapshot.data != null && snapshot.hasData - ? snapshot.data.toString() - : '', - maxLines: 1, - maxFontSize: 26, - minFontSize: 16, - style: TextStyle( - color: Color(0xFF4B3D04), - fontWeight: FontWeight.w500, - fontSize: 24), - ) - ); - } - ), - ), - ), - - SizedBox(width: 12), - - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 50.0, bottom: 10.0), - child: Text( - MyLocalizations.of(context, 'welcome_text'), - style: TextStyle(fontSize: 22), - ), - ), - _uuidWithClipboard(), - ], - ) - ], - ) - ), - _buildCustomTile(0, Icons.home, 'home_tab', context), - _buildCustomTile(1, Icons.file_copy, 'your_reports_txt', context), - _buildCustomTile(2, Icons.biotech, 'guide_tab', context), - _buildCustomTile(3, Icons.info, 'info_tab', context), - _buildCustomTile(4, Icons.settings, 'settings_title', context), - ], - ), - ), - Align( - alignment: Alignment.bottomCenter, - child: Padding( - padding: const EdgeInsets.only(bottom: 20.0), - child: Text( - packageInfo != null - ? 'version ${packageInfo.version} (build ${packageInfo.buildNumber})' - : '', - style: TextStyle( - color: Colors.grey, - fontSize: 8.0, - ), - ), - ), - ), - ], - ) - ), - ); - } - - Widget _uuidWithClipboard(){ - return FutureBuilder( - future: UserManager.getUUID(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return CircularProgressIndicator(); - } else if (snapshot.hasError) { - return Text('Error: ${snapshot.error}'); - } - - return Row( - children: [ - Text( - 'ID: ', - style: TextStyle( - color: Colors.black.withOpacity(0.7), - fontSize: 8, - ), - ), - Text( - snapshot.data ?? '', - style: TextStyle( - color: Colors.grey, - fontSize: 8, - ), - ), - GestureDetector( - child: Icon( - Icons.copy_rounded, - size: 12, - ), - onTap: () { - final data = snapshot.data; - if (data != null) { - Clipboard.setData(ClipboardData(text: data)); - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(MyLocalizations.of(context, 'copied_to_clipboard_success')), - ), - ); - } else { - // Display an error message for troubleshooting - ScaffoldMessenger.of(context).showSnackBar( - SnackBar( - content: Text(MyLocalizations.of(context, 'copied_to_clipboard_error')), - ), - ); - } - }, - ) - ], - ); - } - ); - } - - Widget _buildCustomTile(int index, IconData icon, String title, context){ - return Padding( - padding: const EdgeInsets.symmetric(horizontal: 12.0), - child: Container( - decoration: BoxDecoration( - color: _selectedIndex == index ? Colors.orange.shade200 : Colors.transparent, - borderRadius: BorderRadius.circular(50.0), - ), - child: ListTile( - title: Text( - MyLocalizations.of(context, title), - style: TextStyle(color: Colors.black) - ), - leading: Icon( - icon, - color: Colors.black, - ), - minLeadingWidth: 0, - selected: _selectedIndex == index, - onTap: () { - _onItemTapped(index); - Navigator.pop(context); - }, - ), - ), - ); - } -} diff --git a/lib/pages/main/home_page.dart b/lib/pages/main/home_page.dart index 98e24d5b..4c8b61c9 100644 --- a/lib/pages/main/home_page.dart +++ b/lib/pages/main/home_page.dart @@ -3,9 +3,6 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/adult_report_page.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/biting_report_page.dart'; -import 'package:mosquito_alert_app/pages/forms_pages/breeding_report_page.dart'; import 'package:mosquito_alert_app/pages/main/components/custom_card_widget.dart'; import 'package:mosquito_alert_app/pages/map/public_map.dart'; import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; @@ -36,6 +33,12 @@ class _HomePageState extends State { return Stack( children: [ Scaffold( + appBar: AppBar( + title: Text( + MyLocalizations.of(context, "home_tab"), + style: Theme.of(context).textTheme.titleMedium, + ), + ), body: LayoutBuilder( builder: (BuildContext context, BoxConstraints viewportConstraints) { return SingleChildScrollView( @@ -179,7 +182,7 @@ class _HomePageState extends State { if (createReport) { await Navigator.push( context, - MaterialPageRoute(builder: (context) => BitingReportPage()), + MaterialPageRoute(builder: (context) => CircularProgressIndicator()), ); } else { print('Bite report was not created'); @@ -193,7 +196,7 @@ class _HomePageState extends State { if (createReport) { await Navigator.push( context, - MaterialPageRoute(builder: (context) => AdultReportPage()), + MaterialPageRoute(builder: (context) => CircularProgressIndicator()), ); } else { print('Adult report was not created'); @@ -207,7 +210,7 @@ class _HomePageState extends State { if (createReport) { await Navigator.push( context, - MaterialPageRoute(builder: (context) => BreedingReportPage()), + MaterialPageRoute(builder: (context) => CircularProgressIndicator()), ); } else { print('Site report was not created'); diff --git a/lib/pages/main/main_vc.dart b/lib/pages/main/main_vc.dart new file mode 100644 index 00000000..b6656d51 --- /dev/null +++ b/lib/pages/main/main_vc.dart @@ -0,0 +1,59 @@ +import 'package:flutter/material.dart'; +import 'package:mosquito_alert_app/pages/main/home_page.dart'; +import 'package:mosquito_alert_app/pages/map/public_map.dart'; +import 'package:mosquito_alert_app/pages/my_reports_pages/my_reports_page.dart'; +import 'package:mosquito_alert_app/pages/settings_pages/settings_page.dart'; + +class MainVC extends StatefulWidget { + @override + _MainVCState createState() => _MainVCState(); +} + +class _MainVCState extends State { + int _selectedIndex = 0; + + late final List _pages = [ + HomePage(), + PublicMap(), + MyReportsPage(), + SettingsPage(), + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + body: _pages[_selectedIndex], + bottomNavigationBar: NavigationBar( + onDestinationSelected: (int index) { + setState(() { + _selectedIndex = index; + }); + }, + indicatorColor: Colors.amber, + selectedIndex: _selectedIndex, + destinations: const [ + NavigationDestination( + selectedIcon: Icon(Icons.home), + icon: Icon(Icons.home_outlined), + label: 'Home (HC)' + ), + NavigationDestination( + selectedIcon: Icon(Icons.map), + icon: Icon(Icons.map_outlined), + label: 'Map (HC)', + ), + NavigationDestination( + selectedIcon: Icon(Icons.file_copy), + icon: Icon(Icons.file_copy_outlined), + label: 'My reports (HC)', + ), + NavigationDestination( + selectedIcon: Icon(Icons.person), + icon: Icon(Icons.person_outline), + label: 'Account (HC)', + ) + ], + ) + ); + } +} diff --git a/lib/pages/my_reports_pages/my_reports_page.dart b/lib/pages/my_reports_pages/my_reports_page.dart index 60d8da33..60cb9920 100644 --- a/lib/pages/my_reports_pages/my_reports_page.dart +++ b/lib/pages/my_reports_pages/my_reports_page.dart @@ -71,7 +71,10 @@ class _MyReportsPageState extends State { text: MyLocalizations.of(context, 'single_breeding_site')), ], ), - title: Text(MyLocalizations.of(context, 'your_reports_txt')), + title: Text( + MyLocalizations.of(context, 'your_reports_txt'), + style: Theme.of(context).textTheme.titleMedium, + ), ), body: isLoading ? Center(child: CircularProgressIndicator()) diff --git a/lib/pages/notification_pages/notifications_page.dart b/lib/pages/notification_pages/notifications_page.dart index 4e928834..2f5433e6 100644 --- a/lib/pages/notification_pages/notifications_page.dart +++ b/lib/pages/notification_pages/notifications_page.dart @@ -3,7 +3,6 @@ import 'dart:developer'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart' as html; -import 'package:flutter_html/style.dart' as html_style; import 'package:intl/intl.dart'; import 'package:mosquito_alert_app/api/api.dart'; import 'package:mosquito_alert_app/models/notification.dart'; @@ -11,7 +10,6 @@ import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; import 'package:mosquito_alert_app/utils/Utils.dart'; import 'package:mosquito_alert_app/utils/customModalBottomSheet.dart'; import 'package:mosquito_alert_app/utils/style.dart'; -import 'package:url_launcher/url_launcher.dart'; import '../../utils/UserManager.dart'; @@ -179,25 +177,20 @@ class _NotificationsPageState extends State { data: notification.expert_html! .replaceAll('

', ''), - onLinkTap: (String? url, html.RenderContext context, - Map attributes, _) async { - await launch(url!, forceSafariVC: true); - }, style: { 'a': html.Style( backgroundColor: Colors.transparent, color: Colors.blueAccent, - padding: EdgeInsets.all(12), - margin: html_style.Margins( - bottom: html_style.Margin(12.0), - right: html_style.Margin(12.0), - top: html_style.Margin(12.0), - left: html_style.Margin(12.0)), + padding: html.HtmlPaddings.all(12.0), + margin: html.Margins( + bottom: html.Margin(12.0), + right: html.Margin(12.0), + top: html.Margin(12.0), + left: html.Margin(12.0)), textDecoration: TextDecoration.underline, textAlign: TextAlign.center, fontSize: html.FontSize(16.0)), }, - tagsList: html.Html.tags..addAll(['bird', 'flutter']), )), SizedBox( diff --git a/lib/pages/settings_pages/components/settings_menu_widget.dart b/lib/pages/settings_pages/components/settings_menu_widget.dart index 989bc438..4ec390e4 100644 --- a/lib/pages/settings_pages/components/settings_menu_widget.dart +++ b/lib/pages/settings_pages/components/settings_menu_widget.dart @@ -1,30 +1,39 @@ import 'package:flutter/material.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; class SettingsMenuWidget extends StatelessWidget { - final String? text; + final String text; final Function onTap; + final bool addDivider; - SettingsMenuWidget(this.text, this.onTap); + SettingsMenuWidget(this.text, this.onTap, {this.addDivider = true}); @override Widget build(BuildContext context) { - return Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Colors.white, - border: Border.all(color: Colors.black.withOpacity(0.1))), - child: ListTile( - onTap: () { - onTap(); - }, - title: Style.body(text), - trailing: Icon( - Icons.arrow_forward_ios, - color: Colors.black, - size: 18, + return Column( + children: [ + ListTile( + onTap: () { + onTap(); + }, + title: Text( + text, + style: Theme.of(context).textTheme.bodyMedium, + ), + trailing: Icon( + Icons.arrow_forward_ios, + color: Colors.black, + size: 18, + ), + visualDensity: VisualDensity(vertical: -4), + dense: true, ), - ), + if (addDivider) + Divider( + thickness: 0.5, + indent: 5.0, + endIndent: 5.0, + ) + ], ); } } diff --git a/lib/pages/settings_pages/info_page.dart b/lib/pages/settings_pages/info_page.dart deleted file mode 100644 index 6529f19c..00000000 --- a/lib/pages/settings_pages/info_page.dart +++ /dev/null @@ -1,139 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'package:mosquito_alert_app/pages/info_pages/info_page_webview.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/campaign_tutorial_page.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/components/settings_menu_widget.dart'; -import 'package:mosquito_alert_app/pages/settings_pages/partners_page.dart'; -import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; - -class InfoPage extends StatefulWidget { - InfoPage(); - - @override - _InfoPageState createState() => _InfoPageState(); -} - -class _InfoPageState extends State { - @override - void initState() { - super.initState(); - } - - @override - Widget build(BuildContext context) { - final key = GlobalKey(); - - return Scaffold( - key: key, - - body: SingleChildScrollView( - child: Container( - margin: EdgeInsets.all(15), - child: - Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 10, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'info_scores_txt'), - () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - InfoPageInWebview(MyLocalizations.of(context, 'url_scoring_1'))), - ); - }), - SizedBox( - height: 10, - ), - SettingsMenuWidget( - MyLocalizations.of(context, 'about_the_project_txt'), () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => InfoPageInWebview( - MyLocalizations.of(context, 'url_about_project'))), - ); - }), - SizedBox( - height: 10, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'coordination_txt'), - () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - InfoPageInWebview(MyLocalizations.of(context, 'url_about_us'))), - ); - }), - SizedBox( - height: 10, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'partners_txt'), () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => PartnersPage()), - ); - }), - SizedBox( - height: 10, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'mailing_mosquito_samples'), () { - Navigator.push( - context, - MaterialPageRoute(builder: (context) => CampaignTutorialPage()), - ); - }), - SizedBox( - height: 30, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'terms_of_use_txt'), - () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => InfoPageInWebview( - MyLocalizations.of(context, 'terms_link'), - localHtml: true, - )), - ); - }), - SizedBox( - height: 10, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'privacy_txt'), () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => InfoPageInWebview( - MyLocalizations.of(context, 'privacy_link'), - localHtml: true, - )), - ); - }), - SizedBox( - height: 10, - ), - SettingsMenuWidget(MyLocalizations.of(context, 'license_txt'), () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => InfoPageInWebview( - MyLocalizations.of(context, 'lisence_link'), - localHtml: true, - )), - ); - }), - SizedBox( - height: 10, - ), - SizedBox( - height: 60, - ), - ]), - ), - ), - ); - } -} diff --git a/lib/pages/settings_pages/settings_page.dart b/lib/pages/settings_pages/settings_page.dart index 6d8225c4..1059af3a 100644 --- a/lib/pages/settings_pages/settings_page.dart +++ b/lib/pages/settings_pages/settings_page.dart @@ -1,15 +1,17 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:language_picker/language_picker.dart'; import 'package:language_picker/languages.dart'; +import 'package:mosquito_alert_app/pages/info_pages/info_page_webview.dart'; +import 'package:mosquito_alert_app/pages/settings_pages/campaign_tutorial_page.dart'; import 'package:mosquito_alert_app/pages/settings_pages/components/hashtag.dart'; import 'package:mosquito_alert_app/pages/settings_pages/components/settings_menu_widget.dart'; +import 'package:mosquito_alert_app/pages/settings_pages/partners_page.dart'; import 'package:mosquito_alert_app/utils/Application.dart'; import 'package:mosquito_alert_app/utils/MyLocalizations.dart'; -import 'package:mosquito_alert_app/utils/PushNotificationsManager.dart'; import 'package:mosquito_alert_app/utils/UserManager.dart'; import 'package:mosquito_alert_app/utils/Utils.dart'; -import 'package:mosquito_alert_app/utils/style.dart'; import 'package:package_info/package_info.dart'; import 'package:workmanager/workmanager.dart'; @@ -25,32 +27,34 @@ class _SettingsPageState extends State { var packageInfo; late int? numTagsAdded; bool isLoading = true; + late String userUuid; + int userScore = 0; final languageCodes = [ - Language('bg_BG', 'Bulgarian'), - Language('bn_BD', 'Bengali'), - Language('ca_ES', 'Catalan'), - Language('de_DE', 'German'), - Language('el_GR', 'Greek'), - Language('en_US', 'English'), - Language('es_ES', 'Spanish'), - Language('es_UY', 'Spanish (Uruguay)'), - Language('eu_ES', 'Basque'), - Language('fr_FR', 'French'), - Language('gl_ES', 'Galician'), - Language('hr_HR', 'Croatian'), - Language('hu_HU', 'Hungarian'), - Language('it_IT', 'Italian'), - Language('lb_LU', 'Luxembourgish (Luxembourg)'), - Language('mk_MK', 'Macedonian (Former Yugoslav Republic of Macedonia)'), - Language('nl_NL', 'Dutch'), - Language('pt_PT', 'Protuguese'), - Language('ro_RO', 'Romanian'), - Language('sl_SI', 'Slovenian (Slovenia)'), - Language('sq_AL', 'Albanian'), - Language('sr_RS', 'Serbian'), - Language('sv_SE', 'Swedish'), - Language('tr_TR', 'Turkish (Turkey)'), + Language('bg_BG', 'Bulgarian', 'Bulgarian'), + Language('bn_BD', 'Bengali', 'Bengali'), + Language('ca_ES', 'Catalan', 'Catalan'), + Language('de_DE', 'German', 'German'), + Language('el_GR', 'Greek', 'Greek'), + Language('en_US', 'English', 'English'), + Language('es_ES', 'Spanish', 'Spanish'), + Language('es_UY', 'Spanish (Uruguay)', 'Spanish (Uruguay)'), + Language('eu_ES', 'Basque', 'Basque'), + Language('fr_FR', 'French', 'French'), + Language('gl_ES', 'Galician', 'Galician'), + Language('hr_HR', 'Croatian', 'Croatian'), + Language('hu_HU', 'Hungarian', 'Hungarian'), + Language('it_IT', 'Italian', 'Italian'), + Language('lb_LU', 'Luxembourgish (Luxembourg)', 'Luxembourgish (Luxembourg)'), + Language('mk_MK', 'Macedonian (Former Yugoslav Republic of Macedonia)', 'Macedonian (Former Yugoslav Republic of Macedonia)'), + Language('nl_NL', 'Dutch', 'Dutch'), + Language('pt_PT', 'Protuguese', 'Protuguese'), + Language('ro_RO', 'Romanian', 'Romanian'), + Language('sl_SI', 'Slovenian (Slovenia)', 'Slovenian (Slovenia)'), + Language('sq_AL', 'Albanian', 'Albanian'), + Language('sr_RS', 'Serbian', 'Serbian'), + Language('sv_SE', 'Swedish', 'Swedish'), + Language('tr_TR', 'Turkish (Turkey)', 'Turkish (Turkey)'), ]; @override @@ -59,6 +63,7 @@ class _SettingsPageState extends State { getPackageInfo(); initializeBgTracking(); initializeTagsNum(); + initializeUser(); } void initializeBgTracking() async { @@ -86,123 +91,33 @@ class _SettingsPageState extends State { }); } + void initializeUser() async { + var _userUuid = await UserManager.getUUID(); + var _userScore = await UserManager.getUserScores(); + setState((){ + userUuid = _userUuid ?? ''; + userScore = _userScore ?? 0; + }); + } + @override Widget build(BuildContext context) { final key = GlobalKey(); return Scaffold( key: key, + appBar: AppBar( + title: Text( + "Account (Hardcoded)", + style: Theme.of(context).textTheme.titleMedium, + ), + ), body: SingleChildScrollView( child: Container( - margin: EdgeInsets.all(15), - child: isLoading ? - Container( - height: MediaQuery.sizeOf(context).height * 0.8, - child: Center( - child: CircularProgressIndicator() - ), - ) - : - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - SizedBox( - height: 10, - ), - SettingsMenuWidget( - MyLocalizations.of(context, 'select_language_txt'), () { - _openLanguagePickerDialog(); - }), - SizedBox( - height: 10, - ), - Container( - padding: EdgeInsets.only(bottom: 12.0, top: 12.0), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Colors.white, - border: Border.all(color: Colors.black.withOpacity(0.1)) - ), - child: SwitchListTile( - title: Style.body(MyLocalizations.of(context, 'background_tracking_title')), - subtitle: Padding( - padding: EdgeInsets.only(top: 8.0), - child: Text( - MyLocalizations.of(context, 'background_tracking_subtitle'), - style: TextStyle(fontSize: 11), - ), - ), - value: isBgTrackingEnabled, - activeColor: Colors.orange, - onChanged: (bool value) async { - await UserManager.setTracking(value); - var trackingStatus = await UserManager.getTracking(); - setState(() { - isBgTrackingEnabled = trackingStatus; - }); - if (!isBgTrackingEnabled){ - await Workmanager().cancelByTag('trackingTask'); - } - }, - ), - ), - SizedBox( - height: 10, - ), - Container( - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - color: Colors.white, - border: Border.all(color: Colors.black.withOpacity(0.1)), - ), - child: Row( - children: [ - Expanded( - child: ExpansionTile( - initiallyExpanded: numTagsAdded! > 0, - title: Row( - children: [ - Text( - MyLocalizations.of(context, 'auto_tagging_settings_title'), - ), - Spacer(flex: 1), - if (numTagsAdded! > 0) - Container( - margin: EdgeInsets.only(left: 8.0), - padding: EdgeInsets.all(4.0), - decoration: BoxDecoration( - shape: BoxShape.circle, - color: Colors.grey, - ), - child: Text( - '$numTagsAdded', - style: TextStyle( - color: Colors.white, - fontSize: 12.0, - fontWeight: FontWeight.bold, - ), - ), - ), - ], - ), - children: [ - Padding( - padding: const EdgeInsets.symmetric(horizontal: 15.0), - child: Text( - MyLocalizations.of(context, 'enable_auto_hashtag_text'), - style: TextStyle( - fontSize: 11, - color: Colors.grey[600]), - ), - ), - StringMultilineTags(updateTagsNum: updateTagsNum), - ], - ), - ), - ], - ), - ) - ]), + margin: EdgeInsets.fromLTRB(15, 0, 15, 15), + child: isLoading + ? _buildLoadingIndicator(context) + : _buildAccountContent(context), ), ), ); @@ -211,22 +126,26 @@ class _SettingsPageState extends State { void _openLanguagePickerDialog() => showDialog( context: context, builder: (context) => Theme( - data: Theme.of(context).copyWith(primaryColor: Style.colorPrimary), + data: Theme.of(context).copyWith(primaryColor: Theme.of(context).primaryColor), child: LanguagePickerDialog( languages: languageCodes.map( (language) => Language( language.isoCode, - MyLocalizations.of(context, language.isoCode) + MyLocalizations.of(context, language.isoCode), + language.nativeName, )).toList()..sort( (a, b) => a.name.compareTo(b.name) ), titlePadding: EdgeInsets.all(8.0), - searchCursorColor: Style.colorPrimary, + searchCursorColor: Theme.of(context).primaryColor, searchInputDecoration: InputDecoration( - hintText: MyLocalizations.of(context, 'search_txt')), + hintText: MyLocalizations.of(context, 'search_txt')), // TODO: Change style but it's raw string isSearchable: true, title: - Text(MyLocalizations.of(context, 'select_language_txt')), + Text( + MyLocalizations.of(context, 'select_language_txt'), + style: Theme.of(context).textTheme.titleMedium, + ), onValuePicked: (Language language) => setState(() { var languageCodes = language.isoCode.split('_'); @@ -236,15 +155,335 @@ class _SettingsPageState extends State { UserManager.setLanguageCountry(languageCodes[1]); application.onLocaleChanged( Locale(languageCodes[0], languageCodes[1])); - PushNotificationsManager.subscribeToTopic( - languageCodes[0]); }), itemBuilder: (Language language) { return Row( children: [ - Text(MyLocalizations.of(context, language.isoCode)), + Text( + MyLocalizations.of(context, language.isoCode), + style: Theme.of(context).textTheme.bodyMedium, + ), ], ); })), ); + + Widget _buildLoadingIndicator(BuildContext context) { + return Container( + height: MediaQuery.of(context).size.height * 0.8, + child: Center(child: CircularProgressIndicator()), + ); + } + + Widget _buildAccountContent(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildProfileHeader(context), + SizedBox(height: 10), + Divider(), + _buildSettingsSection(context), + Divider(), + _buildSupportSection(context), + Divider(), + _buildLegalSection(context), + Divider(), + uuidWithCopyToClipboard(), + versionNumber(), + ], + ); + } + + Widget _buildProfileHeader(BuildContext context) { + return Column( + children: [ + _buildAvatar(), + _buildUserName(), + _buildUserScore(), + ], + ); + } + + Widget _buildAvatar() { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + decoration: BoxDecoration( + shape: BoxShape.circle, + border: Border.all( + color: Colors.black, + width: 6, + ), + ), + child: CircleAvatar( + radius: 25, + child: Icon(Icons.person, size: 40), + backgroundColor: Colors.transparent, + ), + ), + ], + ); + } + + Widget _buildUserName() { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'Anonymous', + style: Theme.of(context).textTheme.titleMedium, + ), + ], + ); + } + + Widget _buildUserScore() { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + Icons.star, + color: Colors.orange, + size: 15, + ), + SizedBox(width: 5), + Text( + '$userScore', + style: Theme.of(context).textTheme.bodyMedium, + ), + ], + ); + } + + Widget _buildSettingsSection(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(MyLocalizations.of(context, "settings_title").toUpperCase()), + SettingsMenuWidget( + MyLocalizations.of(context, 'select_language_txt'), + _openLanguagePickerDialog, + ), + _buildBackgroundTrackingSwitch(context), + _buildAutoTaggingSettings(context), + ], + ); + } + + Widget _buildBackgroundTrackingSwitch(BuildContext context) { + return SwitchListTile( + title: Text( + MyLocalizations.of(context, 'background_tracking_title'), + style: Theme.of(context).textTheme.bodyMedium, + ), + subtitle: Padding( + padding: EdgeInsets.only(top: 8.0), + child: Text( + MyLocalizations.of(context, 'background_tracking_subtitle'), + style: Theme.of(context).textTheme.bodySmall, + ), + ), + value: isBgTrackingEnabled, + activeColor: Colors.orange, + onChanged: (bool value) async { + await UserManager.setTracking(value); + var trackingStatus = await UserManager.getTracking(); + setState(() { + isBgTrackingEnabled = trackingStatus; + }); + if (!isBgTrackingEnabled) { + await Workmanager().cancelByTag('trackingTask'); + } + }, + ); + } + + Widget _buildAutoTaggingSettings(BuildContext context) { + return Row( + children: [ + Expanded( + child: ExpansionTile( + initiallyExpanded: numTagsAdded! > 0, + title: Row( + children: [ + Text( + MyLocalizations.of(context, 'auto_tagging_settings_title'), + style: Theme.of(context).textTheme.bodyMedium, + ), + Spacer(), + if (numTagsAdded! > 0) + Container( + margin: EdgeInsets.only(left: 8.0), + padding: EdgeInsets.all(4.0), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: Colors.grey, + ), + child: Text( + '$numTagsAdded', + style: Theme.of(context).textTheme.labelMedium, + ), + ), + ], + ), + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 15.0), + child: Text( + MyLocalizations.of(context, 'enable_auto_hashtag_text'), + style: Theme.of(context).textTheme.bodySmall, + ), + ), + StringMultilineTags(updateTagsNum: updateTagsNum), + ], + ), + ), + ], + ); + } + + Widget _buildSupportSection(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text("SUPPORT (Hardcoded)"), + SettingsMenuWidget( + MyLocalizations.of(context, 'info_scores_txt'), + () => _navigateToWebview(context, 'url_scoring_1'), + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'about_the_project_txt'), + () => _navigateToWebview(context, 'url_about_project'), + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'partners_txt'), + () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => PartnersPage()), + ), + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'coordination_txt'), + () => _navigateToWebview(context, 'url_about_us'), + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'mailing_mosquito_samples'), + () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => CampaignTutorialPage()), + ), + addDivider: false, + ), + ], + ); + } + + Widget _buildLegalSection(BuildContext context) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "LEGAL (Hardcoded)", + style: Theme.of(context).textTheme.bodyMedium, + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'terms_of_use_txt'), + () => _navigateToWebview(context, 'terms_link'), + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'privacy_txt'), + () => _navigateToWebview(context, 'privacy_link'), + ), + SettingsMenuWidget( + MyLocalizations.of(context, 'license_txt'), + () => _navigateToWebview(context, 'lisence_link'), + addDivider: false, + ), + ], + ); + } + + void _navigateToWebview(BuildContext context, String urlKey) { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => InfoPageInWebview(MyLocalizations.of(context, urlKey)), + ), + ); + } + + Widget uuidWithCopyToClipboard(){ + return FutureBuilder( + future: UserManager.getUUID(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return CircularProgressIndicator(); + } else if (snapshot.hasError) { + return Text('Error: ${snapshot.error}'); + } + + return Center( + child: Row( + mainAxisSize:MainAxisSize.min, + children: [ + Text( + 'UUID: ', + style: Theme.of(context).textTheme.labelSmall, + ), + Text( + snapshot.data ?? '', + style: Theme.of(context).textTheme.labelSmall, + ), + GestureDetector( + child: Icon( + Icons.copy_rounded, + size: 11, + ), + onTap: () { + final data = snapshot.data; + if (data != null) { + Clipboard.setData(ClipboardData(text: data)); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + MyLocalizations.of(context, 'copied_to_clipboard_success'), + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + ); + } else { + // Display an error message for troubleshooting + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + MyLocalizations.of(context, 'copied_to_clipboard_error'), + style: Theme.of(context).textTheme.bodyMedium, + ), + ), + ); + } + }, + ) + ], + ), + ); + } + ); + } + + Widget versionNumber(){ + return Align( + alignment: Alignment.bottomCenter, + child: Padding( + padding: const EdgeInsets.only(bottom: 20.0), + child: Text( + packageInfo != null + ? 'version ${packageInfo.version} (build ${packageInfo.buildNumber})' + : '', + style: Theme.of(context).textTheme.labelSmall, + ), + ), + ); + } } diff --git a/lib/utils/PushNotificationsManager.dart b/lib/utils/PushNotificationsManager.dart index f65cc204..68112141 100644 --- a/lib/utils/PushNotificationsManager.dart +++ b/lib/utils/PushNotificationsManager.dart @@ -5,7 +5,6 @@ import 'dart:io'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; -import 'package:mosquito_alert_app/models/report.dart'; import 'package:mosquito_alert_app/models/topic.dart'; import 'package:mosquito_alert_app/utils/MessageNotification.dart'; import 'package:mosquito_alert_app/utils/Utils.dart'; @@ -49,7 +48,6 @@ class PushNotificationsManager { if (token != null) { await registerFCMToken(token); - await getTopicsSubscribed(); Utils.initializedCheckData['firebase'] = true; _initialized = true; } @@ -156,76 +154,5 @@ class PushNotificationsManager { static Future registerFCMToken(String fcmToken) async { var userId = await UserManager.getUUID(); var result = ApiSingleton().setFirebaseToken(userId, fcmToken); - await subscribeToGlobal(); - } - - static Future subscribeToGlobal() async { - var topic = 'global'; - await subscribeToTopic(topic); - } - - static Future subscribeToReportResult(Report report) async { - try { - if (report.country != null) { - await subscribeToTopic('${report.country}'); - } - if (report.nuts2 != null) { - await subscribeToTopic('${report.nuts2}'); - } - if (report.nuts3 != null) { - await subscribeToTopic('${report.nuts3}'); - } - } catch (e) { - print('Report subscription failed for reason: $e'); - } - } - - static Future subscribeToLanguage() async { - var languageId = await UserManager.getLanguage(); - await subscribeToTopic(languageId); - } - - static Future subscribeToTopic(String? topic) async { - if (_initialized) { - var userId = await UserManager.getUUID(); - if (userId != null && !_checkIfSubscribed(topic)) { - var result = await ApiSingleton().subscribeToTopic(userId, topic); - if (result) { - await _firebaseMessaging.subscribeToTopic(topic!); - } else if (topic == 'global') { - await _firebaseMessaging.subscribeToTopic('global'); - } - } - } - } - - static Future unsubscribeToTopic(String topic) async { - var userId = await UserManager.getUUID(); - if (userId != null && _checkIfSubscribed(topic)) { - var result = await ApiSingleton().unsubscribeFromTopic(userId, topic); - if (result) { - await _firebaseMessaging.unsubscribeFromTopic(topic); - } - } - } - - static Future?> getTopicsSubscribed() async { - var userId = await UserManager.getUUID(); - if (userId != null) { - var result = await ApiSingleton().getTopicsSubscribed(userId); - if (result != null) { - currentTopics = result; - } - } - return null; - } - - static bool _checkIfSubscribed(String? topicCode) { - for (var topic in currentTopics) { - if (topic.topicCode == topicCode) { - return true; - } - } - return false; } } diff --git a/lib/utils/Utils.dart b/lib/utils/Utils.dart index b3d54350..c050f18c 100644 --- a/lib/utils/Utils.dart +++ b/lib/utils/Utils.dart @@ -15,8 +15,6 @@ import 'package:in_app_review/in_app_review.dart'; import 'package:mosquito_alert_app/api/api.dart'; import 'package:mosquito_alert_app/models/question.dart'; import 'package:mosquito_alert_app/models/report.dart'; -import 'package:mosquito_alert_app/models/response.dart'; -import 'package:mosquito_alert_app/models/session.dart'; import 'package:mosquito_alert_app/utils/PushNotificationsManager.dart'; import 'package:mosquito_alert_app/utils/UserManager.dart'; import 'package:mosquito_alert_app/utils/style.dart'; @@ -41,7 +39,6 @@ class Utils { //REPORTS static Report? report; - static Session? session; static List? reportsList; static Report? savedAdultReport; @@ -66,99 +63,60 @@ class Utils { imagePath!.removeWhere((element) => element['image'] == image); } - static void closeSession() { - session!.session_end_time = DateTime.now().toUtc().toIso8601String(); - ApiSingleton().closeSession(session!); - } - static Future createNewReport( String type, { lat, lon, locationType, }) async { - if (session == null) { - reportsList = []; - - var userUUID = await UserManager.getUUID(); - - dynamic response = await ApiSingleton().getLastSession(userUUID); - if (response is bool && !response) { - print('Unable to get last session.'); - return false; - } - - if (response is ApiResponse) { - print('response is of type ApiResponse, not a number.'); - return false; - } + var lang = await UserManager.getLanguage(); + var userUUID = await UserManager.getUUID(); + report = Report( + type: type, + report_id: randomAlphaNumeric(4).toString(), + version_number: 0, + version_UUID: Uuid().v4(), + user: userUUID, + responses: []); + + var packageInfo = await PackageInfo.fromPlatform(); + report!.package_name = packageInfo.packageName; + report!.package_version = 34; - int? sessionId = response + 1; - - session = Session( - session_ID: sessionId, - user: userUUID, - session_start_time: DateTime.now().toUtc().toIso8601String()); - - print(language); - session!.id = await ApiSingleton().createSession(session!); - // print("Session: ${jsonEncode(session.toJson())}"); + if (Platform.isAndroid) { + var buildData = await DeviceInfoPlugin().androidInfo; + report!.device_manufacturer = buildData.manufacturer; + report!.device_model = buildData.model; + report!.os = 'Android'; + report!.os_language = language.languageCode; + report!.os_version = buildData.version.sdkInt.toString(); + report!.app_language = lang ?? language.languageCode; + } else if (Platform.isIOS) { + var buildData = await DeviceInfoPlugin().iosInfo; + report!.device_manufacturer = 'Apple'; + report!.device_model = buildData.model; + report!.os = buildData.systemName; + report!.os_language = language.languageCode; + report!.os_version = buildData.systemVersion; + report!.app_language = lang ?? language.languageCode; } - if (session!.id != null) { - var lang = await UserManager.getLanguage(); - var userUUID = await UserManager.getUUID(); - report = Report( - type: type, - report_id: randomAlphaNumeric(4).toString(), - version_number: 0, - version_UUID: Uuid().v4(), - user: userUUID, - session: session!.id, - responses: []); - - var packageInfo = await PackageInfo.fromPlatform(); - report!.package_name = packageInfo.packageName; - report!.package_version = 34; - - if (Platform.isAndroid) { - var buildData = await DeviceInfoPlugin().androidInfo; - report!.device_manufacturer = buildData.manufacturer; - report!.device_model = buildData.model; - report!.os = 'Android'; - report!.os_language = language.languageCode; - report!.os_version = buildData.version.sdkInt.toString(); - report!.app_language = lang ?? language.languageCode; - } else if (Platform.isIOS) { - var buildData = await DeviceInfoPlugin().iosInfo; - report!.device_manufacturer = 'Apple'; - report!.device_model = buildData.model; - report!.os = buildData.systemName; - report!.os_language = language.languageCode; - report!.os_version = buildData.systemVersion; - report!.app_language = lang ?? language.languageCode; - } - - if (lat != null && lon != null) { - if (locationType == 'selected') { - report!.location_choice = 'selected'; - report!.selected_location_lat = lat; - report!.selected_location_lon = lon; - } else { - report!.location_choice = 'current'; - report!.current_location_lat = lat; - report!.current_location_lon = lon; - } + if (lat != null && lon != null) { + if (locationType == 'selected') { + report!.location_choice = 'selected'; + report!.selected_location_lat = lat; + report!.selected_location_lon = lon; + } else { + report!.location_choice = 'current'; + report!.current_location_lat = lat; + report!.current_location_lon = lon; } - return true; } - - return false; + return true; } static void resetReport() { report = null; - session = null; reportsList = null; } @@ -373,7 +331,6 @@ class Utils { } } - closeSession(); return isCreated; } } @@ -486,7 +443,6 @@ class Utils { static Future loadFirebase() async { await PushNotificationsManager.init(); - await PushNotificationsManager.subscribeToLanguage(); } static getLocation(BuildContext context) async { diff --git a/lib/utils/style.dart b/lib/utils/style.dart index 63096e71..6ab30577 100644 --- a/lib/utils/style.dart +++ b/lib/utils/style.dart @@ -1,3 +1,4 @@ +// TODO: Remove this file? import 'dart:io'; import 'package:flutter/material.dart'; diff --git a/pubspec.lock b/pubspec.lock index 977db952..41673218 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,50 +5,50 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" url: "https://pub.dev" source: hosted - version: "61.0.0" + version: "67.0.0" _flutterfire_internals: dependency: transitive description: name: _flutterfire_internals - sha256: d84d98f1992976775f83083523a34c5d22fea191eec3abb2bd09537fb623c2e0 + sha256: "37a42d06068e2fe3deddb2da079a8c4d105f241225ba27b7122b37e9865fd8f7" url: "https://pub.dev" source: hosted - version: "1.3.7" + version: "1.3.35" analyzer: dependency: transitive description: name: analyzer - sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" url: "https://pub.dev" source: hosted - version: "5.13.0" + version: "6.4.1" app_tracking_transparency: dependency: "direct main" description: name: app_tracking_transparency - sha256: ce9311f0e393dbd6b1cb4aeaf609e2db8ba20b1327ca67d07c11ef4876f843a8 + sha256: "64d9745931e565790abdea91b518ac8dc3cebe6d0d0aaf7119343271b983259a" url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.0.6" archive: dependency: transitive description: name: archive - sha256: "20071638cbe4e5964a427cfa0e86dce55d060bc7d82d56f3554095d7239a8765" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d url: "https://pub.dev" source: hosted - version: "3.4.2" + version: "3.6.1" args: dependency: transitive description: name: args - sha256: b003c3098049a51720352d219b0bb5f219b60fbfb68e7a4748139a06a5676515 + sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.6.0" async: dependency: transitive description: @@ -77,50 +77,18 @@ packages: dependency: "direct main" description: name: battery_plus - sha256: "793267102c2eb013809b0eb6c6360ad0a17d22c3d371f76e24e747b20f476224" - url: "https://pub.dev" - source: hosted - version: "2.1.4+1" - battery_plus_linux: - dependency: transitive - description: - name: battery_plus_linux - sha256: c787d16f97ad51bb45393b02b63764501fd148e3d45cea9697d7c6650847be30 - url: "https://pub.dev" - source: hosted - version: "1.2.0" - battery_plus_macos: - dependency: transitive - description: - name: battery_plus_macos - sha256: "0607bcb26efb56eeb419df2f919ac30f1590c06027bdf7aed366dbb3d1bae485" + sha256: ccc1322fee1153a0f89e663e0eac2f64d659da506454cf24dcad75eb08ae138b url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "6.0.2" battery_plus_platform_interface: dependency: transitive description: name: battery_plus_platform_interface - sha256: "19fd8418a81aeb2dea8fb7026b1fdf56b6c6d319baf8d703fa0d13c1d5c7ba2f" - url: "https://pub.dev" - source: hosted - version: "1.2.2" - battery_plus_web: - dependency: transitive - description: - name: battery_plus_web - sha256: "8bfa1ac36f8cdb07d64f60a342f986312036bfd910838c35d21dd786af13808b" + sha256: e8342c0f32de4b1dfd0223114b6785e48e579bfc398da9471c9179b907fa4910 url: "https://pub.dev" source: hosted - version: "1.1.0" - battery_plus_windows: - dependency: transitive - description: - name: battery_plus_windows - sha256: "7b57fa77f50cd0401473f51339b701eddf1c68f040be644a649c67afe51bbba7" - url: "https://pub.dev" - source: hosted - version: "1.1.3" + version: "2.0.1" boolean_selector: dependency: transitive description: @@ -129,6 +97,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" cached_network_image: dependency: "direct main" description: @@ -153,54 +129,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.0" - camera: - dependency: transitive - description: - name: camera - sha256: "9499cbc2e51d8eb0beadc158b288380037618ce4e30c9acbc4fae1ac3ecb5797" - url: "https://pub.dev" - source: hosted - version: "0.10.5+9" - camera_android: - dependency: transitive - description: - name: camera_android - sha256: b350ac087f111467e705b2b76cc1322f7f5bdc122aa83b4b243b0872f390d229 - url: "https://pub.dev" - source: hosted - version: "0.10.9+2" - camera_avfoundation: - dependency: transitive - description: - name: camera_avfoundation - sha256: "608b56b0880722f703871329c4d7d4c2f379c8e2936940851df7fc041abc6f51" - url: "https://pub.dev" - source: hosted - version: "0.9.13+10" - camera_camera: - dependency: "direct main" - description: - name: camera_camera - sha256: fd2cffd6a015f588a5fef7e829ad8dff0789ccba0e9faea980d184a13b91e818 - url: "https://pub.dev" - source: hosted - version: "3.0.0" - camera_platform_interface: - dependency: transitive - description: - name: camera_platform_interface - sha256: fdb8b7a40c3564ce2967273445707d58cbff91bc2fa129e8de80af8cc501e793 - url: "https://pub.dev" - source: hosted - version: "2.7.1" - camera_web: - dependency: transitive - description: - name: camera_web - sha256: "9e9aba2fbab77ce2472924196ff8ac4dd8f9126c4f9a3096171cd1d870d6b26c" - url: "https://pub.dev" - source: hosted - version: "0.3.3" characters: dependency: transitive description: @@ -213,18 +141,18 @@ packages: dependency: transitive description: name: checked_yaml - sha256: dd007e4fb8270916820a0d66e24f619266b60773cddd082c6439341645af2659 + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.3" cli_util: dependency: transitive description: name: cli_util - sha256: "66f86e916d285c1a93d3b79587d94bd71984a66aac4ff74e524cfa7877f1395c" + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 url: "https://pub.dev" source: hosted - version: "0.3.5" + version: "0.4.1" clock: dependency: transitive description: @@ -237,10 +165,10 @@ packages: dependency: transitive description: name: collection - sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a url: "https://pub.dev" source: hosted - version: "1.17.2" + version: "1.18.0" connectivity: dependency: "direct main" description: @@ -277,50 +205,42 @@ packages: dependency: transitive description: name: convert - sha256: "1be13198012c1d5bc042dc40ad1d7f16cbd522350984c0c1abf471d6d7e305c6" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.1" coverage: dependency: transitive description: name: coverage - sha256: "595a29b55ce82d53398e1bcc2cba525d7bd7c59faeb2d2540e9d42c390cfeeeb" + sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" url: "https://pub.dev" source: hosted - version: "1.6.4" + version: "1.8.0" cross_file: dependency: transitive description: name: cross_file - sha256: "0b0036e8cccbfbe0555fd83c1d31a6f30b77a96b598b35a5d36dd41f718695e9" + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" url: "https://pub.dev" source: hosted - version: "0.3.3+4" + version: "0.3.4+2" crypto: dependency: transitive description: name: crypto - sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" csslib: dependency: transitive description: name: csslib - sha256: b36c7f7e24c0bdf1bf9a3da461c837d1de64b9f8beb190c9011d8c72a3dfd745 + sha256: "831883fb353c8bdc1d71979e5b342c7d88acfbc643113c14ae51e2442ea0f20f" url: "https://pub.dev" source: hosted - version: "0.17.2" - cupertino_icons: - dependency: "direct main" - description: - name: cupertino_icons - sha256: e35129dc44c9118cee2a5603506d823bab99c68393879edb440e0090d07586be - url: "https://pub.dev" - source: hosted - version: "1.0.5" + version: "0.17.3" dbus: dependency: transitive description: @@ -329,6 +249,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.10" + dependency_validator: + dependency: "direct dev" + description: + name: dependency_validator + sha256: "81b5dc4cc34a1c05d2fa24aa8d658cb8f048ca23e63d5aaec420200190f1c4b0" + url: "https://pub.dev" + source: hosted + version: "4.1.1" device_info_plus: dependency: "direct main" description: @@ -349,10 +277,18 @@ packages: dependency: "direct main" description: name: dio - sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7" + sha256: "5598aa796bbf4699afd5c67c0f5f6e2ed542afc956884b9cd58c306966efc260" + url: "https://pub.dev" + source: hosted + version: "5.7.0" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "33259a9276d6cea88774a0000cfae0d861003497755969c92faa223108620dc8" url: "https://pub.dev" source: hosted - version: "5.3.3" + version: "2.0.0" fake_async: dependency: transitive description: @@ -365,130 +301,130 @@ packages: dependency: transitive description: name: ffi - sha256: ed5337a5660c506388a9f012be0288fb38b49020ce2b45fe1f8b8323fe429f99 + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.1.3" file: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 url: "https://pub.dev" source: hosted - version: "6.1.4" - file_picker: - dependency: "direct main" - description: - name: file_picker - sha256: "9d6e95ec73abbd31ec54d0e0df8a961017e165aba1395e462e5b31ea0c165daf" - url: "https://pub.dev" - source: hosted - version: "5.3.1" + version: "7.0.1" file_selector_linux: dependency: transitive description: name: file_selector_linux - sha256: "045d372bf19b02aeb69cacf8b4009555fb5f6f0b7ad8016e5f46dd1387ddd492" + sha256: "712ce7fab537ba532c8febdb1a8f167b32441e74acd68c3ccb2e36dcb52c4ab2" url: "https://pub.dev" source: hosted - version: "0.9.2+1" + version: "0.9.3" file_selector_macos: dependency: transitive description: name: file_selector_macos - sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 + sha256: "271ab9986df0c135d45c3cdb6bd0faa5db6f4976d3e4b437cf7d0f258d941bfc" url: "https://pub.dev" source: hosted - version: "0.9.4" + version: "0.9.4+2" file_selector_platform_interface: dependency: transitive description: name: file_selector_platform_interface - sha256: "0aa47a725c346825a2bd396343ce63ac00bda6eff2fbc43eabe99737dede8262" + sha256: a3994c26f10378a039faa11de174d7b78eb8f79e4dd0af2a451410c1a5c3f66b url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.6.2" file_selector_windows: dependency: transitive description: name: file_selector_windows - sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + sha256: "8f5d2f6590d51ecd9179ba39c64f722edc15226cc93dcc8698466ad36a4a85a4" url: "https://pub.dev" source: hosted - version: "0.9.3+1" + version: "0.9.3+3" firebase_auth: dependency: "direct main" description: name: firebase_auth - sha256: "95c74884ff25eafcbbbcd5506b738e68ee98ff54d09522a6092a2fb95d02ee7a" + sha256: "279b2773ff61afd9763202cb5582e2b995ee57419d826b9af6517302a59b672f" url: "https://pub.dev" source: hosted - version: "4.10.1" + version: "4.16.0" firebase_auth_platform_interface: dependency: transitive description: name: firebase_auth_platform_interface - sha256: "05d2636673e145d2b5eccc452c009808af4c15e8b402f34bb8fec63f2c76e86b" + sha256: a0270e1db3b2098a14cb2a2342b3cd2e7e458e0c391b1f64f6f78b14296ec093 url: "https://pub.dev" source: hosted - version: "6.19.1" + version: "7.3.0" firebase_auth_web: dependency: transitive description: name: firebase_auth_web - sha256: "4b8374da5d8969f99453ebd65074c1d379fe781bb3680fa7f65a4d3ac4ec87b3" + sha256: c7b1379ccef7abf4b6816eede67a868c44142198e42350f51c01d8fc03f95a7d url: "https://pub.dev" source: hosted - version: "5.8.2" + version: "5.8.13" firebase_core: dependency: "direct main" description: name: firebase_core - sha256: "95580fa07c8ca3072a2bb1fecd792616a33f8683477d25b7d29d3a6a399e6ece" + sha256: "26de145bb9688a90962faec6f838247377b0b0d32cc0abecd9a4e43525fc856c" url: "https://pub.dev" source: hosted - version: "2.17.0" + version: "2.32.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - sha256: b63e3be6c96ef5c33bdec1aab23c91eb00696f6452f0519401d640938c94cba2 + sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810 url: "https://pub.dev" source: hosted - version: "4.8.0" + version: "5.3.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: e8c408923cd3a25bd342c576a114f2126769cd1a57106a4edeaa67ea4a84e962 + sha256: "362e52457ed2b7b180964769c1e04d1e0ea0259fdf7025fdfedd019d4ae2bd88" url: "https://pub.dev" source: hosted - version: "2.8.0" + version: "2.17.5" firebase_messaging: dependency: "direct main" description: name: firebase_messaging - sha256: e82c99bcccf707db4d82ac3fb07be629a392c4cc2a6756aaf1a74c009114846f + sha256: "980259425fa5e2afc03e533f33723335731d21a56fd255611083bceebf4373a8" url: "https://pub.dev" source: hosted - version: "14.3.0" + version: "14.7.10" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface - sha256: "710bb139ff6e27fe47a0684ba88df4b7517a44d814dc6b7f54a2537568a82fcf" + sha256: "87c4a922cb6f811cfb7a889bdbb3622702443c52a0271636cbc90d813ceac147" url: "https://pub.dev" source: hosted - version: "4.2.16" + version: "4.5.37" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web - sha256: "66ece031cb17fb771cda4b3328858395fa48aa4c3b3e6a5d1bcaff928086cacd" + sha256: "90dc7ed885e90a24bb0e56d661d4d2b5f84429697fd2cbb9e5890a0ca370e6f4" url: "https://pub.dev" source: hosted - version: "3.2.17" + version: "3.5.18" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" flutter: dependency: "direct main" description: flutter @@ -502,59 +438,35 @@ packages: url: "https://pub.dev" source: hosted version: "3.3.1" - flutter_colorpicker: - dependency: transitive - description: - name: flutter_colorpicker - sha256: "458a6ed8ea480eb16ff892aedb4b7092b2804affd7e046591fb03127e8d8ef8b" - url: "https://pub.dev" - source: hosted - version: "1.0.3" flutter_html: dependency: "direct main" description: name: flutter_html - sha256: "342c7908f0a67bcec62b6e0f7cf23e23bafe7f64693665dd35be98d5e783bdfd" + sha256: "02ad69e813ecfc0728a455e4bf892b9379983e050722b1dce00192ee2e41d1ee" url: "https://pub.dev" source: hosted - version: "3.0.0-alpha.6" + version: "3.0.0-beta.2" flutter_launcher_icons: - dependency: "direct main" + dependency: "direct dev" description: name: flutter_launcher_icons - sha256: ce0e501cfc258907842238e4ca605e74b7fd1cdf04b3b43e86c43f3e40a1592c + sha256: "619817c4b65b322b5104b6bb6dfe6cda62d9729bd7ad4303ecc8b4e690a67a77" url: "https://pub.dev" source: hosted - version: "0.11.0" + version: "0.14.1" flutter_localizations: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" - flutter_material_pickers: - dependency: "direct main" - description: - name: flutter_material_pickers - sha256: "1907dde52e1a9ed2a8530875fd675e9e941c30612d4fdc8fb8e5fc77bd714137" - url: "https://pub.dev" - source: hosted - version: "3.5.0" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "96af49aa6b57c10a312106ad6f71deed5a754029c24789bbf620ba784f0bd0b0" + sha256: "8cf40eebf5dec866a6d1956ad7b4f7016e6c0cc69847ab946833b7d43743809f" url: "https://pub.dev" source: hosted - version: "2.0.14" - flutter_sliding_up_panel: - dependency: "direct main" - description: - name: flutter_sliding_up_panel - sha256: "94f928973d83e146bbc52051e2d9f2a7ed7a5c9e7f04b54d835fff2e41d6cb99" - url: "https://pub.dev" - source: hosted - version: "2.1.1" + version: "2.0.19" flutter_svg: dependency: "direct main" description: @@ -573,22 +485,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_widget_from_html_core: - dependency: "direct main" - description: - name: flutter_widget_from_html_core - sha256: e8f4f8b461a140ffb7c71f938bc76efc758893e7468843d9dbf70cb0b9e900cb - url: "https://pub.dev" - source: hosted - version: "0.8.5+3" - font_awesome_flutter: - dependency: transitive - description: - name: font_awesome_flutter - sha256: "275ff26905134bcb59417cf60ad979136f1f8257f2f449914b2c3e05bbb4cd6f" - url: "https://pub.dev" - source: hosted - version: "10.7.0" frontend_server_client: dependency: transitive description: @@ -597,46 +493,38 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" - fwfh_text_style: - dependency: transitive - description: - name: fwfh_text_style - sha256: f5ba5eeec7577822da5d8e1ceca00bda3bedfb946eec86538f0dba8c1092b1bb - url: "https://pub.dev" - source: hosted - version: "2.22.08" geocoding: dependency: "direct main" description: name: geocoding - sha256: e1dc0ac56666d9ed1d5a9ae5543ce9eb5986db6209cc7600103487d09192059c + sha256: "790eea732b22a08dd36fc3761bcd29040461ac20ece4d165264a6c0b5338f115" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.2.2" geocoding_android: dependency: transitive description: name: geocoding_android - sha256: "609db1d71bc364dd9d0616f72a41c01e0c74f3a3807efb85e0d5a67e57baf50f" + sha256: "1b13eca79b11c497c434678fed109c2be020b158cec7512c848c102bc7232603" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "3.3.1" geocoding_ios: dependency: transitive description: name: geocoding_ios - sha256: "8f79e380abb640ef4d88baee8bb65390058c802601158d0813dc990b36b189d2" + sha256: "8a39bfb650af55209c42e564036a550b32d029e0733af01dc66c5afea50388d3" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.0" geocoding_platform_interface: dependency: transitive description: name: geocoding_platform_interface - sha256: "8848605d307d844d89937cdb4b8ad7dfa880552078f310fa24d8a460f6dddab4" + sha256: "8c2c8226e5c276594c2e18bfe88b19110ed770aeb7c1ab50ede570be8b92229b" url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.2.0" geolocator: dependency: "direct main" description: @@ -649,42 +537,42 @@ packages: dependency: transitive description: name: geolocator_android - sha256: "06e37fa32392f69f133e166ef6b358a8b6afddbf4c418fc236988184cc115a49" + sha256: "7aefc530db47d90d0580b552df3242440a10fe60814496a979aa67aa98b1fd47" url: "https://pub.dev" source: hosted - version: "4.4.1" + version: "4.6.1" geolocator_apple: dependency: transitive description: name: geolocator_apple - sha256: ab90ae811c42ec2f6021e01eca71df00dee6ff1e69d2c2dafd4daeb0b793f73d + sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.7" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - sha256: b8cc1d3be0ca039a3f2174b0b026feab8af3610e220b8532e42cff8ec6658535 + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.2.4" geolocator_web: dependency: transitive description: name: geolocator_web - sha256: "59083f7e0871b78299918d92bf930a14377f711d2d1156c558cd5ebae6c20d58" + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.2.1" geolocator_windows: dependency: transitive description: name: geolocator_windows - sha256: a92fae29779d5c6dc60e8411302f5221ade464968fe80a36d330e80a71f087af + sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e" url: "https://pub.dev" source: hosted - version: "0.2.2" + version: "0.2.3" glob: dependency: transitive description: @@ -693,54 +581,70 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "47eef3836b49bb030d5cb3afc60b8451408bf34cf753e571b645d6529eb4251a" + url: "https://pub.dev" + source: hosted + version: "7.1.0" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - sha256: "0a7e0bd1dfe594bc86892d2e69062e3f80b267e378042d82e6b87a8efc798013" + sha256: c1972cbad779bc5346c49045f26ae45550a0958b1cbca5b524dd3c8954995d28 url: "https://pub.dev" source: hosted - version: "2.2.6" + version: "2.6.1" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android - sha256: b1aeab571b33e983ced9977f2f0eca2b25925f6319e99e3901cfc1675e1b5ada + sha256: "0bcadb80eba39afda77dede89a6caafd3b68f2786b90491eceea4a01c3db181c" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.8.0" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - sha256: "7ed57e6f1351aebf1442dea0028f2c880989ead866eaf25e9121237c622d4af0" + sha256: "753ebf6a2bc24c5eba8e714c901345d858abd9694b1f878c43614fd3f06b8060" url: "https://pub.dev" source: hosted - version: "2.1.14" + version: "2.13.1" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - sha256: a07811d2b82055815ede75e1fe4b7b76f71a0b4820b26f71bdaddd157d6a3e20 + sha256: a951981c22d790848efb9f114f81794945bc5c06bc566238a419a92f110af6cb + url: "https://pub.dev" + source: hosted + version: "2.9.5" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: f3155c12119d8a5c2732fdf39ceb5cc095bc662059a03b4ea23294ecebe1d199 url: "https://pub.dev" source: hosted - version: "2.2.6" + version: "0.5.8" html: dependency: transitive description: name: html - sha256: "58e3491f7bf0b6a4ea5110c0c688877460d1a6366731155c4a4580e7ded773e8" + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" url: "https://pub.dev" source: hosted - version: "0.15.3" + version: "0.15.4" http: dependency: "direct main" description: name: http - sha256: "6aa2946395183537c8b880962d935877325d6a09a2867c3970c05c0fed6ac482" + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" url: "https://pub.dev" source: hosted - version: "0.13.5" + version: "0.13.6" http_multi_server: dependency: transitive description: @@ -761,42 +665,42 @@ packages: dependency: transitive description: name: image - sha256: "8e9d133755c3e84c73288363e6343157c383a0c6c56fc51afcc5d4d7180306d6" + sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d url: "https://pub.dev" source: hosted - version: "3.3.0" + version: "4.3.0" image_picker: dependency: "direct main" description: name: image_picker - sha256: "1f498d086203360cca099d20ffea2963f48c39ce91bdd8a3b6d4a045786b02c8" + sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a" url: "https://pub.dev" source: hosted - version: "1.0.8" + version: "1.1.2" image_picker_android: dependency: transitive description: name: image_picker_android - sha256: "42c098e7fb6334746be37cdc30369ade356ed4f14d48b7a0313f95a9159f4321" + sha256: "0f57fee1e8bfadf8cc41818bbcd7f72e53bb768a54d9496355d5e8a5681a19f1" url: "https://pub.dev" source: hosted - version: "0.8.9+5" + version: "0.8.12+1" image_picker_for_web: dependency: transitive description: name: image_picker_for_web - sha256: e2423c53a68b579a7c37a1eda967b8ae536c3d98518e5db95ca1fe5719a730a3 + sha256: "65d94623e15372c5c51bebbcb820848d7bcb323836e12dfdba60b5d3a8b39e50" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.5" image_picker_ios: dependency: transitive description: name: image_picker_ios - sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + sha256: "4f0568120c6fcc0aaa04511cb9f9f4d29fc3d0139884b1d06be88dcec7641d6b" url: "https://pub.dev" source: hosted - version: "0.8.9+1" + version: "0.8.12+1" image_picker_linux: dependency: transitive description: @@ -817,10 +721,10 @@ packages: dependency: transitive description: name: image_picker_platform_interface - sha256: "0e827c156e3a90edd3bbe7f6de048b39247b16e58173b08a835b7eb00aba239e" + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" url: "https://pub.dev" source: hosted - version: "2.9.2" + version: "2.10.0" image_picker_windows: dependency: transitive description: @@ -873,26 +777,66 @@ packages: dependency: transitive description: name: js - sha256: a5e201311cb08bf3912ebbe9a2be096e182d703f881136ec1e81a2338a9e120d + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + js_wrapping: + dependency: transitive + description: + name: js_wrapping + sha256: e385980f7c76a8c1c9a560dfb623b890975841542471eade630b2871d243851c url: "https://pub.dev" source: hosted - version: "0.6.4" + version: "0.7.4" json_annotation: dependency: transitive description: name: json_annotation - sha256: "3520fa844009431b5d4491a5a778603520cdc399ab3406332dcc50f93547258c" + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "4.9.0" language_picker: dependency: "direct main" description: name: language_picker - sha256: "1f5293675ec1359b72979dac8f8d4662d18d6d1b0a484343367cfbbbbcfca3f3" + sha256: cace0eab53b712e26f5d2cd834a050b6dd6ab56b2ba31b3000dbe5f89f33f5fd + url: "https://pub.dev" + source: hosted + version: "0.4.5" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + list_counter: + dependency: transitive + description: + name: list_counter + sha256: c447ae3dfcd1c55f0152867090e67e219d42fe6d4f2807db4bbe8b8d69912237 url: "https://pub.dev" source: hosted - version: "0.4.3" + version: "1.0.2" logging: dependency: transitive description: @@ -905,42 +849,34 @@ packages: dependency: transitive description: name: matcher - sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb url: "https://pub.dev" source: hosted - version: "0.12.16" + version: "0.12.16+1" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.5.0" - material_segmented_control: - dependency: "direct main" - description: - name: material_segmented_control - sha256: ac87ca730875f967451bb0e8e4abd15a9785dec8ec74d24586f90607771cb3bb - url: "https://pub.dev" - source: hosted - version: "4.1.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.9.1" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.6" node_preamble: dependency: transitive description: @@ -949,22 +885,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.2" - numerus: - dependency: transitive - description: - name: numerus - sha256: "436759d84f233b40107d0cc31cfa92d24e0960afeb2e506be70926d4cddffd9e" - url: "https://pub.dev" - source: hosted - version: "2.0.0" octo_image: dependency: transitive description: name: octo_image - sha256: "45b40f99622f11901238e18d48f5f12ea36426d8eced9f4cbf58479c7aa2430d" + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.1.0" overlay_support: dependency: "direct main" description: @@ -990,13 +918,13 @@ packages: source: hosted version: "2.0.2" path: - dependency: "direct main" + dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" url: "https://pub.dev" source: hosted - version: "1.8.3" + version: "1.9.0" path_drawing: dependency: transitive description: @@ -1009,58 +937,58 @@ packages: dependency: transitive description: name: path_parsing - sha256: e3e67b1629e6f7e8100b367d3db6ba6af4b1f0bb80f64db18ef1fbabd2fa9ccf + sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca" url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" path_provider: dependency: "direct main" description: name: path_provider - sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 url: "https://pub.dev" source: hosted - version: "2.0.15" + version: "2.1.4" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "2cec049d282c7f13c594b4a73976b0b4f2d7a1838a6dd5aaf7bd9719196bee86" + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.0.27" + version: "2.2.4" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "818b2dc38b0f178e0ea3f7cf3b28146faab11375985d815942a68eee11c2d0f7" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.4.0" path_provider_linux: dependency: transitive description: name: path_provider_linux - sha256: "2ae08f2216225427e64ad224a24354221c2c7907e448e6e0e8b57b1eb9f10ad1" + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 url: "https://pub.dev" source: hosted - version: "2.1.10" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - sha256: "57585299a729335f1298b43245842678cb9f43a6310351b18fb577d6e33165ec" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.0.6" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: d3f80b32e83ec208ac95253e0cd4d298e104fbc63cb29c5c69edaed43b0c69d6 + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.3.0" pedantic: dependency: "direct dev" description: @@ -1069,102 +997,78 @@ packages: url: "https://pub.dev" source: hosted version: "1.11.1" - percent_indicator: - dependency: "direct main" - description: - name: percent_indicator - sha256: c37099ad833a883c9d71782321cb65c3a848c21b6939b6185f0ff6640d05814c - url: "https://pub.dev" - source: hosted - version: "4.2.3" permission_handler: dependency: "direct main" description: name: permission_handler - sha256: "284a66179cabdf942f838543e10413246f06424d960c92ba95c84439154fcac8" + sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb" url: "https://pub.dev" source: hosted - version: "11.0.1" + version: "11.3.1" permission_handler_android: dependency: transitive description: name: permission_handler_android - sha256: f9fddd3b46109bd69ff3f9efa5006d2d309b7aec0f3c1c5637a60a2d5659e76e + sha256: "71bbecfee799e65aff7c744761a57e817e73b738fedf62ab7afd5593da21f9f1" url: "https://pub.dev" source: hosted - version: "11.1.0" + version: "12.0.13" permission_handler_apple: dependency: transitive description: name: permission_handler_apple - sha256: "99e220bce3f8877c78e4ace901082fb29fa1b4ebde529ad0932d8d664b34f3f5" + sha256: e6f6d73b12438ef13e648c4ae56bd106ec60d17e90a59c4545db6781229082a0 + url: "https://pub.dev" + source: hosted + version: "9.4.5" + permission_handler_html: + dependency: transitive + description: + name: permission_handler_html + sha256: af26edbbb1f2674af65a8f4b56e1a6f526156bc273d0e65dd8075fab51c78851 url: "https://pub.dev" source: hosted - version: "9.1.4" + version: "0.1.3+2" permission_handler_platform_interface: dependency: transitive description: name: permission_handler_platform_interface - sha256: "6760eb5ef34589224771010805bea6054ad28453906936f843a8cc4d3a55c4a4" + sha256: e9c8eadee926c4532d0305dff94b85bf961f16759c3af791486613152af4b4f9 url: "https://pub.dev" source: hosted - version: "3.12.0" + version: "4.2.3" permission_handler_windows: dependency: transitive description: name: permission_handler_windows - sha256: cc074aace208760f1eee6aa4fae766b45d947df85bc831cde77009cdb4720098 + sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e" url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.2.1" petitparser: dependency: transitive description: name: petitparser - sha256: "2ebb289dc4764ec397f5cd3ca9881c6d17196130a7d646ed022a0dd9c2e25a71" - url: "https://pub.dev" - source: hosted - version: "5.0.0" - photo_gallery: - dependency: "direct main" - description: - name: photo_gallery - sha256: "2beaab9577f393c1711045ffdb5732234d3fecd10aa16e5c19a58ee9139905a4" + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "2.2.1" - photo_view: - dependency: "direct main" - description: - name: photo_view - sha256: "8036802a00bae2a78fc197af8a158e3e2f7b500561ed23b4c458107685e645bb" - url: "https://pub.dev" - source: hosted - version: "0.14.0" + version: "6.0.2" platform: dependency: transitive description: name: platform - sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.6" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.4" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" - url: "https://pub.dev" - source: hosted - version: "3.7.3" + version: "2.1.8" pool: dependency: transitive description: @@ -1173,14 +1077,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" - process: - dependency: transitive - description: - name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" - url: "https://pub.dev" - source: hosted - version: "4.2.4" pub_semver: dependency: transitive description: @@ -1189,6 +1085,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + url: "https://pub.dev" + source: hosted + version: "1.3.0" random_string: dependency: "direct main" description: @@ -1213,6 +1117,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.27.7" + sanitize_html: + dependency: transitive + description: + name: sanitize_html + sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989" + url: "https://pub.dev" + source: hosted + version: "2.1.0" shared_preferences: dependency: "direct main" description: @@ -1225,50 +1137,50 @@ packages: dependency: transitive description: name: shared_preferences_android - sha256: "6478c6bbbecfe9aced34c483171e90d7c078f5883558b30ec3163cf18402c749" + sha256: "1ee8bf911094a1b592de7ab29add6f826a7331fb854273d55918693d5364a1f2" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.2.2" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d" url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.5.3" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: d4ec5fc9ebb2f2e056c617112aa75dcf92fc2e4faaf2ae999caa297473f75d8a + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5" + sha256: "59dc807b94d29d52ddbb1b3c0d3b9d0a67fc535a64e62a5542c8db0513fcb6c2" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.4.1" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.4.1" shelf: dependency: transitive description: @@ -1289,10 +1201,10 @@ packages: dependency: transitive description: name: shelf_static - sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3 url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "1.1.3" shelf_web_socket: dependency: transitive description: @@ -1310,10 +1222,10 @@ packages: dependency: transitive description: name: source_map_stack_trace - sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" source_maps: dependency: transitive description: @@ -1342,34 +1254,34 @@ packages: dependency: transitive description: name: sqflite - sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.4" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" stream_transform: dependency: transitive description: @@ -1406,26 +1318,26 @@ packages: dependency: "direct dev" description: name: test - sha256: "13b41f318e2a5751c3169137103b60c584297353d4b1761b66029bae6411fe46" + sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f url: "https://pub.dev" source: hosted - version: "1.24.3" + version: "1.24.9" test_api: dependency: transitive description: name: test_api - sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.6.0" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - sha256: "99806e9e6d95c7b059b7a0fc08f07fc53fabe54a829497f0d9676299f1e8637e" + sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a url: "https://pub.dev" source: hosted - version: "0.5.3" + version: "0.5.9" textfield_tags: dependency: "direct main" description: @@ -1454,74 +1366,74 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: c512655380d241a337521703af62d2c122bf7b77a46ff7dd750092aa9433499c + sha256: "9d06212b1362abc2f0f0d78e6f09f726608c74e3b9462e8368bb03314aa8d603" url: "https://pub.dev" source: hosted - version: "6.2.4" + version: "6.3.1" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f" + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" url: "https://pub.dev" source: hosted - version: "6.2.2" + version: "6.3.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03" + sha256: e43b677296fadce447e987a2f519dcf5f6d1e527dc35d01ffab4fff5b8a7063e url: "https://pub.dev" source: hosted - version: "6.2.4" + version: "6.3.1" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.2.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" + sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4aca1e060978e19b2998ee28503f40b5ba6226819c2b5e3e4d1821e8ccd92198" + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2" + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + sha256: "44cf3aabcedde30f2dba119a9dea3b0f2672fbe6fa96e85536251d678216b3c4" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.3" uuid: dependency: "direct main" description: name: uuid - sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7 + sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "4.5.1" vector_math: dependency: transitive description: @@ -1534,10 +1446,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583 + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "11.10.0" + version: "13.0.0" watcher: dependency: transitive description: @@ -1550,18 +1462,18 @@ packages: dependency: transitive description: name: web - sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" url: "https://pub.dev" source: hosted - version: "0.1.4-beta" + version: "0.5.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.5" webkit_inspection_protocol: dependency: transitive description: @@ -1574,50 +1486,50 @@ packages: dependency: "direct main" description: name: webview_flutter - sha256: d81b68e88cc353e546afb93fb38958e3717282c5ac6e5d3be4a4aef9fc3c1413 + sha256: "6869c8786d179f929144b4a1f86e09ac0eddfe475984951ea6c634774c16b522" url: "https://pub.dev" source: hosted - version: "4.5.0" + version: "4.8.0" webview_flutter_android: dependency: transitive description: name: webview_flutter_android - sha256: "3e5f4e9d818086b0d01a66fb1ff9cc72ab0cc58c71980e3d3661c5685ea0efb0" + sha256: "0d21cfc3bfdd2e30ab2ebeced66512b91134b39e72e97b43db2d47dda1c4e53a" url: "https://pub.dev" source: hosted - version: "3.15.0" + version: "3.16.3" webview_flutter_platform_interface: dependency: transitive description: name: webview_flutter_platform_interface - sha256: dbe745ee459a16b6fec296f7565a8ef430d0d681001d8ae521898b9361854943 + sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.10.0" webview_flutter_wkwebview: dependency: transitive description: name: webview_flutter_wkwebview - sha256: "4d062ad505390ecef1c4bfb6001cd857a51e00912cc9dfb66edb1886a9ebd80c" + sha256: "9c62cc46fa4f2d41e10ab81014c1de470a6c6f26051a2de32111b2ee55287feb" url: "https://pub.dev" source: hosted - version: "3.10.2" + version: "3.14.0" win32: dependency: transitive description: name: win32 - sha256: "5a751eddf9db89b3e5f9d50c20ab8612296e4e8db69009788d6c8b060a84191c" + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "4.1.4" + version: "5.5.0" win32_registry: dependency: transitive description: name: win32_registry - sha256: "1c52f994bdccb77103a6231ad4ea331a244dbcef5d1f37d8462f713143b0bfae" + sha256: "10589e0d7f4e053f2c61023a31c9ce01146656a70b7b7f0828c0b46d7da2a9bb" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.3" workmanager: dependency: "direct main" description: @@ -1630,26 +1542,26 @@ packages: dependency: transitive description: name: xdg_directories - sha256: ee1505df1426458f7f60aac270645098d318a8b4766d85fde75f76f2e21807d1 + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.1.0" xml: dependency: transitive description: name: xml - sha256: ac0e3f4bf00ba2708c33fbabbbe766300e509f8c82dbd4ab6525039813f7e2fb + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "6.5.0" yaml: dependency: transitive description: name: yaml - sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: - dart: ">=3.1.2 <4.0.0" - flutter: ">=3.13.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.19.0" diff --git a/pubspec.yaml b/pubspec.yaml index 91f6d32b..c02e519f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,63 +3,52 @@ description: A new Flutter project. version: 2.3.0+1732 environment: - sdk: '>=2.15.0 <3.0.0' + sdk: '>=2.15.0 <4.0.0' dependencies: + app_tracking_transparency: ^2.0.6 + auto_size_text: ^3.0.0 + badges: ^3.1.2 + battery_plus: ^6.0.0 + cached_network_image: ^3.3.1 + connectivity: ^3.0.6 + device_info_plus: ^9.1.2 + dio: ^5.7.0 + firebase_auth: ^4.16.0 + firebase_core: ^2.32.0 + firebase_messaging: ^14.7.10 flutter: sdk: flutter - cupertino_icons: ^1.0.5 + flutter_html: ^3.0.0-alpha.6 flutter_svg: ^1.1.6 - google_maps_flutter: ^2.2.6 - material_segmented_control: ^4.1.1 - path_provider: ^2.0.15 - path: ^1.8.1 - uuid: ^4.1.0 - shared_preferences: ^2.2.3 + geocoding: ^2.2.2 + geolocator: ^10.1.1 + google_maps_flutter: ^2.6.1 http: ^0.13.5 + image_picker: ^1.1.2 + in_app_review: ^2.0.9 + intro_slider: ^3.0.10 + language_picker: ^0.4.5 + overlay_support: ^2.1.0 + package_info: ^2.0.2 + path_provider: ^2.1.4 + permission_handler: ^11.3.1 random_string: ^2.3.1 - geolocator: ^10.1.1 - geocoding: ^2.1.1 - dio: ^5.3.3 - image_picker: ^1.0.8 - firebase_auth: ^4.3.1 - firebase_messaging: ^14.3.0 - firebase_core: ^2.8.0 - auto_size_text: ^3.0.0 - file_picker: ^5.2.10 - device_info_plus: ^9.1.2 - package_info: ^2.0.2 #Discontinued - flutter_launcher_icons: ^0.11.0 + shared_preferences: ^2.2.3 + textfield_tags: ^3.0.1 url_launcher: ^6.2.4 - photo_view: ^0.14.0 - percent_indicator: ^4.2.3 - flutter_widget_from_html_core: ^0.8.5+3 - intro_slider: ^3.0.5 - flutter_material_pickers: ^3.3.0 - permission_handler: ^11.0.1 - language_picker: ^0.4.3 - connectivity: ^3.0.6 #Discontinued - overlay_support: ^2.1.0 - app_tracking_transparency: ^2.0.4 - - flutter_html: ^3.0.0-alpha.6 - webview_flutter: ^4.5.0 + uuid: ^4.5.1 + webview_flutter: ^4.8.0 workmanager: ^0.5.2 - battery_plus: ^2.1.4+1 - badges: ^3.1.2 - cached_network_image: ^3.3.1 - camera_camera: ^3.0.0 - flutter_sliding_up_panel: ^2.1.1 - photo_gallery: ^2.2.1 - textfield_tags: ^3.0.1 - in_app_review: ^2.0.9 dev_dependencies: - pedantic: ^1.11.1 #Discontinued - flutter_test: - sdk: flutter + dependency_validator: ^4.1.1 + flutter_launcher_icons: ^0.14.1 flutter_localizations: sdk: flutter + flutter_test: + sdk: flutter + pedantic: ^1.11.1 test: ^1.24.3 flutter_icons: @@ -84,10 +73,11 @@ flutter: - assets/config/ fonts: - - family: Rubik + - family: Nunito fonts: - - asset: assets/fonts/Rubik-Regular.ttf - - asset: assets/fonts/Rubik-Medium.ttf + - asset: assets/fonts/Nunito-Regular.ttf + weight: 400 + - asset: assets/fonts/Nunito-Medium.ttf weight: 500 - - asset: assets/fonts/Rubik-Bold.ttf + - asset: assets/fonts/Nunito-Bold.ttf weight: 700