From 2c27e4feb49b91edce24f535cf141a2e23d25afe Mon Sep 17 00:00:00 2001 From: Tamojit Ghosh Date: Sun, 31 Dec 2023 09:47:49 +0530 Subject: [PATCH 1/3] changed the Flutter, Kotlin version, and few dependency libraries --- android/app/build.gradle | 8 ++++---- android/build.gradle | 8 ++++---- pubspec.yaml | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1e4fad4c..c3492bd3 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,8 +26,8 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle" android { - compileSdkVersion 31 - buildToolsVersion '29.0.0' + compileSdkVersion 32 + buildToolsVersion '33.0.0' sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -37,7 +37,7 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.example.beacon" minSdkVersion 23 - targetSdkVersion 30 + targetSdkVersion 32 multiDexEnabled true versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -58,5 +58,5 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" - implementation "com.android.support:multidex:1.0.3" + implementation "androidx.multidex:multidex:2.0.1" } diff --git a/android/build.gradle b/android/build.gradle index cc0001f9..aaeaecdd 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,12 +1,12 @@ buildscript { - ext.kotlin_version = '1.6.10' + ext.kotlin_version = '1.7.10' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:7.1.0' + classpath 'com.android.tools.build:gradle:7.4.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } configurations.all { resolutionStrategy { diff --git a/pubspec.yaml b/pubspec.yaml index 14837f45..5bb6c043 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,14 +6,14 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=3.2.3 <4.0.0" dependencies: connectivity_plus: ^3.0.2 cupertino_icons: ^1.0.2 - data_connection_checker: ^0.3.4 + connectivity: ^3.0.6 date_time_picker: ^2.1.0 - duration_picker: ^1.1.0+1 + duration_picker: ^1.1.1 flutter: sdk: flutter flutter_animarker: ^3.2.0 @@ -21,24 +21,24 @@ dependencies: flutter_countdown_timer: ^4.1.0 flutter_local_notifications: ^13.0.0 flutter_polyline_points: ^1.0.0 - flutter_spinkit: ^5.1.0 + flutter_spinkit: ^5.2.0 fluttertoast: ^8.0.8 geocoder: git: url: https://github.com/nguyenxdat/flutter_geocoder.git ref: 443b875d8ec80ce525cc6e8f17dfbbbbe7fa3028 geolocator: ^9.0.2 - get_it: ^7.2.0 + get_it: ^7.6.4 google_maps_flutter: ^2.0.5 graphql_flutter: ^5.1.0 hive: ^2.0.4 - intl: ^0.17.0 + intl: ^0.19.0 location: ^4.3.0 mockito: ^5.3.2 - modal_progress_hud: ^0.1.3 - overlay_support: ^2.0.1 + modal_progress_hud_nsn: ^0.4.0 + overlay_support: ^2.1.0 path_provider: ^2.0.9 - provider: ^6.0.3 + pprovider: ^6.1.1 rxdart: ^0.27.3 share_plus: ^6.3.0 shared_preferences: ^2.0.13 From 7e5462eddddec555b5f3aff3ca062608474af4db Mon Sep 17 00:00:00 2001 From: afjal1 Date: Fri, 9 Feb 2024 01:18:31 +0530 Subject: [PATCH 2/3] Added Null Support and Latest Flutter version --- android/app/build.gradle | 2 +- android/build.gradle | 2 +- lib/components/active_beacon.dart | 20 +- lib/components/beacon_card.dart | 50 +- lib/components/create_join_dialog.dart | 26 +- lib/components/group_card.dart | 22 +- lib/components/hike_button.dart | 24 +- lib/components/hike_screen_widget.dart | 56 +- lib/components/loading_screen.dart | 2 +- lib/components/timer.dart | 20 +- lib/main.dart | 4 +- lib/models/beacon/beacon.dart | 22 +- lib/models/beacon/beacon.g.dart | 6 +- lib/models/group/group.dart | 12 +- lib/models/group/group.g.dart | 4 +- lib/models/landmarks/landmark.dart | 4 +- lib/models/location/location.dart | 4 +- lib/models/user/user_info.dart | 20 +- lib/models/user/user_info.g.dart | 4 +- lib/router.dart | 4 +- lib/services/connection_checker.dart | 2 +- lib/services/database_mutation_functions.dart | 207 +++-- lib/services/graphql_config.dart | 2 +- lib/services/hive_localdb.dart | 36 +- lib/services/local_notification.dart | 12 +- lib/services/navigation_service.dart | 13 +- lib/services/shared_preference_service.dart | 8 +- lib/services/size_config.dart | 36 +- lib/services/user_config.dart | 6 +- lib/services/validators.dart | 17 +- lib/splash_screen.dart | 50 +- lib/utilities/indication_painter.dart | 28 +- lib/view_model/auth_screen_model.dart | 10 +- lib/view_model/group_screen_view_model.dart | 97 +- lib/view_model/hike_screen_model.dart | 141 ++- lib/view_model/home_screen_view_model.dart | 43 +- lib/views/auth_screen.dart | 88 +- lib/views/base_view.dart | 14 +- lib/views/group_screen.dart | 45 +- lib/views/hike_screen.dart | 54 +- lib/views/home_screen.dart | 100 ++- pubspec.lock | 840 +++++++++++------- pubspec.yaml | 56 +- test/model_tests/beacon_test.dart | 20 +- test/model_tests/user_test.dart | 52 +- 45 files changed, 1236 insertions(+), 1049 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 1e4fad4c..9572626d 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" apply from: project(':flutter_config').projectDir.getPath() + "/dotenv.gradle" android { - compileSdkVersion 31 + compileSdkVersion 33 buildToolsVersion '29.0.0' sourceSets { diff --git a/android/build.gradle b/android/build.gradle index cc0001f9..4c5995dc 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -31,6 +31,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/lib/components/active_beacon.dart b/lib/components/active_beacon.dart index 2ef99825..489a6012 100644 --- a/lib/components/active_beacon.dart +++ b/lib/components/active_beacon.dart @@ -6,36 +6,36 @@ class BlinkIcon extends StatefulWidget { } class _BlinkIconState extends State with TickerProviderStateMixin { - AnimationController _controller; - Animation _colorAnimation; + AnimationController? _controller; + Animation? _colorAnimation; @override void initState() { _controller = AnimationController(vsync: this, duration: Duration(milliseconds: 700)); _colorAnimation = ColorTween( begin: Color(0xFF30c295), end: Colors.transparent) - .animate(CurvedAnimation(parent: _controller, curve: Curves.linear)); - _controller.addStatusListener((status) { + .animate(CurvedAnimation(parent: _controller!, curve: Curves.linear)); + _controller!.addStatusListener((status) { if (status == AnimationStatus.completed) { - _controller.reverse(); + _controller!.reverse(); } else if (status == AnimationStatus.dismissed) { - _controller.forward(); + _controller!.forward(); } setState(() {}); }); - _controller.forward(); + _controller!.forward(); super.initState(); } @override Widget build(BuildContext context) { return AnimatedBuilder( - animation: _controller, + animation: _controller!, builder: (context, child) { return Icon( Icons.circle, size: 10, - color: _colorAnimation.value, + color: _colorAnimation!.value, ); }, ); @@ -43,7 +43,7 @@ class _BlinkIconState extends State with TickerProviderStateMixin { @override void dispose() { - _controller.dispose(); + _controller!.dispose(); super.dispose(); } } diff --git a/lib/components/beacon_card.dart b/lib/components/beacon_card.dart index 4cdb9526..f2f96032 100644 --- a/lib/components/beacon_card.dart +++ b/lib/components/beacon_card.dart @@ -17,43 +17,43 @@ class BeaconCustomWidgets { bool hasEnded; bool willStart; hasStarted = DateTime.now() - .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)); + .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)); hasEnded = DateTime.now() - .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)); + .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)); willStart = DateTime.now() - .isBefore(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)); + .isBefore(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)); return GestureDetector( onTap: () async { bool isJoinee = false; - for (var i in beacon.followers) { + for (var i in beacon.followers!) { if (i.id == userConfig.currentUser.id) { isJoinee = true; } } if (!hasStarted) { navigationService.showSnackBar( - 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', + 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', ); return; } if (hasStarted && - (beacon.leader.id == userConfig.currentUser.id || isJoinee)) { + (beacon.leader?.id == userConfig.currentUser.id || isJoinee)) { navigationService.pushScreen('/hikeScreen', arguments: HikeScreen( beacon, - isLeader: (beacon.leader.id == userConfig.currentUser.id), + isLeader: (beacon.leader!.id == userConfig.currentUser.id), )); } else { await databaseFunctions.init(); - final Beacon _beacon = - await databaseFunctions.joinBeacon(beacon.shortcode); + final Beacon? _beacon = + await databaseFunctions.joinBeacon(beacon.shortcode!); if (!hasStarted) { navigationService.showSnackBar( - 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', + 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', ); return; } - if (hasStarted && _beacon != null) { + if (hasStarted) { navigationService.pushScreen('/hikeScreen', arguments: HikeScreen(beacon, isLeader: false)); } @@ -80,7 +80,7 @@ class BeaconCustomWidgets { Container( width: 70.w, child: Text( - '${beacon?.title} by ${beacon.leader.name} ', + '${beacon.title} by ${beacon.leader!.name!} ', style: Style.titleTextStyle, ), ), @@ -108,18 +108,18 @@ class BeaconCustomWidgets { ), ), SizedBox(height: 4.0), - Text('Passkey: ${beacon?.shortcode}', + Text('Passkey: ${beacon.shortcode}', style: Style.commonTextStyle), SizedBox(height: 4.0), (beacon.startsAt != null) ? Text( - 'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', + 'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', style: Style.commonTextStyle) : Container(), SizedBox(height: 4.0), (beacon.expiresAt != null) ? Text( - 'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)).toString()}', + 'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)).toString()}', style: Style.commonTextStyle) : Container(), ], @@ -134,7 +134,7 @@ class BeaconCustomWidgets { Container( width: 70.w, child: Text( - '${beacon?.title} by ${beacon.leader.name} ', + '${beacon.title} by ${beacon.leader!.name} ', style: Style.titleTextStyle, ), ), @@ -179,25 +179,25 @@ class BeaconCustomWidgets { ), CountdownTimerPage( dateTime: DateTime.fromMillisecondsSinceEpoch( - beacon.startsAt), - name: beacon?.title, + beacon.startsAt!), + name: beacon.title, beacon: beacon, ) ], ), SizedBox(height: 4.0), - Text('Passkey: ${beacon?.shortcode}', + Text('Passkey: ${beacon.shortcode}', style: Style.commonTextStyle), SizedBox(height: 4.0), (beacon.startsAt != null) ? Text( - 'Starts At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', + 'Starts At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', style: Style.commonTextStyle) : Container(), SizedBox(height: 4.0), (beacon.expiresAt != null) ? Text( - 'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)).toString()}', + 'Expires At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)).toString()}', style: Style.commonTextStyle) : Container(), ], @@ -208,7 +208,7 @@ class BeaconCustomWidgets { Container( width: 70.w, child: Text( - '${beacon?.title} by ${beacon.leader.name} ', + '${beacon.title} by ${beacon.leader!.name} ', style: Style.titleTextStyle, ), ), @@ -230,18 +230,18 @@ class BeaconCustomWidgets { ), ), SizedBox(height: 4.0), - Text('Passkey: ${beacon?.shortcode}', + Text('Passkey: ${beacon.shortcode}', style: Style.commonTextStyle), SizedBox(height: 4.0), (beacon.startsAt != null) ? Text( - 'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', + 'Started At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', style: Style.commonTextStyle) : Container(), SizedBox(height: 4.0), (beacon.expiresAt != null) ? Text( - 'Expired At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt)).toString()}', + 'Expired At: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!)).toString()}', style: Style.commonTextStyle) : Container(), ], diff --git a/lib/components/create_join_dialog.dart b/lib/components/create_join_dialog.dart index 5eca5a3b..a7643a9e 100644 --- a/lib/components/create_join_dialog.dart +++ b/lib/components/create_join_dialog.dart @@ -37,7 +37,7 @@ class CreateJoinGroupDialog { child: TextFormField( style: TextStyle(fontSize: 22.0), validator: (value) => - Validator.validateBeaconTitle(value), + Validator.validateBeaconTitle(value!), onChanged: (name) { model.title = name; }, @@ -109,7 +109,7 @@ class CreateJoinGroupDialog { keyboardType: TextInputType.text, textCapitalization: TextCapitalization.characters, style: TextStyle(fontSize: 22.0), - validator: (value) => Validator.validatePasskey(value), + validator: (value) => Validator.validatePasskey(value!), onChanged: (key) { model.enteredGroupCode = key.toUpperCase(); }, @@ -186,7 +186,7 @@ class CreateJoinBeaconDialog { child: TextFormField( style: TextStyle(fontSize: 22.0), validator: (value) => - Validator.validateBeaconTitle(value), + Validator.validateBeaconTitle(value!), onChanged: (name) { model.title = name; }, @@ -231,7 +231,7 @@ class CreateJoinBeaconDialog { surface: kBlue, ), ), - child: child), + child: child!), ); model.startsAtDate.text = model.startingdate .toString() @@ -302,7 +302,7 @@ class CreateJoinBeaconDialog { ), ), // This will change to light theme. - child: child, + child: child!, ); }, ); @@ -352,7 +352,7 @@ class CreateJoinBeaconDialog { await showDurationPicker( context: context, initialTime: model.resultingDuration != null - ? model.resultingDuration + ? model.resultingDuration! : Duration(minutes: 30), decoration: BoxDecoration( color: Colors.white, @@ -414,14 +414,14 @@ class CreateJoinBeaconDialog { return; } model.startsAt = DateTime( - model.startingdate.year, - model.startingdate.month, - model.startingdate.day, - model.startingTime.hour, - model.startingTime.minute, + model.startingdate!.year, + model.startingdate!.month, + model.startingdate!.day, + model.startingTime!.hour, + model.startingTime!.minute, ); // localNotif.scheduleNotification(); - if (model.startsAt.isBefore(DateTime.now())) { + if (model.startsAt!.isBefore(DateTime.now())) { navigationService.showSnackBar( "Enter a valid date and time!!"); return; @@ -465,7 +465,7 @@ class CreateJoinBeaconDialog { keyboardType: TextInputType.text, textCapitalization: TextCapitalization.characters, style: TextStyle(fontSize: 22.0), - validator: (value) => Validator.validatePasskey(value), + validator: (value) => Validator.validatePasskey(value!), onChanged: (key) { model.enteredPasskey = key.toUpperCase(); }, diff --git a/lib/components/group_card.dart b/lib/components/group_card.dart index b6eb46d1..555b831a 100644 --- a/lib/components/group_card.dart +++ b/lib/components/group_card.dart @@ -11,29 +11,27 @@ class GroupCustomWidgets { static final Color textColor = Color(0xFFAFAFAF); static Widget getGroupCard(BuildContext context, Group group) { - String noMembers = group.members.length.toString(); - String noBeacons = group.beacons.length.toString(); + String noMembers = group.members!.length.toString(); + String noBeacons = group.beacons!.length.toString(); return GestureDetector( onTap: () async { bool isMember = false; - for (var i in group.members) { + for (var i in group.members!) { if (i.id == userConfig.currentUser.id) { isMember = true; } } - if (group.leader.id == userConfig.currentUser.id || isMember) { + if (group.leader!.id == userConfig.currentUser.id || isMember) { navigationService.pushScreen('/groupScreen', arguments: GroupScreen( group, )); } else { await databaseFunctions.init(); - final Group _group = - await databaseFunctions.joinGroup(group.shortcode); - if (_group != null) { - navigationService.pushScreen('/groupScreen', - arguments: GroupScreen(group)); - } + final Group? _group = + await databaseFunctions.joinGroup(group.shortcode!); + navigationService.pushScreen('/groupScreen', + arguments: GroupScreen(group)); //Snackbar is displayed by joinBeacon itself on any error or trying to join expired beacon. } }, @@ -53,7 +51,7 @@ class GroupCustomWidgets { Container( width: 70.w, child: Text( - '${group?.title} by ${group.leader.name} ', + '${group.title} by ${group.leader!.name} ', style: Style.titleTextStyle, ), ), @@ -68,7 +66,7 @@ class GroupCustomWidgets { style: Style.commonTextStyle, ), SizedBox(height: 4.0), - Text('Passkey: ${group?.shortcode}', + Text('Passkey: ${group.shortcode}', style: Style.commonTextStyle), ], ), diff --git a/lib/components/hike_button.dart b/lib/components/hike_button.dart index 23136356..14c5f4f8 100644 --- a/lib/components/hike_button.dart +++ b/lib/components/hike_button.dart @@ -2,14 +2,14 @@ import 'package:beacon/utilities/constants.dart'; import 'package:flutter/material.dart'; class HikeButton extends StatelessWidget { - final Function onTap; - final String text; - final double textSize; - final Color textColor; - final Color borderColor; - final Color buttonColor; - final double buttonWidth; - final double buttonHeight; + final Function? onTap; + final String? text; + final double? textSize; + final Color? textColor; + final Color? borderColor; + final Color? buttonColor; + final double? buttonWidth; + final double? buttonHeight; HikeButton( {this.onTap, this.borderColor = Colors.white, @@ -27,17 +27,17 @@ class HikeButton extends StatelessWidget { backgroundColor: buttonColor, shape: RoundedRectangleBorder( borderRadius: new BorderRadius.circular(50.0), - side: BorderSide(color: borderColor)), + side: BorderSide(color: borderColor!)), ), child: Padding( padding: EdgeInsets.symmetric( - horizontal: buttonWidth, vertical: buttonHeight), + horizontal: buttonWidth!, vertical: buttonHeight!), child: Text( - text, + text!, style: TextStyle(color: textColor, fontSize: textSize), ), ), - onPressed: onTap, + onPressed: onTap!(), ); } } diff --git a/lib/components/hike_screen_widget.dart b/lib/components/hike_screen_widget.dart index d3ab5121..e0c075d9 100644 --- a/lib/components/hike_screen_widget.dart +++ b/lib/components/hike_screen_widget.dart @@ -109,8 +109,7 @@ class HikeScreenWidget extends ChangeNotifier { onPressed: () async { final mapController = await googleMapControllerCompleter.future; // sanity check. - if (mapController == null || - googleMapControllerCompleter.isCompleted == false) return; + if (googleMapControllerCompleter.isCompleted == false) return; if (!await connectionChecker.checkForInternetConnection()) { navigationService.showSnackBar( 'Cannot share the route, please check your internet connection.'); @@ -125,7 +124,7 @@ class HikeScreenWidget extends ChangeNotifier { // Creating a file for the image. File imageFile = await File('${appDir.path}/shareImage.png').create(); //writing the image to the file we just created so that it can be shared. - imageFile.writeAsBytesSync(image); + imageFile.writeAsBytesSync(image!); // initial coordinates Coordinates coordinates = Coordinates( beaconRoute.first.latitude, @@ -144,7 +143,7 @@ class HikeScreenWidget extends ChangeNotifier { await Geocoder.local.findAddressesFromCoordinates(coordinates); // All the neccessary info should be here. String textToShare = - "${beacon.title} Beacon started at: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()} from: ${initialAddress.first.addressLine}.\n\nIt will end on: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}.\n\nBeacon's current location is: ${currentAddress.first.addressLine}.\n\nBeacon's current leader is: ${beacon.leader.name}.\n\nTo join this beacon, enter this code in the app: ${beacon.shortcode}.\nYou can also join the beacon by clicking the following link: https://beacon.aadibajpai.com/?shortcode=${beacon.shortcode}"; + "${beacon.title} Beacon started at: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()} from: ${initialAddress.first.addressLine}.\n\nIt will end on: ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}.\n\nBeacon's current location is: ${currentAddress.first.addressLine}.\n\nBeacon's current leader is: ${beacon.leader!.name}.\n\nTo join this beacon, enter this code in the app: ${beacon.shortcode}.\nYou can also join the beacon by clicking the following link: https://beacon.aadibajpai.com/?shortcode=${beacon.shortcode}"; //Will be used as subject if shared via email, else isnt used. String subjectToShare = "${beacon.title} beacons's route"; await Share.shareXFiles([XFile(imageFile.path)], @@ -219,11 +218,11 @@ class HikeScreenWidget extends ChangeNotifier { return ListTile( onLongPress: () async { model.relayBeacon( - model.hikers[index].name, model.hikers[index].id); + model.hikers[index].name!, model.hikers[index].id!); }, leading: CircleAvatar( backgroundColor: - model.isBeaconExpired ? Colors.grey : kYellow, + model.isBeaconExpired! ? Colors.grey : kYellow, radius: 18, child: ClipRRect( borderRadius: BorderRadius.circular(50), @@ -234,30 +233,31 @@ class HikeScreenWidget extends ChangeNotifier { ), ), title: Text( - model.hikers[index].name, + model.hikers[index].name!, style: TextStyle(color: Colors.black, fontSize: 18), ), - trailing: model.hikers[index].id == model.beacon.leader.id - ? GestureDetector( - onDoubleTap: () { - isLeader - ? Fluttertoast.showToast( - msg: - 'Only beacon holder has access to change the duration') - //TODO: enable this once backend has updated. - //Commented, since we dont have the neccessary mutation atm on backend to change the duration. - // : DialogBoxes.changeDurationDialog(context); - : Container(); - }, - child: Icon( - Icons.room, - color: model.isBeaconExpired - ? Colors.grey - : kYellow, - size: 40, - ), - ) - : Container(width: 10), + trailing: + model.hikers[index].id == model.beacon!.leader!.id + ? GestureDetector( + onDoubleTap: () { + isLeader + ? Fluttertoast.showToast( + msg: + 'Only beacon holder has access to change the duration') + //TODO: enable this once backend has updated. + //Commented, since we dont have the neccessary mutation atm on backend to change the duration. + // : DialogBoxes.changeDurationDialog(context); + : Container(); + }, + child: Icon( + Icons.room, + color: model.isBeaconExpired! + ? Colors.grey + : kYellow, + size: 40, + ), + ) + : Container(width: 10), ); }, ), diff --git a/lib/components/loading_screen.dart b/lib/components/loading_screen.dart index 7633bc75..bfc930dc 100644 --- a/lib/components/loading_screen.dart +++ b/lib/components/loading_screen.dart @@ -4,7 +4,7 @@ import 'package:flutter_spinkit/flutter_spinkit.dart'; import '../utilities/constants.dart'; class LoadingScreen extends StatelessWidget { - const LoadingScreen({Key key}) : super(key: key); + const LoadingScreen({Key? key}) : super(key: key); @override Widget build(BuildContext context) { diff --git a/lib/components/timer.dart b/lib/components/timer.dart index adbb3493..5369dde2 100644 --- a/lib/components/timer.dart +++ b/lib/components/timer.dart @@ -6,11 +6,11 @@ import 'package:flutter/material.dart'; import 'package:flutter_countdown_timer/index.dart'; class CountdownTimerPage extends StatefulWidget { - final String name; - final DateTime dateTime; - final Beacon beacon; + final String? name; + final DateTime? dateTime; + final Beacon? beacon; CountdownTimerPage( - {Key key, + {Key? key, @required this.dateTime, @required this.name, @required this.beacon}) @@ -21,13 +21,13 @@ class CountdownTimerPage extends StatefulWidget { class _CountdownTimerPageState extends State with SingleTickerProviderStateMixin { - CountdownTimerController controller; + CountdownTimerController? controller; int endTime = 0; @override void initState() { super.initState(); setState(() {}); - int timeDiff = widget.dateTime.difference(DateTime.now()).inSeconds; + int timeDiff = widget.dateTime!.difference(DateTime.now()).inSeconds; setState(() { endTime = DateTime.now().millisecondsSinceEpoch + 1000 * timeDiff; }); @@ -56,7 +56,7 @@ class _CountdownTimerPageState extends State label: 'Click to Join', onPressed: () async { bool isLeader = - widget.beacon.leader.id == userConfig.currentUser.id; + widget.beacon!.leader!.id == userConfig.currentUser.id; navigationService.pushScreen( '/hikeScreen', arguments: HikeScreen(widget.beacon, isLeader: isLeader), @@ -71,9 +71,9 @@ class _CountdownTimerPageState extends State Widget build(BuildContext context) { return CountdownTimer( controller: controller, - widgetBuilder: (_, CurrentRemainingTime time) { + widgetBuilder: (_, time) { return Text( - '${time?.days ?? 0} : ${time?.hours ?? 0} : ${time?.min ?? 0} : ${time?.sec ?? 0}', + '${time!.days ?? 0} : ${time.hours ?? 0} : ${time.min ?? 0} : ${time.sec ?? 0}', style: TextStyle( color: const Color(0xffb6b2df), fontSize: 14.0, @@ -85,7 +85,7 @@ class _CountdownTimerPageState extends State @override void dispose() { - controller.dispose(); + controller!.dispose(); super.dispose(); } } diff --git a/lib/main.dart b/lib/main.dart index f4c42bb3..a880a0e2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,7 +35,7 @@ void main() async { } class DemoPageView extends StatelessWidget { - const DemoPageView({@required Key key}) : super(key: key); + const DemoPageView({@required Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -45,7 +45,7 @@ class DemoPageView extends StatelessWidget { title: const Text('Demo Page'), ), body: Container( - child: Text(model.title), + child: Text(model!.title), ), ), ); diff --git a/lib/models/beacon/beacon.dart b/lib/models/beacon/beacon.dart index f260258f..048aac52 100644 --- a/lib/models/beacon/beacon.dart +++ b/lib/models/beacon/beacon.dart @@ -57,27 +57,27 @@ class Beacon extends HiveObject { } @HiveField(0) - String id; + String? id; @HiveField(1) - String shortcode; + String? shortcode; @HiveField(2) - int startsAt; + int? startsAt; @HiveField(3) - int expiresAt; + int? expiresAt; @HiveField(4) - User leader; + User? leader; @HiveField(5) - List followers = []; + List? followers = []; @HiveField(6) - List route = []; + List? route = []; @HiveField(7) - String title; + String? title; @HiveField(8) - List landmarks = []; + List? landmarks = []; @HiveField(9) - Location location; + Location? location; @HiveField(10) - String group; + String? group; print() { debugPrint('shortCode: ${this.shortcode}'); diff --git a/lib/models/beacon/beacon.g.dart b/lib/models/beacon/beacon.g.dart index 391c1167..58848db4 100644 --- a/lib/models/beacon/beacon.g.dart +++ b/lib/models/beacon/beacon.g.dart @@ -23,9 +23,9 @@ class BeaconAdapter extends TypeAdapter { expiresAt: fields[3] as int, title: fields[7] as String, leader: fields[4] as User, - followers: (fields[5] as List)?.cast(), - route: (fields[6] as List)?.cast(), - landmarks: (fields[8] as List)?.cast(), + followers: (fields[5] as List).cast(), + route: (fields[6] as List).cast(), + landmarks: (fields[8] as List).cast(), location: fields[9] as Location, group: fields[10] as String, ); diff --git a/lib/models/group/group.dart b/lib/models/group/group.dart index c6832ed3..d89fe87c 100644 --- a/lib/models/group/group.dart +++ b/lib/models/group/group.dart @@ -39,17 +39,17 @@ class Group extends HiveObject { } @HiveField(0) - String id; + String? id; @HiveField(1) - String title; + String? title; @HiveField(2) - String shortcode; + String? shortcode; @HiveField(3) - User leader; + User? leader; @HiveField(4) - List members = []; + List? members = []; @HiveField(5) - List beacons = []; + List? beacons = []; print() { debugPrint('shortCode: ${this.shortcode}'); diff --git a/lib/models/group/group.g.dart b/lib/models/group/group.g.dart index 6b088374..275a4348 100644 --- a/lib/models/group/group.g.dart +++ b/lib/models/group/group.g.dart @@ -21,8 +21,8 @@ class GroupAdapter extends TypeAdapter { shortcode: fields[2] as String, title: fields[1] as String, leader: fields[3] as User, - members: (fields[4] as List)?.cast(), - beacons: (fields[5] as List)?.cast(), + members: (fields[4] as List).cast(), + beacons: (fields[5] as List).cast(), ); } diff --git a/lib/models/landmarks/landmark.dart b/lib/models/landmarks/landmark.dart index 96bafb6f..aa048e3e 100644 --- a/lib/models/landmarks/landmark.dart +++ b/lib/models/landmarks/landmark.dart @@ -17,9 +17,9 @@ class Landmark extends HiveObject { } @HiveField(0) - String title; + String? title; @HiveField(1) - Location location; + Location? location; print() { debugPrint('title: ${this.title}'); diff --git a/lib/models/location/location.dart b/lib/models/location/location.dart index db09e835..f5f26efc 100644 --- a/lib/models/location/location.dart +++ b/lib/models/location/location.dart @@ -14,9 +14,9 @@ class Location extends HiveObject { } @HiveField(0) - String lat; + String? lat; @HiveField(1) - String lon; + String? lon; print() { debugPrint('lat: ${this.lat}'); diff --git a/lib/models/user/user_info.dart b/lib/models/user/user_info.dart index 57901cfe..bb1ffda7 100644 --- a/lib/models/user/user_info.dart +++ b/lib/models/user/user_info.dart @@ -40,21 +40,21 @@ class User extends HiveObject { } @HiveField(0) - String id; + String? id; @HiveField(1) - String authToken; + String? authToken; @HiveField(2) - String name; + String? name; @HiveField(3) - String email; + String? email; @HiveField(4) - List beacon = []; + List? beacon = []; @HiveField(5) - List groups = []; + List? groups = []; @HiveField(6) - Location location; + Location? location; @HiveField(7) - bool isGuest = false; + bool? isGuest = false; print() { debugPrint('authToken: ${this.authToken}'); @@ -66,10 +66,6 @@ class User extends HiveObject { debugPrint('groups: ${this.groups}'); } - // updateBeacon(List beaconList) { - // this.beacon = beaconList; - // } - update(User details) { this.authToken = details.authToken; this.name = details.name; diff --git a/lib/models/user/user_info.g.dart b/lib/models/user/user_info.g.dart index 22bcbc77..baec16e5 100644 --- a/lib/models/user/user_info.g.dart +++ b/lib/models/user/user_info.g.dart @@ -21,8 +21,8 @@ class UserAdapter extends TypeAdapter { email: fields[3] as String, name: fields[2] as String, location: fields[6] as Location, - beacon: (fields[4] as List)?.cast(), - groups: (fields[5] as List)?.cast(), + beacon: (fields[4] as List).cast(), + groups: (fields[5] as List).cast(), id: fields[0] as String, isGuest: fields[7] as bool, ); diff --git a/lib/router.dart b/lib/router.dart index 7b568bb4..ee4adc41 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -15,14 +15,14 @@ Route generateRoute(RouteSettings settings) { return MaterialPageRoute( builder: (context) => const MainScreen(key: Key('MainScreen'))); case Routes.hikeScreen: - HikeScreen arguments = settings.arguments; + HikeScreen arguments = settings.arguments as HikeScreen; return MaterialPageRoute( builder: (context) => HikeScreen( arguments.beacon, isLeader: arguments.isLeader, )); case Routes.groupScreen: - GroupScreen arguments = settings.arguments; + GroupScreen arguments = settings.arguments as GroupScreen; return MaterialPageRoute( builder: (context) => GroupScreen( arguments.group, diff --git a/lib/services/connection_checker.dart b/lib/services/connection_checker.dart index 483e72fa..e35510de 100644 --- a/lib/services/connection_checker.dart +++ b/lib/services/connection_checker.dart @@ -1,4 +1,4 @@ -import 'package:data_connection_checker/data_connection_checker.dart'; +import 'package:data_connection_checker_nulls/data_connection_checker_nulls.dart'; class ConnectionChecker { Future checkForInternetConnection() async { diff --git a/lib/services/database_mutation_functions.dart b/lib/services/database_mutation_functions.dart index 8cfd7b53..2a237b6c 100644 --- a/lib/services/database_mutation_functions.dart +++ b/lib/services/database_mutation_functions.dart @@ -15,11 +15,11 @@ import '../locator.dart'; import '../queries/group.dart'; class DataBaseMutationFunctions { - GraphQLClient clientNonAuth; - GraphQLClient clientAuth; - AuthQueries _authQuery; - BeaconQueries _beaconQuery; - GroupQueries _groupQuery; + GraphQLClient? clientNonAuth; + GraphQLClient? clientAuth; + AuthQueries? _authQuery; + BeaconQueries? _beaconQuery; + GroupQueries? _groupQuery; init() async { clientNonAuth = graphqlConfig.clientToQuery(); clientAuth = await graphqlConfig.authClient(); @@ -82,66 +82,60 @@ class DataBaseMutationFunctions { variables: {}, ); - final QueryResult result = await clientAuth.query(options); + final QueryResult result = await clientAuth!.query(options); if (result.hasException) { final bool exception = - encounteredExceptionOrError(result.exception, showSnackBar: false); + encounteredExceptionOrError(result.exception!, showSnackBar: false); if (exception) debugPrint("Exception Occured"); } else if (result.data != null && result.isConcrete) { - return result.data; + return result.data!; } - return result.data; + return result.data!; } //Auth - Future signup({String name, String email, String password}) async { + Future signup({String? name, String? email, String? password}) async { final QueryResult result = email != null - ? await clientNonAuth.mutate(MutationOptions( - document: gql(_authQuery.registerUser(name, email, password)))) - : await clientNonAuth.mutate( - MutationOptions(document: gql(_authQuery.loginAsGuest(name)))); + ? await clientNonAuth!.mutate(MutationOptions( + document: gql(_authQuery!.registerUser(name!, email, password!)))) + : await clientNonAuth!.mutate( + MutationOptions(document: gql(_authQuery!.loginAsGuest(name!)))); if (result.hasException) { navigationService - .showSnackBar("${result.exception.graphqlErrors.first.message}"); + .showSnackBar("${result.exception!.graphqlErrors.first.message}"); //commenting this since value of exception wasnt used. //final bool exception = encounteredExceptionOrError(result.exception); - debugPrint('${result.exception.graphqlErrors}'); + debugPrint('${result.exception!.graphqlErrors}'); return exceptionError; } else if (result.data != null && result.isConcrete) { final User signedInUser = - User.fromJson(result.data['register'] as Map); + User.fromJson(result.data!['register'] as Map); final String logIn = email != null ? await databaseFunctions.login( - email: email, password: password, user: signedInUser) + email: email, password: password!, user: signedInUser) : await databaseFunctions.login(user: signedInUser); return logIn; } return otherError; } - Future login({String email, String password, User user}) async { + Future login({String? email, String? password, User? user}) async { final QueryResult result = (email == null) - ? await clientNonAuth.mutate( - MutationOptions(document: gql(_authQuery.loginUsingID(user.id)))) - : await clientNonAuth.mutate(MutationOptions( - document: gql(_authQuery.loginUser(email, password)))); + ? await clientNonAuth!.mutate( + MutationOptions(document: gql(_authQuery!.loginUsingID(user!.id!)))) + : await clientNonAuth!.mutate(MutationOptions( + document: gql(_authQuery!.loginUser(email, password!)))); if (result.hasException) { navigationService - .showSnackBar("${result.exception.graphqlErrors.first.message}"); - print("${result.exception.graphqlErrors}"); + .showSnackBar("${result.exception!.graphqlErrors.first.message}"); + print("${result.exception!.graphqlErrors}"); return exceptionError; } else if (result.data != null && result.isConcrete) { bool userSaved = false; - if (email == null) { - user.isGuest = true; - user.authToken = "Bearer ${result.data['login']}"; - userSaved = await userConfig.updateUser(user); - } else { - User loggedInUser = - User(authToken: "Bearer ${result.data['login']}", isGuest: false); - userSaved = await userConfig.updateUser(loggedInUser); - } + User loggedInUser = + User(authToken: "Bearer ${result.data!['login']}", isGuest: false); + userSaved = await userConfig.updateUser(loggedInUser); final bool fetchInfo = await databaseFunctions.fetchCurrentUserInfo(); if (userSaved && fetchInfo) return logSuccess; @@ -154,18 +148,18 @@ class DataBaseMutationFunctions { // User Info Future fetchCurrentUserInfo() async { await databaseFunctions.init(); - final QueryResult result = await clientAuth - .query(QueryOptions(document: gql(_authQuery.fetchUserInfo()))); + final QueryResult result = await clientAuth! + .query(QueryOptions(document: gql(_authQuery!.fetchUserInfo()))); if (result.hasException) { final bool exception = - encounteredExceptionOrError(result.exception, showSnackBar: false); + encounteredExceptionOrError(result.exception!, showSnackBar: false); if (exception) { await userConfig.currentUser.delete(); navigationService.pushReplacementScreen('/auth'); } } else if (result.data != null && result.isConcrete) { User userInfo = User.fromJson( - result.data['me'] as Map, + result.data!['me'] as Map, ); userInfo.authToken = userConfig.currentUser.authToken; userInfo.isGuest = userConfig.currentUser.isGuest; @@ -176,18 +170,18 @@ class DataBaseMutationFunctions { } // Beacon Info - Future fetchBeaconInfo(String id) async { - final QueryResult result = await clientAuth - .query(QueryOptions(document: gql(_beaconQuery.fetchBeaconDetail(id)))); + Future fetchBeaconInfo(String id) async { + final QueryResult result = await clientAuth!.query( + QueryOptions(document: gql(_beaconQuery!.fetchBeaconDetail(id)))); if (result.hasException) { final bool exception = - encounteredExceptionOrError(result.exception, showSnackBar: false); + encounteredExceptionOrError(result.exception!, showSnackBar: false); if (exception) { print('Exception: ${result.exception}'); } } else if (result.data != null && result.isConcrete) { final Beacon beacon = Beacon.fromJson( - result.data['beacon'] as Map, + result.data!['beacon'] as Map, ); return beacon; } @@ -207,7 +201,7 @@ class DataBaseMutationFunctions { } for (Beacon i in userBeacons) { if (i.group == groupid) { - if (DateTime.fromMillisecondsSinceEpoch(i.expiresAt) + if (DateTime.fromMillisecondsSinceEpoch(i.expiresAt!) .isBefore(DateTime.now())) expiredBeacons.add(i); else @@ -219,37 +213,37 @@ class DataBaseMutationFunctions { } //if connected to internet take from internet. - final QueryResult result = await clientAuth - .query(QueryOptions(document: gql(_groupQuery.groupDetail(groupid)))); + final QueryResult result = await clientAuth! + .query(QueryOptions(document: gql(_groupQuery!.groupDetail(groupid)))); if (result.hasException) { final bool exception = - encounteredExceptionOrError(result.exception, showSnackBar: false); + encounteredExceptionOrError(result.exception!, showSnackBar: false); if (exception) { print('$exception'); } } else if (result.data != null && result.isConcrete) { // print(result.toString() + 'aadeeshmc'); - _userBeacons = (result.data['group']['beacons'] as List) + _userBeacons = (result.data!['group']['beacons'] as List) .map((e) => Beacon.fromJson(e as Map)) .toList(); // userInfo.print(); for (var i in _userBeacons) { if (!beaconIds.contains(i.id)) { - if (!hiveDb.beaconsBox.containsKey(i.id)) { + if (!hiveDb.beaconsBox!.containsKey(i.id)) { //This only happens if a someone else adds user to their beacon (which currently is not possible). //beacons are put in box when creating or joining. - await hiveDb.putBeaconInBeaconBox(i.id, i); + await hiveDb.putBeaconInBeaconBox(i.id!, i); } - beaconIds.add(i.id); - if (DateTime.fromMillisecondsSinceEpoch(i.expiresAt) + beaconIds.add(i.id!); + if (DateTime.fromMillisecondsSinceEpoch(i.expiresAt!) .isBefore(DateTime.now())) { expiredBeacons.insert(0, i); - expiredBeacons.sort((a, b) => a.expiresAt.compareTo(b.expiresAt)); + expiredBeacons.sort((a, b) => a.expiresAt!.compareTo(b.expiresAt!)); expiredBeacons = expiredBeacons.reversed.toList(); } else { beacons.add(i); - beacons.sort((a, b) => a.startsAt.compareTo(b.startsAt)); + beacons.sort((a, b) => a.startsAt!.compareTo(b.startsAt!)); } } } @@ -258,7 +252,7 @@ class DataBaseMutationFunctions { return beacons; } - Future createBeacon( + Future createBeacon( String title, int startsAt, int expiresAt, String groupID) async { LatLng loc; try { @@ -268,36 +262,37 @@ class DataBaseMutationFunctions { .showSnackBar("$onErr : Allow location access to start beacon"); return null; } - final QueryResult result = await clientAuth.mutate(MutationOptions( - document: gql(_beaconQuery.createBeacon(title, startsAt, expiresAt, + final QueryResult result = await clientAuth!.mutate(MutationOptions( + document: gql(_beaconQuery!.createBeacon(title, startsAt, expiresAt, loc.latitude.toString(), loc.longitude.toString(), groupID)))); if (result.hasException) { navigationService.showSnackBar( - "Something went wrong: ${result.exception.graphqlErrors.first.message}"); + "Something went wrong: ${result.exception!.graphqlErrors.first.message}"); print("Something went wrong: ${result.exception}"); } else if (result.data != null && result.isConcrete) { final Beacon beacon = Beacon.fromJson( - result.data['createBeacon'] as Map, + result.data!['createBeacon'] as Map, ); - hiveDb.putBeaconInBeaconBox(beacon.id, beacon); + hiveDb.putBeaconInBeaconBox(beacon.id!, beacon); return beacon; } return null; } - Future updateLeaderLoc(String id, LatLng latLng) async { - final QueryResult result = await clientAuth.mutate(MutationOptions( - document: gql(_beaconQuery.updateLeaderLoc( + Future updateLeaderLoc(String id, LatLng latLng) async { + final QueryResult result = await clientAuth!.mutate(MutationOptions( + document: gql(_beaconQuery!.updateLeaderLoc( id, latLng.latitude.toString(), latLng.longitude.toString())))); if (result.hasException) { print( "Something went wrong: ${result.exception}", ); navigationService.showSnackBar( - "Something went wrong: ${result.exception.graphqlErrors.first.message}"); + "Something went wrong: ${result.exception!.graphqlErrors.first.message}"); } else if (result.data != null && result.isConcrete) { final Location location = Location.fromJson( - result.data['updateBeaconLocation']['location'] as Map, + result.data!['updateBeaconLocation']['location'] + as Map, ); print('location update successful'); return location; @@ -305,27 +300,27 @@ class DataBaseMutationFunctions { return null; } - Future joinBeacon(String shortcode) async { - final QueryResult result = await clientAuth.mutate( - MutationOptions(document: gql(_beaconQuery.joinBeacon(shortcode)))); + Future joinBeacon(String shortcode) async { + final QueryResult result = await clientAuth!.mutate( + MutationOptions(document: gql(_beaconQuery!.joinBeacon(shortcode)))); if (result.hasException) { navigationService.showSnackBar( - "Something went wrong: ${result.exception.graphqlErrors.first.message}"); + "Something went wrong: ${result.exception!.graphqlErrors.first.message}"); print("Something went wrong: ${result.exception}"); navigationService.removeAllAndPush('/main', '/'); } else if (result.data != null && result.isConcrete) { final Beacon beacon = Beacon.fromJson( - result.data['joinBeacon'] as Map, + result.data!['joinBeacon'] as Map, ); - if (DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt) + if (DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt!) .isBefore(DateTime.now())) { navigationService.showSnackBar( "Looks like the beacon you are trying join has expired", ); return null; } - beacon.route.add(beacon.leader.location); - hiveDb.putBeaconInBeaconBox(beacon.id, beacon); + beacon.route!.add(beacon.leader!.location!); + hiveDb.putBeaconInBeaconBox(beacon.id!, beacon); return beacon; } else { navigationService.showSnackBar( @@ -335,19 +330,19 @@ class DataBaseMutationFunctions { return null; } - Future createLandmark(String title, LatLng loc, String id) async { - await clientAuth + Future createLandmark(String title, LatLng loc, String id) async { + await clientAuth! .mutate(MutationOptions( - document: gql(_beaconQuery.createLandmark( + document: gql(_beaconQuery!.createLandmark( id, loc.latitude.toString(), loc.longitude.toString(), title)))) .then((value) { if (value.hasException) { navigationService.showSnackBar( - "Something went wrong: ${value.exception.graphqlErrors.first.message}"); + "Something went wrong: ${value.exception!.graphqlErrors.first.message}"); print("Something went wrong: ${value.exception}"); } else if (value.data != null && value.isConcrete) { final Landmark landmark = Landmark.fromJson( - value.data['createLandmark'] as Map, + value.data!['createLandmark'] as Map, ); return landmark; } @@ -356,7 +351,7 @@ class DataBaseMutationFunctions { return null; } - Future> fetchNearbyBeacon(String groupID) async { + Future?> fetchNearbyBeacon(String groupID) async { await databaseFunctions.init(); List _nearbyBeacons = []; List _nearbyBeaconsinGroup = []; @@ -366,40 +361,40 @@ class DataBaseMutationFunctions { } catch (onErr) { return null; } - final QueryResult result = await clientAuth.query(QueryOptions( - document: gql(_beaconQuery.fetchNearbyBeacons( + final QueryResult result = await clientAuth!.query(QueryOptions( + document: gql(_beaconQuery!.fetchNearbyBeacons( loc.latitude.toString(), loc.longitude.toString())))); if (result.hasException) { final bool exception = - encounteredExceptionOrError(result.exception, showSnackBar: false); + encounteredExceptionOrError(result.exception!, showSnackBar: false); if (exception) { print('${result.exception}'); return null; } } else if (result.data != null && result.isConcrete) { - _nearbyBeacons = (result.data['nearbyBeacons'] as List) + _nearbyBeacons = (result.data!['nearbyBeacons'] as List) .map((e) => Beacon.fromJson(e as Map)) .toList(); for (Beacon i in _nearbyBeacons) if (i.group == groupID) _nearbyBeaconsinGroup.add(i); - _nearbyBeaconsinGroup.sort((a, b) => a.startsAt.compareTo(b.startsAt)); + _nearbyBeaconsinGroup.sort((a, b) => a.startsAt!.compareTo(b.startsAt!)); return _nearbyBeaconsinGroup; } return _nearbyBeacons; } - Future changeLeader(String beaconID, String newLeaderID) async { - await clientAuth + Future changeLeader(String beaconID, String newLeaderID) async { + await clientAuth! .mutate(MutationOptions( - document: gql(_beaconQuery.changeLeader(beaconID, newLeaderID)))) + document: gql(_beaconQuery!.changeLeader(beaconID, newLeaderID)))) .then((value) { if (value.hasException) { navigationService.showSnackBar( - "Something went wrong: ${value.exception.graphqlErrors.first.message}"); + "Something went wrong: ${value.exception!.graphqlErrors.first.message}"); print("Something went wrong: ${value.exception}"); } else if (value.data != null && value.isConcrete) { - final Beacon changedLeader = - Beacon.fromJson(value.data['changeLeader'] as Map); + final Beacon changedLeader = Beacon.fromJson( + value.data!['changeLeader'] as Map); return changedLeader; } return null; @@ -408,16 +403,16 @@ class DataBaseMutationFunctions { } // Group Info - Future createGroup(String title) async { - final QueryResult result = await clientAuth - .mutate(MutationOptions(document: gql(_groupQuery.createGroup(title)))); + Future createGroup(String title) async { + final QueryResult result = await clientAuth!.mutate( + MutationOptions(document: gql(_groupQuery!.createGroup(title)))); if (result.hasException) { navigationService.showSnackBar( - "Something went wrong: ${result.exception.graphqlErrors.first.message}"); + "Something went wrong: ${result.exception!.graphqlErrors.first.message}"); print("Something went wrong: ${result.exception}"); } else if (result.data != null && result.isConcrete) { final Group group = Group.fromJson( - result.data['createGroup'] as Map, + result.data!['createGroup'] as Map, ); // hiveDb.putBeaconInBeaconBox(group.id, group); return group; @@ -425,17 +420,17 @@ class DataBaseMutationFunctions { return null; } - Future joinGroup(String shortcode) async { - final QueryResult result = await clientAuth.mutate( - MutationOptions(document: gql(_groupQuery.joinGroup(shortcode)))); + Future joinGroup(String shortcode) async { + final QueryResult result = await clientAuth!.mutate( + MutationOptions(document: gql(_groupQuery!.joinGroup(shortcode)))); if (result.hasException) { navigationService.showSnackBar( - "Something went wrong: ${result.exception.graphqlErrors.first.message}"); + "Something went wrong: ${result.exception!.graphqlErrors.first.message}"); print("Something went wrong: ${result.exception}"); navigationService.removeAllAndPush('/main', '/'); } else if (result.data != null && result.isConcrete) { final Group group = Group.fromJson( - result.data['joinBeacon'] as Map, + result.data!['joinBeacon'] as Map, ); // hiveDb.putBeaconInBeaconBox(beacon.id, beacon); return group; @@ -471,20 +466,20 @@ class DataBaseMutationFunctions { // } //if connected to internet take from internet. - final QueryResult result = await clientAuth - .query(QueryOptions(document: gql(_authQuery.fetchUserInfo()))); + final QueryResult result = await clientAuth! + .query(QueryOptions(document: gql(_authQuery!.fetchUserInfo()))); if (result.hasException) { final bool exception = - encounteredExceptionOrError(result.exception, showSnackBar: false); + encounteredExceptionOrError(result.exception!, showSnackBar: false); if (exception) { print('$exception'); } } else if (result.data != null && result.isConcrete) { final User userInfo = User.fromJson( - result.data['me'] as Map, + result.data!['me'] as Map, ); // userInfo.print(); - for (var i in userInfo.groups) { + for (var i in userInfo.groups!) { // print(i.beacons.length.toString() + "hello"); if (!groupIds.contains(i.id)) { // if (!hiveDb.beaconsBox.containsKey(i.id)) { @@ -492,7 +487,7 @@ class DataBaseMutationFunctions { // //beacons are put in box when creating or joining. // await hiveDb.putBeaconInBeaconBox(i.id, i); // } - groupIds.add(i.id); + groupIds.add(i.id!); groups.add(i); } } diff --git a/lib/services/graphql_config.dart b/lib/services/graphql_config.dart index 53fb24b8..36ab6aa8 100644 --- a/lib/services/graphql_config.dart +++ b/lib/services/graphql_config.dart @@ -3,7 +3,7 @@ import 'package:beacon/locator.dart'; import 'package:graphql_flutter/graphql_flutter.dart'; class GraphQLConfig { - static String token; + static String? token; static final HttpLink httpLink = HttpLink( EnvironmentConfig.httpEndpoint, ); diff --git a/lib/services/hive_localdb.dart b/lib/services/hive_localdb.dart index 319a5d5b..903cf47c 100644 --- a/lib/services/hive_localdb.dart +++ b/lib/services/hive_localdb.dart @@ -9,9 +9,9 @@ import 'package:path_provider/path_provider.dart' as path_provider; import '../models/group/group.dart'; class HiveLocalDb { - Box currentUserBox; - Box beaconsBox; - Box groupsBox; + Box? currentUserBox; + Box? beaconsBox; + Box? groupsBox; Future init() async { final appDocumentDirectory = @@ -30,36 +30,28 @@ class HiveLocalDb { Future saveUserInHive(User currentUser) async { final box = currentUserBox; - if (currentUserBox.containsKey('user')) { - currentUserBox.delete('user'); + if (currentUserBox!.containsKey('user')) { + currentUserBox!.delete('user'); } - return await box.put('user', currentUser); + return await box!.put('user', currentUser); } - Future putBeaconInBeaconBox(String id, Beacon beacon, + Future putBeaconInBeaconBox(String id, Beacon? beacon, {bool fetchFromNetwork = false}) async { - if (beaconsBox.containsKey(id)) { - await beaconsBox.delete(id); + if (beaconsBox!.containsKey(id)) { + await beaconsBox!.delete(id); } if (fetchFromNetwork) { databaseFunctions.init(); beacon = await databaseFunctions.fetchBeaconInfo(id); } - await beaconsBox.put(id, beacon); + await beaconsBox!.put(id, beacon!); } - List getAllUserBeacons() { - final user = currentUserBox.get('user'); - print("asd" + user.id); - if (user == null) { - navigationService - .showSnackBar('Please connect to internet to fetch your beacons'); - return null; - } - final userBeacons = beaconsBox.values.toList(); - if (userBeacons == null) { - return user.beacon; - } + List? getAllUserBeacons() { + final user = currentUserBox!.get('user'); + print("asd" + user!.id!); + final userBeacons = beaconsBox!.values.toList(); return userBeacons; } } diff --git a/lib/services/local_notification.dart b/lib/services/local_notification.dart index 623ad5ae..95395177 100644 --- a/lib/services/local_notification.dart +++ b/lib/services/local_notification.dart @@ -32,9 +32,9 @@ class LocalNotification { Future onSelectNotification(notificationResponse) async { if (notificationResponse != null) { - Beacon beacon = + Beacon? beacon = await databaseFunctions.fetchBeaconInfo(notificationResponse.payload); - bool isLeader = beacon.leader.id == userConfig.currentUser.id; + bool isLeader = beacon!.leader!.id == userConfig.currentUser.id; navigationService.pushScreen('/hikeScreen', arguments: HikeScreen(beacon, isLeader: isLeader)); } @@ -48,10 +48,10 @@ class LocalNotification { Future scheduleNotification(Beacon beacon) async { await flutterLocalNotificationsPlugin.zonedSchedule( beacon.id.hashCode, - 'Hike ' + beacon.title + ' has started', + 'Hike ' + beacon.title! + ' has started', 'Click here to join!', tz.TZDateTime.from( - DateTime.fromMillisecondsSinceEpoch(beacon.startsAt), tz.local), + DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!), tz.local), NotificationDetails( android: AndroidNotificationDetails( 'channel id', @@ -74,10 +74,10 @@ class LocalNotification { ); await flutterLocalNotificationsPlugin.zonedSchedule( beacon.id.hashCode, - 'Reminder: ' + beacon.title + ' will start in an hour', + 'Reminder: ' + beacon.title! + ' will start in an hour', 'Get Ready!', tz.TZDateTime.from( - DateTime.fromMillisecondsSinceEpoch(beacon.startsAt), tz.local) + DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!), tz.local) .subtract(Duration(hours: 1)), NotificationDetails( android: AndroidNotificationDetails( diff --git a/lib/services/navigation_service.dart b/lib/services/navigation_service.dart index 67bb0507..b7e26d4c 100644 --- a/lib/services/navigation_service.dart +++ b/lib/services/navigation_service.dart @@ -5,11 +5,12 @@ class NavigationService { GlobalKey navigatorKey = GlobalKey(); Future pushScreen(String routeName, {dynamic arguments}) { - return navigatorKey.currentState.pushNamed(routeName, arguments: arguments); + return navigatorKey.currentState! + .pushNamed(routeName, arguments: arguments); } Future pushReplacementScreen(String routeName, {dynamic arguments}) { - return navigatorKey.currentState + return navigatorKey.currentState! .pushReplacementNamed(routeName, arguments: arguments); } @@ -23,14 +24,14 @@ class NavigationService { Future removeAllAndPush(String routeName, String tillRoute, {dynamic arguments}) { - return navigatorKey.currentState.pushNamedAndRemoveUntil( + return navigatorKey.currentState!.pushNamedAndRemoveUntil( routeName, ModalRoute.withName(tillRoute), arguments: arguments); } void pushDialog(Widget dialog) { showDialog( - context: navigatorKey.currentContext, + context: navigatorKey.currentContext!, barrierColor: Colors.transparent, barrierDismissible: false, builder: (BuildContext context) { @@ -40,7 +41,7 @@ class NavigationService { void showSnackBar(String message, {Duration duration = const Duration(seconds: 2)}) { - ScaffoldMessenger.of(navigatorKey.currentContext).showSnackBar( + ScaffoldMessenger.of(navigatorKey.currentContext!).showSnackBar( SnackBar( duration: duration, content: Text( @@ -60,6 +61,6 @@ class NavigationService { } void pop() { - return navigatorKey.currentState.pop(); + return navigatorKey.currentState!.pop(); } } diff --git a/lib/services/shared_preference_service.dart b/lib/services/shared_preference_service.dart index 47e81ce4..c2f9d1c8 100644 --- a/lib/services/shared_preference_service.dart +++ b/lib/services/shared_preference_service.dart @@ -1,7 +1,7 @@ import 'package:shared_preferences/shared_preferences.dart'; class SharedPreferenceService { - SharedPreferences _prefs; + SharedPreferences? _prefs; Future getSharedPreferencesInstance() async { _prefs = await SharedPreferences.getInstance().catchError((e) { @@ -12,14 +12,14 @@ class SharedPreferenceService { } Future setToken(String token) async { - await _prefs.setString('token', token); + await _prefs!.setString('token', token); } Future clearToken() async { - await _prefs.clear(); + await _prefs!.clear(); } - Future get token async => _prefs.getString('token'); + Future get token async => _prefs!.getString('token')!; } SharedPreferenceService sharedPreferenceService = SharedPreferenceService(); diff --git a/lib/services/size_config.dart b/lib/services/size_config.dart index dd4bf4bb..4b1e6620 100644 --- a/lib/services/size_config.dart +++ b/lib/services/size_config.dart @@ -1,31 +1,31 @@ import 'package:flutter/widgets.dart'; class SizeConfig { - static MediaQueryData _mediaQueryData; - static double screenWidth; - static double screenHeight; - static double blockSizeHorizontal; - static double blockSizeVertical; - static double paddingTop; + static MediaQueryData? _mediaQueryData; + static double? screenWidth; + static double? screenHeight; + static double? blockSizeHorizontal; + static double? blockSizeVertical; + static double? paddingTop; - static double _safeAreaHorizontal; - static double _safeAreaVertical; - static double safeBlockHorizontal; - static double safeBlockVertical; + static double? _safeAreaHorizontal; + static double? _safeAreaVertical; + static double? safeBlockHorizontal; + static double? safeBlockVertical; void init(BuildContext context) { _mediaQueryData = MediaQuery.of(context); - screenWidth = _mediaQueryData.size.width; - screenHeight = _mediaQueryData.size.height; - blockSizeHorizontal = screenWidth / 100; - blockSizeVertical = screenHeight / 100; + screenWidth = _mediaQueryData!.size.width; + screenHeight = _mediaQueryData!.size.height; + blockSizeHorizontal = screenWidth! / 100; + blockSizeVertical = screenHeight! / 100; _safeAreaHorizontal = - _mediaQueryData.padding.left + _mediaQueryData.padding.right; + _mediaQueryData!.padding.left + _mediaQueryData!.padding.right; _safeAreaVertical = - _mediaQueryData.padding.top + _mediaQueryData.padding.bottom; - safeBlockHorizontal = (screenWidth - _safeAreaHorizontal) / 100; - safeBlockVertical = (screenHeight - _safeAreaVertical) / 100; + _mediaQueryData!.padding.top + _mediaQueryData!.padding.bottom; + safeBlockHorizontal = (screenWidth! - _safeAreaHorizontal!) / 100; + safeBlockVertical = (screenHeight! - _safeAreaVertical!) / 100; debugPrint("safeBlockHorizontal: $safeBlockHorizontal"); debugPrint("safeBlockVertical: $safeBlockVertical"); } diff --git a/lib/services/user_config.dart b/lib/services/user_config.dart index 60be11f7..849372cc 100644 --- a/lib/services/user_config.dart +++ b/lib/services/user_config.dart @@ -9,11 +9,7 @@ class UserConfig { Future userLoggedIn() async { final boxUser = hiveDb.currentUserBox; - _currentUser = boxUser.get('user'); - if (_currentUser == null) { - _currentUser = User(id: 'null', authToken: 'null'); - return false; - } + _currentUser = boxUser!.get('user')!; bool userUpdated = true; await graphqlConfig.getToken().then((value) async { print('${userConfig._currentUser.authToken}'); diff --git a/lib/services/validators.dart b/lib/services/validators.dart index ad0df32d..28a7a21d 100644 --- a/lib/services/validators.dart +++ b/lib/services/validators.dart @@ -1,12 +1,12 @@ class Validator { - static String validateName(String name) { + static String? validateName(String name) { if (name.isEmpty) { return "Name must not be left blank"; } return null; } - static String validateEmail(String email) { + static String? validateEmail(String email) { // If email is empty return. if (email.isEmpty) { return "Email must not be left blank"; @@ -20,7 +20,7 @@ class Validator { return null; } - static String validatePassword(String password) { + static String? validatePassword(String password) { // If password is empty return. if (password.isEmpty) { return "Password must not be left blank"; @@ -44,14 +44,14 @@ class Validator { return null; } - static String validateBeaconTitle(String title) { + static String? validateBeaconTitle(String title) { if (title.isEmpty) { return "Title must not be left blank"; } return null; } - static String validatePasskey(String passkey) { + static String? validatePasskey(String passkey) { if (passkey.isEmpty) { return "Passkey must not be left blank"; } @@ -63,18 +63,15 @@ class Validator { return null; } - static String validateDuration(String duration) { + static String? validateDuration(String duration) { if (duration.startsWith("0:00:00.")) { return "Duration cannot be $duration"; } return null; } - static String validateStartingTime(String startTime) { + static String? validateStartingTime(String startTime) { print(startTime); - if (startTime == null) { - return "Enter the valid Time"; - } return null; } } diff --git a/lib/splash_screen.dart b/lib/splash_screen.dart index c862c487..81b79471 100644 --- a/lib/splash_screen.dart +++ b/lib/splash_screen.dart @@ -9,20 +9,20 @@ import 'package:uni_links/uni_links.dart'; import 'components/loading_screen.dart'; class SplashScreen extends StatefulWidget { - const SplashScreen({@required Key key}) : super(key: key); + const SplashScreen({@required Key? key}) : super(key: key); @override _SplashScreenState createState() => _SplashScreenState(); } class _SplashScreenState extends State { - Uri _initialUri; - Uri _latestUri; - StreamSubscription _sub; + Uri? _initialUri; + Uri? _latestUri; + StreamSubscription? _sub; bool isCheckingUrl = false; Future _handleInitialUri() async { - _sub = uriLinkStream.listen((Uri uri) { + _sub = uriLinkStream.listen((Uri? uri) { if (!mounted) return; setState(() { _latestUri = uri; @@ -48,35 +48,25 @@ class _SplashScreenState extends State { await databaseFunctions.init(); await userConfig.userLoggedIn().then((value) async { if (_latestUri == null && _initialUri == null) { - if (value || hiveDb.currentUserBox.containsKey('user')) { + if (value || hiveDb.currentUserBox!.containsKey('user')) { navigationService.pushReplacementScreen('/main'); } else { navigationService.pushReplacementScreen('/auth'); } } else { - if (_initialUri != null) { - var shortcode = _initialUri.queryParameters['shortcode']; - if (value) { - await databaseFunctions.joinBeacon(shortcode).then((val) { - if (val != null) { - navigationService.pushScreen('/hikeScreen', - arguments: HikeScreen(val, isLeader: false)); - } else { - navigationService.pushReplacementScreen('/main'); - } - }); - } else { - // login in anonymously and join hike - await databaseFunctions.signup(name: "Anonymous"); - await databaseFunctions.joinBeacon(shortcode).then((val) async { - if (value != null) { - navigationService.pushScreen('/hikeScreen', - arguments: HikeScreen(val, isLeader: false)); - } else { - navigationService.pushReplacementScreen('/main'); - } - }); - } + var shortcode = _initialUri!.queryParameters['shortcode']; + if (value) { + await databaseFunctions.joinBeacon(shortcode!).then((val) { + navigationService.pushScreen('/hikeScreen', + arguments: HikeScreen(val, isLeader: false)); + }); + } else { + // login in anonymously and join hike + await databaseFunctions.signup(name: "Anonymous"); + await databaseFunctions.joinBeacon(shortcode!).then((val) async { + navigationService.pushScreen('/hikeScreen', + arguments: HikeScreen(val, isLeader: false)); + }); } } }); @@ -90,7 +80,7 @@ class _SplashScreenState extends State { @override void dispose() { - _sub.cancel(); + _sub!.cancel(); super.dispose(); } diff --git a/lib/utilities/indication_painter.dart b/lib/utilities/indication_painter.dart index a82219a5..1d176ca9 100644 --- a/lib/utilities/indication_painter.dart +++ b/lib/utilities/indication_painter.dart @@ -4,13 +4,13 @@ import 'package:beacon/utilities/constants.dart'; import 'package:flutter/material.dart'; class TabIndicationPainter extends CustomPainter { - Paint painter; - final double dxTarget; - final double dxEntry; - final double radius; - final double dy; + Paint? painter; + final double? dxTarget; + final double? dxEntry; + final double? radius; + final double? dy; - final PageController pageController; + final PageController? pageController; TabIndicationPainter( {this.dxTarget = 125.0, @@ -26,27 +26,27 @@ class TabIndicationPainter extends CustomPainter { @override void paint(Canvas canvas, Size size) { - final pos = pageController.position; + final pos = pageController!.position; double fullExtent = (pos.maxScrollExtent - pos.minScrollExtent + pos.viewportDimension); double pageOffset = pos.extentBefore / fullExtent; - bool left2right = dxEntry < dxTarget; - Offset entry = new Offset(left2right ? dxEntry : dxTarget, dy); - Offset target = new Offset(left2right ? dxTarget : dxEntry, dy); + bool left2right = dxEntry! < dxTarget!; + Offset entry = new Offset(left2right ? dxEntry! : dxTarget!, dy!); + Offset target = new Offset(left2right ? dxTarget! : dxEntry!, dy!); Path path = new Path(); path.addArc( - new Rect.fromCircle(center: entry, radius: radius), 0.5 * pi, 1 * pi); + new Rect.fromCircle(center: entry, radius: radius!), 0.5 * pi, 1 * pi); path.addRect( - new Rect.fromLTRB(entry.dx, dy - radius, target.dx, dy + radius)); + new Rect.fromLTRB(entry.dx, dy! - radius!, target.dx, dy! + radius!)); path.addArc( - new Rect.fromCircle(center: target, radius: radius), 1.5 * pi, 1 * pi); + new Rect.fromCircle(center: target, radius: radius!), 1.5 * pi, 1 * pi); canvas.translate(size.width * pageOffset, 0.0); canvas.drawShadow(path, kLightBlue, 3.0, true); - canvas.drawPath(path, painter); + canvas.drawPath(path, painter!); } @override diff --git a/lib/view_model/auth_screen_model.dart b/lib/view_model/auth_screen_model.dart index 4e27eb75..27f88ff3 100644 --- a/lib/view_model/auth_screen_model.dart +++ b/lib/view_model/auth_screen_model.dart @@ -38,9 +38,9 @@ class AuthViewModel extends BaseModel { Color rightBg = kBlue; nextSignup() async { - FocusScope.of(navigationService.navigatorKey.currentContext).unfocus(); + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); signupValidate = AutovalidateMode.always; - if (formKeySignup.currentState.validate()) { + if (formKeySignup.currentState!.validate()) { setState(ViewState.busy); signupValidate = AutovalidateMode.disabled; databaseFunctions.init(); @@ -79,9 +79,9 @@ class AuthViewModel extends BaseModel { } nextLogin() async { - FocusScope.of(navigationService.navigatorKey.currentContext).unfocus(); + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); loginValidate = AutovalidateMode.always; - if (formKeyLogin.currentState.validate()) { + if (formKeyLogin.currentState!.validate()) { setState(ViewState.busy); loginValidate = AutovalidateMode.disabled; await databaseFunctions.init(); @@ -104,7 +104,7 @@ class AuthViewModel extends BaseModel { } void requestFocusForFocusNode(FocusNode focusNode) { - FocusScope.of(navigationService.navigatorKey.currentContext) + FocusScope.of(navigationService.navigatorKey.currentContext!) .requestFocus(focusNode); } diff --git a/lib/view_model/group_screen_view_model.dart b/lib/view_model/group_screen_view_model.dart index bcbc616f..bcc021fa 100644 --- a/lib/view_model/group_screen_view_model.dart +++ b/lib/view_model/group_screen_view_model.dart @@ -9,89 +9,80 @@ import 'package:intl/intl.dart'; class GroupViewModel extends BaseModel { final formKeyCreate = GlobalKey(); final formKeyJoin = GlobalKey(); - Duration resultingDuration = Duration(minutes: 30); + Duration? resultingDuration = Duration(minutes: 30); AutovalidateMode validate = AutovalidateMode.onUserInteraction; - DateTime startsAt; - DateTime startingdate; - TimeOfDay startingTime; + DateTime? startsAt; + DateTime? startingdate; + TimeOfDay? startingTime; bool isCreatingHike = false; - String title; - bool hasStarted; - String groupID; + String? title; + bool? hasStarted; + String? groupID; //commenting out since its value isnt used anywhere. //TextEditingController _titleController = new TextEditingController(); TextEditingController durationController = new TextEditingController(); TextEditingController startsAtDate = new TextEditingController(); TextEditingController startsAtTime = new TextEditingController(); - String enteredPasskey; + String? enteredPasskey; createHikeRoom(String groupID, Function reloadList) async { - FocusScope.of(navigationService.navigatorKey.currentContext).unfocus(); + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); validate = AutovalidateMode.always; - if (formKeyCreate.currentState.validate()) { + if (formKeyCreate.currentState!.validate()) { navigationService.pop(); setState(ViewState.busy); validate = AutovalidateMode.disabled; databaseFunctions.init(); - final Beacon beacon = await databaseFunctions.createBeacon( - title, - startsAt.millisecondsSinceEpoch.toInt(), - startsAt.add(resultingDuration).millisecondsSinceEpoch.toInt(), + final Beacon? beacon = await databaseFunctions.createBeacon( + title!, + startsAt!.millisecondsSinceEpoch.toInt(), + startsAt!.add(resultingDuration!).millisecondsSinceEpoch.toInt(), groupID); // setState(ViewState.idle); - if (beacon != null) { - hasStarted = DateTime.now() - .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)); - if (hasStarted) { - navigationService.pushScreen('/hikeScreen', - arguments: HikeScreen( - beacon, - isLeader: true, - )); - } else { - localNotif.scheduleNotification(beacon); - setState(ViewState.idle); - reloadList(); - navigationService.showSnackBar( - 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', - ); - return; - } + hasStarted = DateTime.now() + .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon!.startsAt!)); + if (hasStarted!) { + navigationService.pushScreen('/hikeScreen', + arguments: HikeScreen( + beacon, + isLeader: true, + )); } else { - // navigationService.showSnackBar('Something went wrong'); + localNotif.scheduleNotification(beacon); setState(ViewState.idle); + reloadList(); + navigationService.showSnackBar( + 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', + ); + return; } } } joinHikeRoom(Function reloadList) async { - FocusScope.of(navigationService.navigatorKey.currentContext).unfocus(); + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); validate = AutovalidateMode.always; - if (formKeyJoin.currentState.validate()) { + if (formKeyJoin.currentState!.validate()) { setState(ViewState.busy); validate = AutovalidateMode.disabled; databaseFunctions.init(); - final Beacon beacon = await databaseFunctions.joinBeacon(enteredPasskey); + final Beacon? beacon = + await databaseFunctions.joinBeacon(enteredPasskey!); // setState(ViewState.idle); - if (beacon != null) { - hasStarted = DateTime.now() - .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)); + hasStarted = DateTime.now() + .isAfter(DateTime.fromMillisecondsSinceEpoch(beacon!.startsAt!)); - if (hasStarted) { - navigationService.pushScreen('/hikeScreen', - arguments: HikeScreen(beacon, isLeader: false)); - } else { - localNotif.scheduleNotification(beacon); - setState(ViewState.idle); - reloadList(); - navigationService.showSnackBar( - 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt)).toString()}', - ); - return; - } + if (hasStarted!) { + navigationService.pushScreen('/hikeScreen', + arguments: HikeScreen(beacon, isLeader: false)); } else { - //there was some error, go back to homescreen. + localNotif.scheduleNotification(beacon); setState(ViewState.idle); + reloadList(); + navigationService.showSnackBar( + 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', + ); + return; } //Snackbar is displayed by joinBeacon itself on any error or trying to join expired beacon. } else { @@ -102,7 +93,7 @@ class GroupViewModel extends BaseModel { logout() async { setState(ViewState.busy); await userConfig.currentUser.delete(); - await hiveDb.beaconsBox.clear(); + await hiveDb.beaconsBox!.clear(); // setState(ViewState.idle); await localNotif.deleteNotification(); navigationService.removeAllAndPush('/auth', '/'); diff --git a/lib/view_model/hike_screen_model.dart b/lib/view_model/hike_screen_model.dart index 23a5d7d4..9212be05 100644 --- a/lib/view_model/hike_screen_model.dart +++ b/lib/view_model/hike_screen_model.dart @@ -26,25 +26,25 @@ import 'package:rxdart/rxdart.dart'; class HikeScreenViewModel extends BaseModel { bool modelIsReady = false; - Beacon beacon; + Beacon? beacon; Set followerId = {}; - bool isGeneratingLink = false, isReferred, isBeaconExpired = false; + bool? isGeneratingLink = false, isReferred, isBeaconExpired = false; List hikers = []; List route = []; Duration newDuration = Duration(seconds: 0); Completer mapController = Completer(); - String address, prevAddress; + String? address, prevAddress; bool isBusy = false; Set markers = {}; Set polylines = Set(); - StreamSubscription _leaderLocation; - Stream beaconLocationStream, beaconJoinedStream, mergedStream; + StreamSubscription? _leaderLocation; + Stream? beaconLocationStream, beaconJoinedStream, mergedStream; List polylineCoordinates = []; PolylinePoints polylinePoints = PolylinePoints(); final GlobalKey landmarkFormKey = GlobalKey(); ScrollController scrollController = ScrollController(); Location loc = new Location(); - GraphQLClient graphQlClient; + GraphQLClient? graphQlClient; PanelController panelController = PanelController(); final List mergedStreamSubscriptions = []; bool isLeader = false; @@ -54,11 +54,11 @@ class HikeScreenViewModel extends BaseModel { if (newLeaderID == userConfig.currentUser.id) Fluttertoast.showToast(msg: 'Yeah, that\'s you'); else { - if (beacon.leader.id == userConfig.currentUser.id) { + if (beacon!.leader!.id == userConfig.currentUser.id) { await databaseFunctions.init(); final changedLeader = - databaseFunctions.changeLeader(beacon.id, newLeaderID); - if (changedLeader != null) beacon.leader.id = newLeaderID; + databaseFunctions.changeLeader(beacon!.id!, newLeaderID); + beacon!.leader!.id = newLeaderID; Fluttertoast.showToast(msg: 'Beacon handed over to $newLeaderName'); notifyListeners(); } else { @@ -71,7 +71,7 @@ class HikeScreenViewModel extends BaseModel { return (await showDialog( context: context, builder: (context) => DialogBoxes.showExitDialog( - context, isLeader, hikers.length, isBeaconExpired), + context, isLeader, hikers.length, isBeaconExpired!), )) ?? false; } @@ -107,7 +107,7 @@ class HikeScreenViewModel extends BaseModel { } Future setPolyline() async { - PolylineResult result = await polylinePoints?.getRouteBetweenCoordinates( + PolylineResult result = await polylinePoints.getRouteBetweenCoordinates( EnvironmentConfig.googleMapApi, // Google Maps API Key PointLatLng(route.first.latitude, route.first.longitude), PointLatLng(route.last.latitude, route.last.longitude), @@ -156,21 +156,21 @@ class HikeScreenViewModel extends BaseModel { } Future updateModel(Beacon value) async { - Coordinates coordinates = Coordinates( - double.parse(beacon.location.lat), double.parse(beacon.location.lon)); + Coordinates coordinates = Coordinates(double.parse(beacon!.location!.lat!), + double.parse(beacon!.location!.lon!)); var addresses = await Geocoder.local.findAddressesFromCoordinates(coordinates); - isBeaconExpired = DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt) + isBeaconExpired = DateTime.fromMillisecondsSinceEpoch(beacon!.expiresAt!) .isBefore(DateTime.now()); - hikers.add(value.leader); - for (var i in value.followers) { + hikers.add(value.leader!); + for (var i in value.followers!) { if (!followerId.contains(i.id)) { hikers.add(i); - followerId.add(i.id); + followerId.add(i.id!); } } - var lat = double.parse(value.location.lat); - var lon = double.parse(value.location.lon); + var lat = double.parse(value.location!.lat!); + var lon = double.parse(value.location!.lon!); route.add(LatLng(lat, lon)); address = addresses.first.addressLine; markers.add(Marker( @@ -188,11 +188,11 @@ class HikeScreenViewModel extends BaseModel { title: 'Current Location', ), )); - for (var i in value.landmarks) { + for (var i in value.landmarks!) { markers.add(Marker( markerId: MarkerId((markers.length + 1).toString()), - position: - LatLng(double.parse(i.location.lat), double.parse(i.location.lon)), + position: LatLng( + double.parse(i.location!.lat!), double.parse(i.location!.lon!)), infoWindow: InfoWindow( title: '${i.title}', ), @@ -203,7 +203,7 @@ class HikeScreenViewModel extends BaseModel { // markers.add(Marker( // markerId: MarkerId((markers.length + 1).toString()), // position: LatLng( - // double.parse(i.location.lat), double.parse(i.location.lon)), + // double.parse(i.location!.lat), double.parse(i.location!.lon)), // infoWindow: InfoWindow( // title: '${i.name}', // ), @@ -215,76 +215,71 @@ class HikeScreenViewModel extends BaseModel { } Future fetchData() async { - await databaseFunctions.fetchBeaconInfo(beacon.id).then((value) async { - if (value != null) { - beacon = value; - await hiveDb.putBeaconInBeaconBox(beacon.id, beacon); - } else { - value = hiveDb.beaconsBox.get(beacon.id); - beacon = value; - } - await updateModel(value); + await databaseFunctions.fetchBeaconInfo(beacon!.id!).then((value) async { + beacon = value; + await hiveDb.putBeaconInBeaconBox(beacon!.id!, beacon!); + await updateModel(value!); }); } Future setupSubscriptions(bool isExpired) async { - if (isBeaconExpired || isExpired) return; + if (isBeaconExpired! || isExpired) return; if (isLeader) { // distanceFilter (in m) can be changed to reduce the backend calls await loc.changeSettings(interval: 3000, distanceFilter: 0.0); _leaderLocation = loc.onLocationChanged.listen( (LocationData currentLocation) async { - if (DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt) - .isBefore(DateTime.now())) _leaderLocation.cancel(); - Coordinates coordinates = - Coordinates(currentLocation.latitude, currentLocation.longitude); + if (DateTime.fromMillisecondsSinceEpoch(beacon!.expiresAt!) + .isBefore(DateTime.now())) _leaderLocation!.cancel(); + Coordinates coordinates = Coordinates( + currentLocation.latitude!, currentLocation.longitude!); var addresses = await Geocoder.local.findAddressesFromCoordinates(coordinates); - String _address = addresses.first.addressLine; + String _address = addresses.first.addressLine!; if (address != _address) { databaseFunctions.init(); - await databaseFunctions.updateLeaderLoc(beacon.id, - LatLng(currentLocation.latitude, currentLocation.longitude)); + await databaseFunctions.updateLeaderLoc(beacon!.id!, + LatLng(currentLocation.latitude!, currentLocation.longitude!)); address = _address; route.add( - LatLng(currentLocation.latitude, currentLocation.longitude)); + LatLng(currentLocation.latitude!, currentLocation.longitude!)); updatePinOnMap( - LatLng(currentLocation.latitude, currentLocation.longitude)); + LatLng(currentLocation.latitude!, currentLocation.longitude!)); setPolyline(); notifyListeners(); } }, ); } else { - beaconLocationStream = graphQlClient.subscribe( + beaconLocationStream = graphQlClient!.subscribe( SubscriptionOptions( document: BeaconQueries().beaconLocationSubGql, variables: { - 'id': beacon.id, + 'id': beacon!.id!, }, ), ); } - beaconJoinedStream = graphQlClient.subscribe( + beaconJoinedStream = graphQlClient!.subscribe( SubscriptionOptions( document: BeaconQueries().beaconJoinedSubGql, variables: { - 'id': beacon.id, + 'id': beacon!.id!, }, ), ); if (!isLeader) { - mergedStream = MergeStream([beaconLocationStream, beaconJoinedStream]); + mergedStream = MergeStream([beaconLocationStream!, beaconJoinedStream!]); } else { mergedStream = beaconJoinedStream; } - StreamSubscription mergeStreamSubscription; - mergeStreamSubscription = mergedStream.listen((event) async { - if (DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt) + StreamSubscription? mergeStreamSubscription; + mergeStreamSubscription = mergedStream!.listen((event) async { + if (DateTime.fromMillisecondsSinceEpoch(beacon!.expiresAt!) .isBefore(DateTime.now())) { - mergeStreamSubscription.cancel(); + mergeStreamSubscription!.cancel(); isBeaconExpired = true; notifyListeners(); return; @@ -311,7 +306,7 @@ class HikeScreenViewModel extends BaseModel { trailing: IconButton( icon: Icon(Icons.close), onPressed: () { - OverlaySupportEntry.of(context).dismiss(); + OverlaySupportEntry.of(context)!.dismiss(); }), ), ), @@ -320,9 +315,9 @@ class HikeScreenViewModel extends BaseModel { if (!followerId.contains(newJoinee.id)) { hikers.add(newJoinee); - followerId.add(newJoinee.id); - beacon.followers.add(newJoinee); - await hiveDb.putBeaconInBeaconBox(beacon.id, beacon); + followerId.add(newJoinee.id!); + beacon!.followers!.add(newJoinee); + await hiveDb.putBeaconInBeaconBox(beacon!.id!, beacon!); } // markers.add(Marker( // markerId: MarkerId((markers.length + 1).toString()), @@ -342,14 +337,14 @@ class HikeScreenViewModel extends BaseModel { double.parse(event.data['beaconLocation']['lon'])); var addresses = await Geocoder.local.findAddressesFromCoordinates( Coordinates(coord.latitude, coord.longitude)); - beacon.route.add( + beacon!.route!.add( locModel.Location( lat: coord.latitude.toString(), lon: coord.longitude.toString(), ), ); - await hiveDb.putBeaconInBeaconBox(beacon.id, beacon); - String _address = addresses.first.addressLine; + await hiveDb.putBeaconInBeaconBox(beacon!.id!, beacon!); + String _address = addresses.first.addressLine!; route.add(coord); updatePinOnMap(coord); address = _address; @@ -363,17 +358,17 @@ class HikeScreenViewModel extends BaseModel { } Future initialise(Beacon beaconParsed, bool widgetIsLeader) async { - beacon = hiveDb.beaconsBox.get(beaconParsed.id); + beacon = hiveDb.beaconsBox!.get(beaconParsed.id); isLeader = widgetIsLeader; if (await connectionChecker.checkForInternetConnection()) { await fetchData(); graphQlClient = GraphQLConfig().graphQlClient(); await setupSubscriptions( - DateTime.fromMillisecondsSinceEpoch(beacon.expiresAt) + DateTime.fromMillisecondsSinceEpoch(beacon!.expiresAt!) .isBefore(DateTime.now())); } else { - await updateModel(beacon); + await updateModel(beacon!); } modelIsReady = true; notifyListeners(); @@ -395,15 +390,14 @@ class HikeScreenViewModel extends BaseModel { void dispose() { if (_leaderLocation != null) { - _leaderLocation.cancel(); + _leaderLocation!.cancel(); + } + for (var streamSub in mergedStreamSubscriptions) { + streamSub.cancel(); } - if (mergedStreamSubscriptions != null) - for (var streamSub in mergedStreamSubscriptions) { - if (streamSub != null) streamSub.cancel(); - } connectionChecker.checkForInternetConnection().then( (value) async { - await hiveDb.putBeaconInBeaconBox(beacon.id, beacon, + await hiveDb.putBeaconInBeaconBox(beacon!.id!, beacon!, fetchFromNetwork: value); }, ); @@ -421,11 +415,11 @@ class HikeScreenViewModel extends BaseModel { var title, var loc, ) async { - if (landmarkFormKey.currentState.validate()) { + if (landmarkFormKey.currentState!.validate()) { navigationService.pop(); await databaseFunctions.init(); await databaseFunctions - .createLandmark(title, loc, beacon.id) + .createLandmark(title, loc, beacon!.id!) .then((value) async { markers.add(Marker( markerId: MarkerId((markers.length + 1).toString()), @@ -435,10 +429,11 @@ class HikeScreenViewModel extends BaseModel { ), icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueBlue), )); - beacon.landmarks.add(value); - await hiveDb.putBeaconInBeaconBox(beacon.id, beacon); - print(hiveDb.beaconsBox.get(beacon.id).landmarks.length.toString() + - 'asdasdasd'); + beacon!.landmarks!.add(value!); + await hiveDb.putBeaconInBeaconBox(beacon!.id!, beacon!); + print( + hiveDb.beaconsBox!.get(beacon!.id!)!.landmarks!.length.toString() + + 'asdasdasd'); notifyListeners(); }); } diff --git a/lib/view_model/home_screen_view_model.dart b/lib/view_model/home_screen_view_model.dart index e5e4fb83..862b5e77 100644 --- a/lib/view_model/home_screen_view_model.dart +++ b/lib/view_model/home_screen_view_model.dart @@ -10,27 +10,25 @@ class HomeViewModel extends BaseModel { final formKeyCreate = GlobalKey(); final formKeyJoin = GlobalKey(); AutovalidateMode validate = AutovalidateMode.onUserInteraction; - String title; + String? title; bool isCreatingGroup = false; - String enteredGroupCode; + String? enteredGroupCode; createGroupRoom() async { - FocusScope.of(navigationService.navigatorKey.currentContext).unfocus(); + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); validate = AutovalidateMode.always; - if (formKeyCreate.currentState.validate()) { + if (formKeyCreate.currentState!.validate()) { navigationService.pop(); setState(ViewState.busy); validate = AutovalidateMode.disabled; databaseFunctions.init(); - final Group group = await databaseFunctions.createGroup( - title, + final Group? group = await databaseFunctions.createGroup( + title!, ); - if (group != null) { - navigationService.pushScreen('/groupScreen', - arguments: GroupScreen( - group, - )); - } + navigationService.pushScreen('/groupScreen', + arguments: GroupScreen( + group!, + )); } else { navigationService.showSnackBar('Something went wrong'); setState(ViewState.idle); @@ -38,23 +36,18 @@ class HomeViewModel extends BaseModel { } joinGroupRoom() async { - FocusScope.of(navigationService.navigatorKey.currentContext).unfocus(); + FocusScope.of(navigationService.navigatorKey.currentContext!).unfocus(); validate = AutovalidateMode.always; - if (formKeyJoin.currentState.validate()) { + if (formKeyJoin.currentState!.validate()) { setState(ViewState.busy); validate = AutovalidateMode.disabled; databaseFunctions.init(); - final Group group = await databaseFunctions.joinGroup(enteredGroupCode); + final Group? group = await databaseFunctions.joinGroup(enteredGroupCode!); // setState(ViewState.idle); - if (group != null) { - navigationService.pushScreen('/groupScreen', - arguments: GroupScreen( - group, - )); - } else { - //there was some error, go back to homescreen. - setState(ViewState.idle); - } + navigationService.pushScreen('/groupScreen', + arguments: GroupScreen( + group!, + )); //Snackbar is displayed by joinBeacon itself on any error or trying to join expired beacon. } else { navigationService.showSnackBar('Enter Valid Group Code'); @@ -64,7 +57,7 @@ class HomeViewModel extends BaseModel { logout() async { setState(ViewState.busy); await userConfig.currentUser.delete(); - await hiveDb.beaconsBox.clear(); + await hiveDb.beaconsBox!.clear(); // setState(ViewState.idle); await localNotif.deleteNotification(); navigationService.removeAllAndPush('/auth', '/'); diff --git a/lib/views/auth_screen.dart b/lib/views/auth_screen.dart index 541fc61a..d84ca92e 100644 --- a/lib/views/auth_screen.dart +++ b/lib/views/auth_screen.dart @@ -12,7 +12,7 @@ import 'package:sizer/sizer.dart'; import '../components/loading_screen.dart'; class AuthScreen extends StatefulWidget { - const AuthScreen({Key key}) : super(key: key); + const AuthScreen({Key? key}) : super(key: key); @override _AuthScreenState createState() => _AuthScreenState(); @@ -21,49 +21,55 @@ class AuthScreen extends StatefulWidget { class _AuthScreenState extends State with SingleTickerProviderStateMixin { Future _onPopHome() async { - return showDialog( - context: context, - builder: (context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - actionsAlignment: MainAxisAlignment.spaceEvenly, - contentPadding: EdgeInsets.all(25.0), - title: Text( - 'Confirm Exit', - style: TextStyle(fontSize: 25, color: kYellow), - ), - content: Text( - 'Do you really want to exit?', - style: TextStyle(fontSize: 18, color: kBlack), - ), - actions: [ - HikeButton( - buttonHeight: 2.5.h, - buttonWidth: 8.w, - onTap: () => Navigator.of(context).pop(false), - text: 'No', - ), - HikeButton( - buttonHeight: 2.5.h, - buttonWidth: 8.w, - onTap: () => - SystemChannels.platform.invokeMethod('SystemNavigator.pop'), - text: 'Yes', + return await showDialog( + context: context, + builder: (context) => AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + actionsAlignment: MainAxisAlignment.spaceEvenly, + contentPadding: EdgeInsets.all(25.0), + title: Text( + 'Confirm Exit', + style: TextStyle(fontSize: 25, color: kYellow), + ), + content: Text( + 'Do you really want to exit?', + style: TextStyle(fontSize: 18, color: kBlack), + ), + actions: [ + HikeButton( + buttonHeight: 2.5.h, + buttonWidth: 8.w, + onTap: () => Navigator.of(context).pop(false), + text: 'No', + ), + HikeButton( + buttonHeight: 2.5.h, + buttonWidth: 8.w, + onTap: () => + SystemChannels.platform.invokeMethod('SystemNavigator.pop'), + text: 'Yes', + ), + ], ), - ], - ), - ); + ) ?? + false; } @override Widget build(BuildContext context) { Size screensize = MediaQuery.of(context).size; - return WillPopScope( - onWillPop: _onPopHome, + return PopScope( + canPop: true, + onPopInvoked: (value) { + if (value) { + _onPopHome(); + } + }, child: BaseView( builder: (context, model, child) { - return (model.isBusy) + return (model!.isBusy) ? LoadingScreen() : new Scaffold( key: model.scaffoldKey, @@ -224,7 +230,7 @@ class _AuthScreenState extends State focusNode: model.emailLogin, controller: model.loginEmailController, validator: (value) => - Validator.validateEmail(value.trimRight()), + Validator.validateEmail(value!.trimRight()), keyboardType: TextInputType.emailAddress, style: TextStyle(fontSize: 16.0, color: Colors.black), decoration: InputDecoration( @@ -251,7 +257,7 @@ class _AuthScreenState extends State controller: model.loginPasswordController, obscureText: model.obscureTextLogin, validator: (value) => - Validator.validatePassword(value), + Validator.validatePassword(value!), style: TextStyle(fontSize: 16.0, color: Colors.black), decoration: InputDecoration( border: InputBorder.none, @@ -335,7 +341,7 @@ class _AuthScreenState extends State horizontal: 10, vertical: 10.0), child: TextFormField( autovalidateMode: model.signupValidate, - validator: (value) => Validator.validateName(value), + validator: (value) => Validator.validateName(value!), focusNode: model.name, textInputAction: TextInputAction.next, controller: model.signupNameController, @@ -362,7 +368,7 @@ class _AuthScreenState extends State horizontal: 10, vertical: 10.0), child: TextFormField( autovalidateMode: model.signupValidate, - validator: (value) => Validator.validateEmail(value), + validator: (value) => Validator.validateEmail(value!), focusNode: model.email, textInputAction: TextInputAction.next, controller: model.signupEmailController, @@ -391,7 +397,7 @@ class _AuthScreenState extends State focusNode: model.password, textInputAction: TextInputAction.done, validator: (value) => - Validator.validatePassword(value), + Validator.validatePassword(value!), controller: model.signupPasswordController, obscureText: model.obscureTextSignup, style: TextStyle(fontSize: 16.0, color: Colors.black), diff --git a/lib/views/base_view.dart b/lib/views/base_view.dart index e7444e2c..462deba1 100644 --- a/lib/views/base_view.dart +++ b/lib/views/base_view.dart @@ -7,8 +7,8 @@ class BaseView extends StatefulWidget { @required this.builder, this.onModelReady, }); - final Function(T) onModelReady; - final Widget Function(BuildContext, T, Widget) builder; + final Function(T)? onModelReady; + final Widget Function(BuildContext, T?, Widget?)? builder; @override _BaseViewState createState() => _BaseViewState(); @@ -19,11 +19,9 @@ class _BaseViewState extends State> { @override void initState() { - if (widget.onModelReady != null) { - widget.onModelReady( - model, - ); - } + widget.onModelReady!( + model, + ); super.initState(); } @@ -34,7 +32,7 @@ class _BaseViewState extends State> { return ChangeNotifierProvider( create: (context) => model, child: Consumer( - builder: widget.builder, + builder: widget.builder!, ), ); } diff --git a/lib/views/group_screen.dart b/lib/views/group_screen.dart index 68be5672..600a130f 100644 --- a/lib/views/group_screen.dart +++ b/lib/views/group_screen.dart @@ -9,7 +9,7 @@ import 'package:beacon/utilities/constants.dart'; import 'package:beacon/view_model/group_screen_view_model.dart'; import 'package:beacon/views/base_view.dart'; import 'package:flutter/material.dart'; -import 'package:modal_progress_hud/modal_progress_hud.dart'; +import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; import 'package:sizer/sizer.dart'; import '../models/group/group.dart'; @@ -29,17 +29,18 @@ class _GroupScreenState extends State @override void initState() { - fetchingUserBeacons = databaseFunctions.fetchUserBeacons(widget.group.id); + fetchingUserBeacons = databaseFunctions.fetchUserBeacons(widget.group.id!); fetchingNearbyBeacons = - databaseFunctions.fetchNearbyBeacon(widget.group.id); + databaseFunctions.fetchNearbyBeacon(widget.group.id!); super.initState(); } void reloadList() { setState(() { - fetchingUserBeacons = databaseFunctions.fetchUserBeacons(widget.group.id); + fetchingUserBeacons = + databaseFunctions.fetchUserBeacons(widget.group.id!); fetchingNearbyBeacons = - databaseFunctions.fetchNearbyBeacon(widget.group.id); + databaseFunctions.fetchNearbyBeacon(widget.group.id!); }); } @@ -47,7 +48,7 @@ class _GroupScreenState extends State Widget build(BuildContext context) { return BaseView(builder: (context, model, child) { TabController tabController = new TabController(length: 2, vsync: this); - return model.isBusy + return model!.isBusy ? LoadingScreen() : Scaffold( resizeToAvoidBottomInset: false, @@ -75,7 +76,7 @@ class _GroupScreenState extends State child: Container( width: MediaQuery.of(context).size.width * 0.6, child: Text( - 'Welcome to Group ' + widget.group.title, + 'Welcome to Group ' + widget.group.title!, textAlign: TextAlign.center, style: TextStyle( fontSize: 25, @@ -96,14 +97,14 @@ class _GroupScreenState extends State actionsAlignment: MainAxisAlignment.spaceEvenly, title: Text( - (userConfig.currentUser.isGuest) + (userConfig.currentUser.isGuest!) ? 'Create Account' : 'Logout', style: TextStyle( fontSize: 25, color: kYellow), ), content: Text( - (userConfig.currentUser.isGuest) + (userConfig.currentUser.isGuest!) ? 'Would you like to create an account?' : 'Are you sure you wanna logout?', style: TextStyle( @@ -131,7 +132,7 @@ class _GroupScreenState extends State ], )), backgroundColor: kYellow, - child: (userConfig.currentUser.isGuest) + child: (userConfig.currentUser.isGuest!) ? Icon(Icons.person) : Icon(Icons.logout), ), @@ -153,7 +154,7 @@ class _GroupScreenState extends State borderColor: Colors.white, buttonColor: kYellow, onTap: () { - if (userConfig.currentUser.isGuest) { + if (userConfig.currentUser.isGuest!) { navigationService.showSnackBar( 'You need to login with credentials to start a hike'); } else { @@ -161,7 +162,7 @@ class _GroupScreenState extends State context, model, reloadList, - widget.group.id); + widget.group.id!); } }, ), @@ -227,14 +228,16 @@ class _GroupScreenState extends State if (snapshot.hasError) { return Center( child: Text( - snapshot.error.toString(), - textAlign: TextAlign.center, - textScaleFactor: 1.3, - ), + snapshot.error.toString(), + textAlign: + TextAlign.center, + textScaler: + TextScaler.linear( + 1.3)), ); } final List posts = - snapshot.data; + snapshot.data as List; return Container( alignment: Alignment.center, child: posts.length == 0 @@ -298,7 +301,7 @@ class _GroupScreenState extends State scrollDirection: Axis.vertical, itemCount: - posts?.length, + posts.length, padding: EdgeInsets.all(8), itemBuilder: @@ -345,9 +348,9 @@ class _GroupScreenState extends State ); } - final posts = snapshot.data; - if (posts == null || - posts.length == 0) { + final posts = snapshot.data + as List; + if (posts.length == 0) { return SingleChildScrollView( physics: AlwaysScrollableScrollPhysics(), diff --git a/lib/views/hike_screen.dart b/lib/views/hike_screen.dart index 67a20dfe..ab50ca01 100644 --- a/lib/views/hike_screen.dart +++ b/lib/views/hike_screen.dart @@ -9,48 +9,50 @@ import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:intl/intl.dart'; -import 'package:modal_progress_hud/modal_progress_hud.dart'; - import 'package:beacon/components/hike_screen_widget.dart'; import 'package:beacon/models/beacon/beacon.dart'; import 'package:beacon/utilities/constants.dart'; +import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; import 'package:sizer/sizer.dart'; import 'package:sliding_up_panel/sliding_up_panel.dart'; class HikeScreen extends StatefulWidget { - final Beacon beacon; - final bool isLeader; + final Beacon? beacon; + final bool? isLeader; HikeScreen(this.beacon, {this.isLeader}); @override _HikeScreenState createState() => _HikeScreenState(); } class _HikeScreenState extends State { - double screenHeight, screenWidth; + double? screenHeight, screenWidth; @override Widget build(BuildContext context) { screenHeight = MediaQuery.of(context).size.height; screenWidth = MediaQuery.of(context).size.width; return BaseView( onModelReady: (m) { - m.initialise(widget.beacon, widget.isLeader); + m.initialise(widget.beacon!, widget.isLeader!); }, builder: (ctx, model, child) { - if (!model.modelIsReady) { + if (!model!.modelIsReady) { return Scaffold( body: Center( child: LoadingScreen(), ), ); } - return WillPopScope( - onWillPop: () => model.onWillPop(context), + return PopScope( + canPop: true, + onPopInvoked: (value) { + model.onWillPop(context); + }, child: Scaffold( body: SafeArea( child: ModalProgressHUD( - inAsyncCall: model.isGeneratingLink || model.isBusy, + inAsyncCall: model.isGeneratingLink! || model.isBusy, child: SlidingUpPanel( maxHeight: 60.h, minHeight: 20.h, @@ -99,9 +101,9 @@ class _HikeScreenState extends State { style: TextStyle(fontWeight: FontWeight.bold), children: [ TextSpan( - text: model.isBeaconExpired + text: model.isBeaconExpired! ? 'Beacon has been expired\n' - : 'Beacon expiring at ${widget.beacon.expiresAt == null ? '' : DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(widget.beacon.expiresAt)).toString()}\n', + : 'Beacon expiring at ${widget.beacon == null ? '' : DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(widget.beacon!.expiresAt!)).toString()}\n', style: TextStyle(fontSize: 18), ), TextSpan( @@ -115,9 +117,9 @@ class _HikeScreenState extends State { style: TextStyle(fontSize: 12), ), TextSpan( - text: model.isBeaconExpired + text: model.isBeaconExpired! ? '' - : 'Share this passkey to add user: ${widget.beacon.shortcode}\n', + : 'Share this passkey to add user: ${widget.beacon!.shortcode}\n', style: TextStyle(fontSize: 12), ), ], @@ -130,7 +132,7 @@ class _HikeScreenState extends State { ), ), panel: HikeScreenWidget.panel( - model.scrollController, model, context, widget.isLeader), + model.scrollController, model, context, widget.isLeader!), body: Stack( alignment: Alignment.topCenter, children: [ @@ -148,8 +150,8 @@ class _HikeScreenState extends State { polylines: model.polylines, initialCameraPosition: CameraPosition( target: LatLng( - double.parse(widget.beacon.location.lat), - double.parse(widget.beacon.location.lon), + double.parse(widget.beacon!.location!.lat!), + double.parse(widget.beacon!.location!.lon!), ), zoom: CAMERA_ZOOM, tilt: CAMERA_TILT, @@ -164,7 +166,7 @@ class _HikeScreenState extends State { if (model.panelController.isPanelOpen) model.panelController.close(); else { - String title; + String? title; HikeScreenWidget .showCreateLandMarkDialogueDialog( context, @@ -178,15 +180,14 @@ class _HikeScreenState extends State { ), Align( alignment: Alignment(0.9, -0.98), - child: model.isBeaconExpired + child: model.isBeaconExpired! ? Container() : HikeScreenWidget.shareButton( - context, widget.beacon.shortcode)), + context, widget.beacon!.shortcode!)), Align( alignment: Alignment(-0.9, -0.98), child: FloatingActionButton( onPressed: () { - //TODO: back to group screen navigationService.pop(); }, backgroundColor: kYellow, @@ -197,18 +198,21 @@ class _HikeScreenState extends State { ), ), ), - if (!model.isBeaconExpired) + if (!model.isBeaconExpired!) //show the routeSharebutton only when beacon is active(?) and mapcontroller is ready. Align( - alignment: screenHeight > 800 + alignment: screenHeight! > 800 ? Alignment(0.9, -0.8) : Alignment(0.9, -0.77), child: AnimatedOpacity( duration: Duration(milliseconds: 500), opacity: model.mapController.isCompleted ? 1.0 : 0.0, - child: HikeScreenWidget.shareRouteButton(context, - model.beacon, model.mapController, model.route), + child: HikeScreenWidget.shareRouteButton( + context, + model.beacon!, + model.mapController, + model.route), ), ), ], diff --git a/lib/views/home_screen.dart b/lib/views/home_screen.dart index c855ff4d..237564cd 100644 --- a/lib/views/home_screen.dart +++ b/lib/views/home_screen.dart @@ -9,14 +9,14 @@ import 'package:beacon/utilities/constants.dart'; import 'package:beacon/views/base_view.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:modal_progress_hud/modal_progress_hud.dart'; +import 'package:modal_progress_hud_nsn/modal_progress_hud_nsn.dart'; import 'package:sizer/sizer.dart'; import '../components/group_card.dart'; import '../view_model/home_screen_view_model.dart'; class MainScreen extends StatefulWidget { - const MainScreen({Key key}) : super(key: key); + const MainScreen({Key? key}) : super(key: key); @override _MainScreenState createState() => _MainScreenState(); } @@ -24,39 +24,45 @@ class MainScreen extends StatefulWidget { class _MainScreenState extends State with TickerProviderStateMixin { var fetchingUserGroups; Future _onPopHome() async { - return showDialog( - context: context, - builder: (context) => AlertDialog( - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(10.0), - ), - actionsAlignment: MainAxisAlignment.spaceEvenly, - contentPadding: EdgeInsets.all(25.0), - title: Text( - 'Confirm Exit', - style: TextStyle(fontSize: 25, color: kYellow), - ), - content: Text( - 'Do you really want to exit?', - style: TextStyle(fontSize: 18, color: kBlack), - ), - actions: [ - HikeButton( - buttonHeight: 2.5.h, - buttonWidth: 8.w, - onTap: () => Navigator.of(context).pop(false), - text: 'No', + return await showDialog( + context: context, + builder: (context) => AlertDialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + actionsAlignment: MainAxisAlignment.spaceEvenly, + contentPadding: EdgeInsets.all(25.0), + title: Text( + 'Confirm Exit', + style: TextStyle(fontSize: 25, color: kYellow), + ), + content: Text( + 'Do you really want to exit?', + style: TextStyle(fontSize: 18, color: kBlack), + ), + actions: [ + HikeButton( + buttonHeight: 2.5.h, + buttonWidth: 8.w, + onTap: () { + Navigator.of(context).pop(false); + return false; + }, + text: 'No', + ), + HikeButton( + buttonHeight: 2.5.h, + buttonWidth: 8.w, + onTap: () { + SystemChannels.platform.invokeMethod('SystemNavigator.pop'); + return true; + }, + text: 'Yes', + ), + ], ), - HikeButton( - buttonHeight: 2.5.h, - buttonWidth: 8.w, - onTap: () => - SystemChannels.platform.invokeMethod('SystemNavigator.pop'), - text: 'Yes', - ), - ], - ), - ); + ) ?? + false; } @override @@ -73,11 +79,14 @@ class _MainScreenState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: _onPopHome, + return PopScope( + canPop: true, + onPopInvoked: (value) { + _onPopHome(); + }, child: BaseView(builder: (context, model, child) { TabController tabController = new TabController(length: 1, vsync: this); - return model.isBusy + return model!.isBusy ? LoadingScreen() : Scaffold( resizeToAvoidBottomInset: false, @@ -104,14 +113,14 @@ class _MainScreenState extends State with TickerProviderStateMixin { actionsAlignment: MainAxisAlignment.spaceEvenly, title: Text( - (userConfig.currentUser.isGuest) + (userConfig.currentUser.isGuest!) ? 'Create Account' : 'Logout', style: TextStyle( fontSize: 25, color: kYellow), ), content: Text( - (userConfig.currentUser.isGuest) + (userConfig.currentUser.isGuest!) ? 'Would you like to create an account?' : 'Are you sure you wanna logout?', style: TextStyle( @@ -139,7 +148,7 @@ class _MainScreenState extends State with TickerProviderStateMixin { ], )), backgroundColor: kYellow, - child: (userConfig.currentUser.isGuest) + child: (userConfig.currentUser.isGuest!) ? Icon(Icons.person) : Icon(Icons.logout), ), @@ -161,7 +170,7 @@ class _MainScreenState extends State with TickerProviderStateMixin { borderColor: Colors.white, buttonColor: kYellow, onTap: () { - if (userConfig.currentUser.isGuest) { + if (userConfig.currentUser.isGuest!) { navigationService.showSnackBar( 'You need to login with credentials to be able to create a group'); } else { @@ -233,12 +242,15 @@ class _MainScreenState extends State with TickerProviderStateMixin { snapshot.error.toString(), textAlign: TextAlign.center, - textScaleFactor: 1.3, + textScaler: + TextScaler.linear( + 1.5), ), ); } final List posts = - snapshot.data; + snapshot.data + as List; return Container( alignment: Alignment.center, child: posts.length == 0 @@ -301,7 +313,7 @@ class _MainScreenState extends State with TickerProviderStateMixin { scrollDirection: Axis.vertical, itemCount: - posts?.length, + posts.length, padding: EdgeInsets.all( 8), diff --git a/pubspec.lock b/pubspec.lock index 95dc7a97..434f9c5f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,254 +5,298 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - url: "https://pub.dartlang.org" + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + url: "https://pub.dev" source: hosted - version: "47.0.0" + version: "64.0.0" analyzer: dependency: transitive description: name: analyzer - url: "https://pub.dartlang.org" + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + url: "https://pub.dev" source: hosted - version: "4.7.0" + version: "6.2.0" archive: dependency: transitive description: name: archive - url: "https://pub.dartlang.org" + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" + url: "https://pub.dev" source: hosted - version: "3.3.6" + version: "3.4.10" args: dependency: transitive description: name: args - url: "https://pub.dartlang.org" + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.9.0" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" build: dependency: transitive description: name: build - url: "https://pub.dartlang.org" + sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.1" build_config: dependency: transitive description: name: build_config - url: "https://pub.dartlang.org" + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" source: hosted version: "1.1.1" build_daemon: dependency: transitive description: name: build_daemon - url: "https://pub.dartlang.org" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" + url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.1" build_resolvers: dependency: transitive description: name: build_resolvers - url: "https://pub.dartlang.org" + sha256: "339086358431fa15d7eca8b6a36e5d783728cf025e559b834f4609a1fcfb7b0a" + url: "https://pub.dev" source: hosted - version: "2.0.10" + version: "2.4.2" build_runner: dependency: "direct dev" description: name: build_runner - url: "https://pub.dartlang.org" + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" + url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.8" build_runner_core: dependency: transitive description: name: build_runner_core - url: "https://pub.dartlang.org" + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" + url: "https://pub.dev" source: hosted - version: "7.2.7" + version: "7.3.0" built_collection: dependency: transitive description: name: built_collection - url: "https://pub.dartlang.org" + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" source: hosted version: "5.1.1" built_value: dependency: transitive description: name: built_value - url: "https://pub.dartlang.org" + sha256: a3ec2e0f967bc47f69f95009bb93db936288d61d5343b9436e378b28a2f830c6 + url: "https://pub.dev" source: hosted - version: "8.4.3" + version: "8.9.0" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: name: checked_yaml - url: "https://pub.dartlang.org" + sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + url: "https://pub.dev" source: hosted - version: "2.0.2" + version: "2.0.3" cli_util: dependency: transitive description: name: cli_util - url: "https://pub.dartlang.org" + sha256: c05b7406fdabc7a49a3929d4af76bcaccbbffcbcdcf185b082e1ae07da323d19 + url: "https://pub.dev" source: hosted - version: "0.3.5" + version: "0.4.1" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted version: "1.1.1" code_builder: dependency: transitive description: name: code_builder - url: "https://pub.dartlang.org" + sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.10.0" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.18.0" connectivity_plus: dependency: "direct main" description: name: connectivity_plus - url: "https://pub.dartlang.org" + sha256: "224a77051d52a11fbad53dd57827594d3bd24f945af28bd70bab376d68d437f0" + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "5.0.2" connectivity_plus_platform_interface: dependency: transitive description: name: connectivity_plus_platform_interface - url: "https://pub.dartlang.org" + sha256: cf1d1c28f4416f8c654d7dc3cd638ec586076255d407cef3ddbdaf178272a71a + url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.2.4" convert: dependency: transitive description: name: convert - url: "https://pub.dartlang.org" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" source: hosted version: "3.1.1" coverage: dependency: transitive description: name: coverage - url: "https://pub.dartlang.org" + sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + url: "https://pub.dev" source: hosted - version: "1.6.2" + version: "1.7.2" cross_file: dependency: transitive description: name: cross_file - url: "https://pub.dartlang.org" + sha256: fedaadfa3a6996f75211d835aaeb8fede285dae94262485698afd832371b9a5e + url: "https://pub.dev" source: hosted - version: "0.3.3+4" + version: "0.3.3+8" crypto: dependency: transitive description: name: crypto - url: "https://pub.dartlang.org" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.3" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" dart_style: dependency: transitive description: name: dart_style - url: "https://pub.dartlang.org" + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" + url: "https://pub.dev" source: hosted - version: "2.2.4" - data_connection_checker: + version: "2.3.4" + data_connection_checker_nulls: dependency: "direct main" description: - name: data_connection_checker - url: "https://pub.dartlang.org" + name: data_connection_checker_nulls + sha256: "86a67945b1c78f17d094ea175a4b0be4a20bcd89146ce5523974b614693091e2" + url: "https://pub.dev" source: hosted - version: "0.3.4" + version: "0.0.2" date_time_picker: dependency: "direct main" description: name: date_time_picker - url: "https://pub.dartlang.org" + sha256: "6923c568bcb67a66ab7e083708d0adbcae8214b41bb84d49febc17e89e06fc4a" + url: "https://pub.dev" source: hosted version: "2.1.0" dbus: dependency: transitive description: name: dbus - url: "https://pub.dartlang.org" + sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" + url: "https://pub.dev" source: hosted - version: "0.7.8" + version: "0.7.10" duration_picker: dependency: "direct main" description: name: duration_picker - url: "https://pub.dartlang.org" + sha256: "052b34dac04c29f3849bb3817a26c5aebe9e5f0697c3a374be87db2b84d75753" + url: "https://pub.dev" source: hosted version: "1.1.1" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted version: "1.3.1" ffi: dependency: transitive description: name: ffi - url: "https://pub.dartlang.org" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.1.0" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" fixnum: dependency: transitive description: name: fixnum - url: "https://pub.dartlang.org" + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -262,79 +306,90 @@ packages: dependency: "direct main" description: name: flutter_animarker - url: "https://pub.dartlang.org" + sha256: d95448cc1776bc8e17aea3b24c01f3b7565c6eab394f708bc9fa9f7763e9dd77 + url: "https://pub.dev" source: hosted version: "3.2.0" flutter_config: dependency: "direct main" description: name: flutter_config - url: "https://pub.dartlang.org" + sha256: a07e6156bb6e776e29c6357be433155acda87d1dab1a3f787a72091a1b71ffbf + url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.2" flutter_countdown_timer: dependency: "direct main" description: name: flutter_countdown_timer - url: "https://pub.dartlang.org" + sha256: dfcbd7d6f76a5589f78f3f3ba2f9ea2e199368eccc1adce4153ce985b9587bc5 + url: "https://pub.dev" source: hosted version: "4.1.0" flutter_hooks: dependency: transitive description: name: flutter_hooks - url: "https://pub.dartlang.org" + sha256: cde36b12f7188c85286fba9b38cc5a902e7279f36dd676967106c041dc9dde70 + url: "https://pub.dev" source: hosted - version: "0.18.5+1" + version: "0.20.5" flutter_launcher_icons: dependency: "direct dev" description: name: flutter_launcher_icons - url: "https://pub.dartlang.org" + sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea" + url: "https://pub.dev" source: hosted - version: "0.11.0" + version: "0.13.1" flutter_local_notifications: dependency: "direct main" description: name: flutter_local_notifications - url: "https://pub.dartlang.org" + sha256: c18f1de98fe0bb9dd5ba91e1330d4febc8b6a7de6aae3ffe475ef423723e72f3 + url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "16.3.2" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux - url: "https://pub.dartlang.org" + sha256: "33f741ef47b5f63cc7f78fe75eeeac7e19f171ff3c3df054d84c1e38bedb6a03" + url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.0+1" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - url: "https://pub.dartlang.org" + sha256: "7cf643d6d5022f3baed0be777b0662cce5919c0a7b86e700299f22dc4ae660ef" + url: "https://pub.dev" source: hosted - version: "6.0.0" + version: "7.0.0+1" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - url: "https://pub.dartlang.org" + sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.17" flutter_polyline_points: dependency: "direct main" description: name: flutter_polyline_points - url: "https://pub.dartlang.org" + sha256: "0e07862139cb65a88789cd6efbe284c0b6f1fcb5ed5ec87781759c48190d84b9" + url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "2.0.0" flutter_spinkit: dependency: "direct main" description: name: flutter_spinkit - url: "https://pub.dartlang.org" + sha256: b39c753e909d4796906c5696a14daf33639a76e017136c8d82bf3e620ce5bb8e + url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.2.0" flutter_test: dependency: "direct dev" description: flutter @@ -349,16 +404,18 @@ packages: dependency: "direct main" description: name: fluttertoast - url: "https://pub.dartlang.org" + sha256: dfdde255317af381bfc1c486ed968d5a43a2ded9c931e87cbecd88767d6a71c1 + url: "https://pub.dev" source: hosted - version: "8.1.2" + version: "8.2.4" frontend_server_client: dependency: transitive description: name: frontend_server_client - url: "https://pub.dartlang.org" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "3.2.0" geocoder: dependency: "direct main" description: @@ -372,562 +429,674 @@ packages: dependency: "direct main" description: name: geolocator - url: "https://pub.dartlang.org" + sha256: e946395fc608842bb2f6c914807e9183f86f3cb787f6b8f832753e5251036f02 + url: "https://pub.dev" source: hosted - version: "9.0.2" + version: "10.1.0" geolocator_android: dependency: transitive description: name: geolocator_android - url: "https://pub.dartlang.org" + sha256: "136f1c97e1903366393bda514c5d9e98843418baea52899aa45edae9af8a5cd6" + url: "https://pub.dev" source: hosted - version: "4.1.7" + version: "4.5.2" geolocator_apple: dependency: transitive description: name: geolocator_apple - url: "https://pub.dartlang.org" + sha256: "79babf44b692ec5e789d322dc736ef71586056e8e6828f747c9e005456b248bf" + url: "https://pub.dev" source: hosted - version: "2.2.5" + version: "2.3.5" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - url: "https://pub.dartlang.org" + sha256: "3b95ecdc36462c47dbc535dcfedea774d03ccd1f3c9864e0a02ad088eeff4508" + url: "https://pub.dev" source: hosted - version: "4.0.7" + version: "4.2.1" geolocator_web: dependency: transitive description: name: geolocator_web - url: "https://pub.dartlang.org" + sha256: "102e7da05b48ca6bf0a5bda0010f886b171d1a08059f01bfe02addd0175ebece" + url: "https://pub.dev" source: hosted - version: "2.1.6" + version: "2.2.1" geolocator_windows: dependency: transitive description: name: geolocator_windows - url: "https://pub.dartlang.org" + sha256: a92fae29779d5c6dc60e8411302f5221ade464968fe80a36d330e80a71f087af + url: "https://pub.dev" source: hosted - version: "0.1.1" + version: "0.2.2" get_it: dependency: "direct main" description: name: get_it - url: "https://pub.dartlang.org" + sha256: e6017ce7fdeaf218dc51a100344d8cb70134b80e28b760f8bb23c242437bafd7 + url: "https://pub.dev" source: hosted - version: "7.2.0" + version: "7.6.7" glob: dependency: transitive description: name: glob - url: "https://pub.dartlang.org" + sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" + google_maps: + dependency: transitive + description: + name: google_maps + sha256: "555d5d736339b0478e821167ac521c810d7b51c3b2734e6802a9f046b64ea37a" + url: "https://pub.dev" + source: hosted + version: "6.3.0" google_maps_flutter: dependency: "direct main" description: name: google_maps_flutter - url: "https://pub.dartlang.org" + sha256: ae66fef3e71261d7df2eff29b2a119e190b2884325ecaa55321b1e17b5504066 + url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.5.3" google_maps_flutter_android: dependency: transitive description: name: google_maps_flutter_android - url: "https://pub.dartlang.org" + sha256: "714530f865f13bb3b9505c58821c3baed5d247a871724acf5d2ea5808fbed02c" + url: "https://pub.dev" source: hosted - version: "2.4.3" + version: "2.6.2" google_maps_flutter_ios: dependency: transitive description: name: google_maps_flutter_ios - url: "https://pub.dartlang.org" + sha256: c89556ed0338fcb4b843c9fcdafac7ad2df601c8b41286d82f0727f7f66434e4 + url: "https://pub.dev" source: hosted - version: "2.1.13" + version: "2.3.6" google_maps_flutter_platform_interface: dependency: transitive description: name: google_maps_flutter_platform_interface - url: "https://pub.dartlang.org" + sha256: "6060779f020638a8eedeb0fb14234818e5fa32ec45a4653d6428ab436e2bbc64" + url: "https://pub.dev" + source: hosted + version: "2.4.3" + google_maps_flutter_web: + dependency: transitive + description: + name: google_maps_flutter_web + sha256: "6245721c160d6f531c1ef568cf9bef8d660cd585a982aa75121269030163785a" + url: "https://pub.dev" source: hosted - version: "2.2.5" + version: "0.5.4+3" gql: dependency: transitive description: name: gql - url: "https://pub.dartlang.org" + sha256: "5b39e4f5262e0a9675a97da1da3adae6a33eaa935513b074a2e5940327ffc058" + url: "https://pub.dev" source: hosted - version: "0.14.0" + version: "1.0.1-alpha+1706372327764" gql_dedupe_link: dependency: transitive description: name: gql_dedupe_link - url: "https://pub.dartlang.org" + sha256: e5359dd0c7a38f95e2b12f6ab305989a4e30028e4032825c8e9f610150999c69 + url: "https://pub.dev" source: hosted - version: "2.0.3+1" + version: "2.0.4-alpha+1705114623057" gql_error_link: dependency: transitive description: name: gql_error_link - url: "https://pub.dartlang.org" + sha256: "93901458f3c050e33386dedb0ca7173e08cebd7078e4e0deca4bf23ab7a71f63" + url: "https://pub.dev" source: hosted - version: "0.2.3+1" + version: "1.0.0+1" gql_exec: dependency: transitive description: name: gql_exec - url: "https://pub.dartlang.org" + sha256: "394944626fae900f1d34343ecf2d62e44eb984826189c8979d305f0ae5846e38" + url: "https://pub.dev" source: hosted - version: "0.4.3" + version: "1.1.1-alpha+1699813812660" gql_http_link: dependency: transitive description: name: gql_http_link - url: "https://pub.dartlang.org" + sha256: "1f922eed1b7078fdbfd602187663026f9f659fe9a9499e2207b5d5e01617f658" + url: "https://pub.dev" source: hosted - version: "0.4.5" + version: "1.0.1+1" gql_link: dependency: transitive description: name: gql_link - url: "https://pub.dartlang.org" + sha256: e97f41d0841ed7e40c766f2b9037af2c5adf36166e28c634fceb695b2a7a9ea7 + url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.0.1-alpha+1706372327781" gql_transform_link: dependency: transitive description: name: gql_transform_link - url: "https://pub.dartlang.org" + sha256: "0645fdd874ca1be695fd327271fdfb24c0cd6fa40774a64b946062f321a59709" + url: "https://pub.dev" source: hosted - version: "0.2.2+1" + version: "1.0.0" graphql: dependency: transitive description: name: graphql - url: "https://pub.dartlang.org" + sha256: d066e53446166c12537458386b507f7426f2b8801ebafc184576aab3cbc64d56 + url: "https://pub.dev" source: hosted - version: "5.1.2" + version: "5.2.0-beta.7" graphql_flutter: dependency: "direct main" description: name: graphql_flutter - url: "https://pub.dartlang.org" + sha256: "39b5e830bc654ab02c5b776c31675841d1a8c95840fdd284efba713b1d47e65d" + url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.2.0-beta.6" graphs: dependency: transitive description: name: graphs - url: "https://pub.dartlang.org" + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 + url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.1" hive: dependency: "direct main" description: name: hive - url: "https://pub.dartlang.org" + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" source: hosted version: "2.2.3" hive_generator: dependency: "direct dev" description: name: hive_generator - url: "https://pub.dartlang.org" + sha256: "06cb8f58ace74de61f63500564931f9505368f45f98958bd7a6c35ba24159db4" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "0.15.4" http: dependency: transitive description: name: http - url: "https://pub.dartlang.org" + sha256: a2bbf9d017fcced29139daa8ed2bba4ece450ab222871df93ca9eec6f80c34ba + url: "https://pub.dev" source: hosted - version: "0.13.5" + version: "1.2.0" http_multi_server: dependency: transitive description: name: http_multi_server - url: "https://pub.dartlang.org" + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" source: hosted version: "3.2.1" http_parser: dependency: transitive description: name: http_parser - url: "https://pub.dartlang.org" + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" source: hosted version: "4.0.2" image: dependency: transitive description: name: image - url: "https://pub.dartlang.org" + sha256: "49a0d4b0c12402853d3f227fe7c315601b238d126aa4caa5dbb2dcf99421aa4a" + url: "https://pub.dev" source: hosted - version: "3.3.0" + version: "4.1.6" intl: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91" + url: "https://pub.dev" source: hosted version: "0.17.0" io: dependency: transitive description: name: io - url: "https://pub.dartlang.org" + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" source: hosted version: "1.0.4" js: dependency: transitive description: name: js - url: "https://pub.dartlang.org" + 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 - url: "https://pub.dartlang.org" + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + url: "https://pub.dev" source: hosted - version: "4.8.0" + version: "4.8.1" location: dependency: "direct main" description: name: location - url: "https://pub.dartlang.org" + sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1" + url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "5.0.3" location_platform_interface: dependency: transitive description: name: location_platform_interface - url: "https://pub.dartlang.org" + sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1" + url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "3.1.2" location_web: dependency: transitive description: name: location_web - url: "https://pub.dartlang.org" + sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b + url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "4.2.0" logging: dependency: transitive description: name: logging - url: "https://pub.dartlang.org" + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" + url: "https://pub.dev" source: hosted - version: "0.12.12" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - url: "https://pub.dartlang.org" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" + url: "https://pub.dev" source: hosted - version: "0.1.5" + version: "0.5.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: a6e590c838b18133bb482a2745ad77c5bb7715fb0451209e1a7567d416678b8e + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.10.0" mime: dependency: transitive description: name: mime - url: "https://pub.dartlang.org" + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" mockito: dependency: "direct main" description: name: mockito - url: "https://pub.dartlang.org" + sha256: "6841eed20a7befac0ce07df8116c8b8233ed1f4486a7647c7fc5a02ae6163917" + url: "https://pub.dev" source: hosted - version: "5.3.2" - modal_progress_hud: + version: "5.4.4" + modal_progress_hud_nsn: dependency: "direct main" description: - name: modal_progress_hud - url: "https://pub.dartlang.org" + name: modal_progress_hud_nsn + sha256: "7d1b2eb50da63c994f8ec2da5738183dbc8235a528e840ecbf67439adb7a6cc2" + url: "https://pub.dev" source: hosted - version: "0.1.3" + version: "0.5.1" nested: dependency: transitive description: name: nested - url: "https://pub.dartlang.org" + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" source: hosted version: "1.0.0" nm: dependency: transitive description: name: nm - url: "https://pub.dartlang.org" + sha256: "2c9aae4127bdc8993206464fcc063611e0e36e72018696cd9631023a31b24254" + url: "https://pub.dev" source: hosted version: "0.5.0" node_preamble: dependency: transitive description: name: node_preamble - url: "https://pub.dartlang.org" + sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db" + url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "2.0.2" normalize: dependency: transitive description: name: normalize - url: "https://pub.dartlang.org" + sha256: "8a60e37de5b608eeaf9b839273370c71ebba445e9f73b08eee7725e0d92dbc43" + url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.8.2+1" overlay_support: dependency: "direct main" description: name: overlay_support - url: "https://pub.dartlang.org" + sha256: fc39389bfd94e6985e1e13b2a88a125fc4027608485d2d4e2847afe1b2bb339c + url: "https://pub.dev" source: hosted version: "2.1.0" package_config: dependency: transitive description: name: package_config - url: "https://pub.dartlang.org" + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" source: hosted version: "2.1.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" + url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_provider: dependency: "direct main" description: name: path_provider - url: "https://pub.dartlang.org" + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + url: "https://pub.dev" source: hosted - version: "2.0.12" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - url: "https://pub.dartlang.org" + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + url: "https://pub.dev" source: hosted - version: "2.0.22" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - url: "https://pub.dartlang.org" + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.2" path_provider_linux: dependency: transitive description: name: path_provider_linux - url: "https://pub.dartlang.org" + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.2.1" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface - url: "https://pub.dartlang.org" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" source: hosted - version: "2.0.5" + version: "2.1.2" path_provider_windows: dependency: transitive description: name: path_provider_windows - url: "https://pub.dartlang.org" + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.2.1" petitparser: dependency: transitive description: name: petitparser - url: "https://pub.dartlang.org" + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "6.0.2" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - url: "https://pub.dartlang.org" + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.8" pointycastle: dependency: transitive description: name: pointycastle - url: "https://pub.dartlang.org" + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + url: "https://pub.dev" source: hosted - version: "3.6.2" + version: "3.7.4" pool: dependency: transitive description: name: pool - url: "https://pub.dartlang.org" + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" source: hosted version: "1.5.1" - process: - dependency: transitive - description: - name: process - url: "https://pub.dartlang.org" - source: hosted - version: "4.2.4" provider: dependency: "direct main" description: name: provider - url: "https://pub.dartlang.org" + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" + url: "https://pub.dev" source: hosted - version: "6.0.5" + version: "6.1.1" pub_semver: dependency: transitive description: name: pub_semver - url: "https://pub.dartlang.org" + sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pubspec_parse: dependency: transitive description: name: pubspec_parse - url: "https://pub.dartlang.org" + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.2.3" rxdart: dependency: "direct main" description: name: rxdart - url: "https://pub.dartlang.org" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" + 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" share_plus: dependency: "direct main" description: name: share_plus - url: "https://pub.dartlang.org" + sha256: "3ef39599b00059db0990ca2e30fca0a29d8b37aae924d60063f8e0184cf20900" + url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "7.2.2" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - url: "https://pub.dartlang.org" + sha256: df08bc3a07d01f5ea47b45d03ffcba1fa9cd5370fb44b3f38c70e42cced0f956 + url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.3.1" shared_preferences: dependency: "direct main" description: name: shared_preferences - url: "https://pub.dartlang.org" + sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.2.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - url: "https://pub.dartlang.org" + sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + url: "https://pub.dev" source: hosted - version: "2.0.15" + version: "2.2.1" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - url: "https://pub.dartlang.org" + sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.5" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - url: "https://pub.dartlang.org" + sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.2" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - url: "https://pub.dartlang.org" + sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.3.2" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - url: "https://pub.dartlang.org" + sha256: "7b15ffb9387ea3e237bb7a66b8a23d2147663d391cafc5c8f37b2e7b4bde5d21" + url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.2.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - url: "https://pub.dartlang.org" + sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.3.2" shelf: dependency: transitive description: name: shelf - url: "https://pub.dartlang.org" + sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" shelf_packages_handler: dependency: transitive description: name: shelf_packages_handler - url: "https://pub.dartlang.org" + sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e" + url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" shelf_static: dependency: transitive description: name: shelf_static - url: "https://pub.dartlang.org" + sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.2" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - url: "https://pub.dartlang.org" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" + url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" sizer: dependency: "direct main" description: name: sizer - url: "https://pub.dartlang.org" + sha256: d2b3cb6cbc4a637f508dacd786bae55df31e5fc088044248a43e4fd1e050c117 + url: "https://pub.dev" source: hosted version: "2.0.15" skeleton_text: dependency: "direct main" description: name: skeleton_text - url: "https://pub.dartlang.org" + sha256: bacd536bf0664efe1cae53bcbd78c3d4040a120f300f69dc85d83f358471cc6c + url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.0.1" sky_engine: dependency: transitive description: flutter @@ -937,247 +1106,298 @@ packages: dependency: "direct main" description: name: sliding_up_panel - url: "https://pub.dartlang.org" + sha256: "578e90956a6212d1e406373250b2436a0f3afece29aee3c24c8360094d6cf968" + url: "https://pub.dev" source: hosted version: "2.0.0+1" source_gen: dependency: transitive description: name: source_gen - url: "https://pub.dartlang.org" + sha256: "14658ba5f669685cd3d63701d01b31ea748310f7ab854e471962670abcf57832" + url: "https://pub.dev" source: hosted - version: "1.2.6" + version: "1.5.0" source_helper: dependency: transitive description: name: source_helper - url: "https://pub.dartlang.org" + sha256: "6adebc0006c37dd63fe05bca0a929b99f06402fc95aa35bf36d67f5c06de01fd" + url: "https://pub.dev" source: hosted - version: "1.3.3" + version: "1.3.4" source_map_stack_trace: dependency: transitive description: name: source_map_stack_trace - url: "https://pub.dartlang.org" + sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae" + url: "https://pub.dev" source: hosted version: "2.1.1" source_maps: dependency: transitive description: name: source_maps - url: "https://pub.dartlang.org" + sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703" + url: "https://pub.dev" source: hosted - version: "0.10.11" + version: "0.10.12" source_span: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" stream_transform: dependency: transitive description: name: stream_transform - url: "https://pub.dartlang.org" + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" source: hosted version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted version: "1.2.1" test: dependency: "direct dev" description: name: test - url: "https://pub.dartlang.org" + sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f + url: "https://pub.dev" source: hosted - version: "1.21.4" + version: "1.24.9" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.4.12" + version: "0.6.1" test_core: dependency: transitive description: name: test_core - url: "https://pub.dartlang.org" + sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a + url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.9" timezone: dependency: transitive description: name: timezone - url: "https://pub.dartlang.org" + sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0" + url: "https://pub.dev" source: hosted - version: "0.9.1" + version: "0.9.2" timing: dependency: transitive description: name: timing - url: "https://pub.dartlang.org" + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" source: hosted version: "1.0.1" typed_data: dependency: transitive description: name: typed_data - url: "https://pub.dartlang.org" + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" source: hosted - version: "1.3.1" + version: "1.3.2" uni_links: dependency: "direct main" description: name: uni_links - url: "https://pub.dartlang.org" + sha256: "051098acfc9e26a9fde03b487bef5d3d228ca8f67693480c6f33fd4fbb8e2b6e" + url: "https://pub.dev" source: hosted version: "0.5.1" uni_links_platform_interface: dependency: transitive description: name: uni_links_platform_interface - url: "https://pub.dartlang.org" + sha256: "929cf1a71b59e3b7c2d8a2605a9cf7e0b125b13bc858e55083d88c62722d4507" + url: "https://pub.dev" source: hosted version: "1.0.0" uni_links_web: dependency: transitive description: name: uni_links_web - url: "https://pub.dartlang.org" + sha256: "7539db908e25f67de2438e33cc1020b30ab94e66720b5677ba6763b25f6394df" + url: "https://pub.dev" source: hosted version: "0.1.0" universal_io: dependency: transitive description: name: universal_io - url: "https://pub.dartlang.org" + sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad" + url: "https://pub.dev" source: hosted - version: "2.0.4" + version: "2.2.2" url_launcher_linux: dependency: transitive description: name: url_launcher_linux - url: "https://pub.dartlang.org" + sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.1" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - url: "https://pub.dartlang.org" + sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f + url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.3.1" url_launcher_web: dependency: transitive description: name: url_launcher_web - url: "https://pub.dartlang.org" + sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.2.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - url: "https://pub.dartlang.org" + sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.1.1" uuid: dependency: transitive description: name: uuid - url: "https://pub.dartlang.org" + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + url: "https://pub.dev" source: hosted - version: "3.0.7" + version: "4.3.3" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dartlang.org" + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" source: hosted - version: "9.4.0" + version: "13.0.0" watcher: dependency: transitive description: name: watcher - url: "https://pub.dartlang.org" + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web: + dependency: transitive + description: + name: web + sha256: afe077240a270dcfd2aafe77602b4113645af95d0ad31128cc02bce5ac5d5152 + url: "https://pub.dev" source: hosted - version: "1.0.2" + version: "0.3.0" web_socket_channel: dependency: transitive description: name: web_socket_channel - url: "https://pub.dartlang.org" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.0" webkit_inspection_protocol: dependency: transitive description: name: webkit_inspection_protocol - url: "https://pub.dartlang.org" + sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" win32: dependency: transitive description: name: win32 - url: "https://pub.dartlang.org" + sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" + url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "5.2.0" xdg_directories: dependency: transitive description: name: xdg_directories - url: "https://pub.dartlang.org" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d + url: "https://pub.dev" source: hosted - version: "0.2.0+3" + version: "1.0.4" xml: dependency: transitive description: name: xml - url: "https://pub.dartlang.org" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 + url: "https://pub.dev" source: hosted - version: "6.1.0" + version: "6.5.0" yaml: dependency: transitive description: name: yaml - url: "https://pub.dartlang.org" + sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" sdks: - dart: ">=2.18.0 <3.0.0" - flutter: ">=3.0.0" + dart: ">=3.2.0 <4.0.0" + flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index 14837f45..eb6a7fc0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,54 +6,54 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=3.1.2 <4.0.0" dependencies: - connectivity_plus: ^3.0.2 - cupertino_icons: ^1.0.2 - data_connection_checker: ^0.3.4 + connectivity_plus: ^5.0.2 + cupertino_icons: ^1.0.6 + data_connection_checker_nulls: ^0.0.2 date_time_picker: ^2.1.0 duration_picker: ^1.1.0+1 flutter: sdk: flutter flutter_animarker: ^3.2.0 - flutter_config: ^2.0.0 + flutter_config: ^2.0.2 flutter_countdown_timer: ^4.1.0 - flutter_local_notifications: ^13.0.0 - flutter_polyline_points: ^1.0.0 - flutter_spinkit: ^5.1.0 - fluttertoast: ^8.0.8 + flutter_local_notifications: ^16.3.2 + flutter_polyline_points: ^2.0.0 + flutter_spinkit: ^5.2.0 + fluttertoast: ^8.2.4 geocoder: git: url: https://github.com/nguyenxdat/flutter_geocoder.git ref: 443b875d8ec80ce525cc6e8f17dfbbbbe7fa3028 - geolocator: ^9.0.2 - get_it: ^7.2.0 - google_maps_flutter: ^2.0.5 - graphql_flutter: ^5.1.0 - hive: ^2.0.4 + geolocator: ^10.1.0 + get_it: ^7.6.7 + google_maps_flutter: ^2.5.3 + graphql_flutter: ^5.1.2 + hive: ^2.2.3 intl: ^0.17.0 - location: ^4.3.0 - mockito: ^5.3.2 - modal_progress_hud: ^0.1.3 - overlay_support: ^2.0.1 - path_provider: ^2.0.9 - provider: ^6.0.3 - rxdart: ^0.27.3 - share_plus: ^6.3.0 - shared_preferences: ^2.0.13 + location: ^5.0.3 + mockito: ^5.4.4 + modal_progress_hud_nsn: ^0.5.1 + overlay_support: ^2.1.0 + path_provider: ^2.1.2 + provider: ^6.1.1 + rxdart: ^0.27.7 + share_plus: ^7.2.2 + shared_preferences: ^2.2.2 sizer: ^2.0.15 - skeleton_text: ^3.0.0 + skeleton_text: ^3.0.1 sliding_up_panel: ^2.0.0+1 uni_links: ^0.5.1 dev_dependencies: - build_runner: ^2.1.7 - flutter_launcher_icons: ^0.11.0 + build_runner: ^2.4.8 + flutter_launcher_icons: ^0.13.1 flutter_test: sdk: flutter - hive_generator: ^1.1.2 - test: ^1.21.1 + hive_generator: ^2.0.1 + test: ^1.24.9 flutter_icons: android: "launcher_icon" diff --git a/test/model_tests/beacon_test.dart b/test/model_tests/beacon_test.dart index 369b7711..4512b1b0 100644 --- a/test/model_tests/beacon_test.dart +++ b/test/model_tests/beacon_test.dart @@ -33,22 +33,22 @@ void main() { //title expect("new_beacon", beacon.title); //leader name - expect("test_leader", beacon.leader.name); + expect("test_leader", beacon.leader!.name); //follower id - expect("61fd509bf0c4c3219ce356ed", beacon.followers.first.id); + expect("61fd509bf0c4c3219ce356ed", beacon.followers!.first.id); //follower name - expect("test_leader", beacon.followers.first.name); + expect("test_leader", beacon.followers!.first.name); //follower location - expect("10", beacon.followers.first.location.lat); + expect("10", beacon.followers!.first.location!.lat); //longitude - expect("20", beacon.followers.first.location.lon); + expect("20", beacon.followers!.first.location!.lon); //landmark - expect("landmark", beacon.landmarks.first.title); - expect("1", beacon.landmarks.first.location.lat); - expect("2", beacon.landmarks.first.location.lon); + expect("landmark", beacon.landmarks!.first.title); + expect("1", beacon.landmarks!.first.location!.lat); + expect("2", beacon.landmarks!.first.location!.lon); //beacon location - expect("1", beacon.location.lat); - expect("2", beacon.location.lon); + expect("1", beacon.location!.lat); + expect("2", beacon.location!.lon); //starts at expect(1669746600000, beacon.startsAt); //expires at diff --git a/test/model_tests/user_test.dart b/test/model_tests/user_test.dart index a69b26a6..13a6ccc8 100644 --- a/test/model_tests/user_test.dart +++ b/test/model_tests/user_test.dart @@ -68,7 +68,7 @@ void main() { group('Testing User Model', () { test('User.fromJson method works or not: ', () { User user = User.fromJson(dummyJson); - Beacon beacon = user.beacon.first; + Beacon beacon = user.beacon!.first; //user id; expect("61fd509bf0c4c3219ce356ed", user.id); //name @@ -78,29 +78,29 @@ void main() { //isGuest expect(false, user.isGuest); //location - expect("10", user.location.lat); - expect("20", user.location.lon); + expect("10", user.location!.lat); + expect("20", user.location!.lon); //beacon id expect("61fd51b4f0c4c3219ce356f5", beacon.id); //title expect("new_beacon", beacon.title); //leader name - expect("test_user", beacon.leader.name); + expect("test_user", beacon.leader!.name); //follower id - expect("61fd509bf0c4c3219ce356ed", beacon.followers.first.id); + expect("61fd509bf0c4c3219ce356ed", beacon.followers!.first.id); //follower name - expect("test_user", beacon.followers.first.name); + expect("test_user", beacon.followers!.first.name); //follower location - expect("10", beacon.followers.first.location.lat); + expect("10", beacon.followers!.first.location!.lat); //longitude - expect("20", beacon.followers.first.location.lon); + expect("20", beacon.followers!.first.location!.lon); //landmark - expect("landmark_one", beacon.landmarks.first.title); - expect("1", beacon.landmarks.first.location.lat); - expect("2", beacon.landmarks.first.location.lon); + expect("landmark_one", beacon.landmarks!.first.title); + expect("1", beacon.landmarks!.first.location!.lat); + expect("2", beacon.landmarks!.first.location!.lon); //beacon location - expect("1", beacon.location.lat); - expect("2", beacon.location.lon); + expect("1", beacon.location!.lat); + expect("2", beacon.location!.lon); //starts at expect(1669746600000, beacon.startsAt); //expires at @@ -116,7 +116,7 @@ void main() { updateToUser.authToken = 'FinalAuthToken'; updateToUser.isGuest = true; user.update(updateToUser); - Beacon beacon = user.beacon.first; + Beacon beacon = user.beacon!.first; //auth token expect("FinalAuthToken", user.authToken); //userID @@ -128,29 +128,29 @@ void main() { //isGuest expect(true, user.isGuest); //location - expect("20", user.location.lat); - expect("10", user.location.lon); + expect("20", user.location!.lat); + expect("10", user.location!.lon); //beacon id expect("61fd51b4f0c4c3219ce3565f", beacon.id); //title expect("beacon_two", beacon.title); //leader name - expect("test_user_two", beacon.leader.name); + expect("test_user_two", beacon.leader!.name); //follower id - expect("61fd509bf0c4c3219ce356de", beacon.followers.first.id); + expect("61fd509bf0c4c3219ce356de", beacon.followers!.first.id); //follower name - expect("test_user_two", beacon.followers.first.name); + expect("test_user_two", beacon.followers!.first.name); //follower location - expect("20", beacon.followers.first.location.lat); + expect("20", beacon.followers!.first.location!.lat); //longitude - expect("10", beacon.followers.first.location.lon); + expect("10", beacon.followers!.first.location!.lon); //landmark - expect("landmark", beacon.landmarks.first.title); - expect("2", beacon.landmarks.first.location.lat); - expect("1", beacon.landmarks.first.location.lon); + expect("landmark", beacon.landmarks!.first.title); + expect("2", beacon.landmarks!.first.location!.lat); + expect("1", beacon.landmarks!.first.location!.lon); //beacon location - expect("2", beacon.location.lat); - expect("1", beacon.location.lon); + expect("2", beacon.location!.lat); + expect("1", beacon.location!.lon); //starts at expect(1669746600001, beacon.startsAt); //expires at From ea82e58fcc067f5524077fdfdedfaa17bd7ac28a Mon Sep 17 00:00:00 2001 From: afjal1 Date: Sat, 10 Feb 2024 17:29:46 +0530 Subject: [PATCH 3/3] Pulled Changes From #211 --- lib/components/beacon_card.dart | 3 +- lib/components/group_card.dart | 3 +- lib/services/shared_preference_service.dart | 2 +- lib/view_model/auth_screen_model.dart | 4 +- lib/view_model/hike_screen_model.dart | 3 +- pubspec.lock | 2 +- pubspec.yaml | 46 ++++++++++----------- 7 files changed, 31 insertions(+), 32 deletions(-) diff --git a/lib/components/beacon_card.dart b/lib/components/beacon_card.dart index f2f96032..c9541c80 100644 --- a/lib/components/beacon_card.dart +++ b/lib/components/beacon_card.dart @@ -45,8 +45,7 @@ class BeaconCustomWidgets { )); } else { await databaseFunctions.init(); - final Beacon? _beacon = - await databaseFunctions.joinBeacon(beacon.shortcode!); + await databaseFunctions.joinBeacon(beacon.shortcode!); if (!hasStarted) { navigationService.showSnackBar( 'Beacon has not yet started! \nPlease come back at ${DateFormat("hh:mm a, d/M/y").format(DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!)).toString()}', diff --git a/lib/components/group_card.dart b/lib/components/group_card.dart index 555b831a..f1a7c25f 100644 --- a/lib/components/group_card.dart +++ b/lib/components/group_card.dart @@ -28,8 +28,7 @@ class GroupCustomWidgets { )); } else { await databaseFunctions.init(); - final Group? _group = - await databaseFunctions.joinGroup(group.shortcode!); + await databaseFunctions.joinGroup(group.shortcode!); navigationService.pushScreen('/groupScreen', arguments: GroupScreen(group)); //Snackbar is displayed by joinBeacon itself on any error or trying to join expired beacon. diff --git a/lib/services/shared_preference_service.dart b/lib/services/shared_preference_service.dart index c2f9d1c8..87beaa34 100644 --- a/lib/services/shared_preference_service.dart +++ b/lib/services/shared_preference_service.dart @@ -6,7 +6,7 @@ class SharedPreferenceService { Future getSharedPreferencesInstance() async { _prefs = await SharedPreferences.getInstance().catchError((e) { print("shared preferences error : $e"); - //return false; + // return false; }); return true; } diff --git a/lib/view_model/auth_screen_model.dart b/lib/view_model/auth_screen_model.dart index 27f88ff3..99747977 100644 --- a/lib/view_model/auth_screen_model.dart +++ b/lib/view_model/auth_screen_model.dart @@ -45,7 +45,9 @@ class AuthViewModel extends BaseModel { signupValidate = AutovalidateMode.disabled; databaseFunctions.init(); final String signUpSuccess = await databaseFunctions.signup( - name: signupNameController.text ?? "Anonymous", + name: signupNameController.text.isEmpty + ? "Anonymous" + : signupNameController.text, email: signupEmailController.text, password: signupPasswordController.text); if (signUpSuccess == logSuccess) { diff --git a/lib/view_model/hike_screen_model.dart b/lib/view_model/hike_screen_model.dart index 9212be05..9c1af3b4 100644 --- a/lib/view_model/hike_screen_model.dart +++ b/lib/view_model/hike_screen_model.dart @@ -56,8 +56,7 @@ class HikeScreenViewModel extends BaseModel { else { if (beacon!.leader!.id == userConfig.currentUser.id) { await databaseFunctions.init(); - final changedLeader = - databaseFunctions.changeLeader(beacon!.id!, newLeaderID); + await databaseFunctions.changeLeader(beacon!.id!, newLeaderID); beacon!.leader!.id = newLeaderID; Fluttertoast.showToast(msg: 'Beacon handed over to $newLeaderName'); notifyListeners(); diff --git a/pubspec.lock b/pubspec.lock index 434f9c5f..748f8bf5 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1399,5 +1399,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.2.0 <4.0.0" + dart: ">=3.2.3 <4.0.0" flutter: ">=3.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index c9cf4309..0946c4b5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,42 +6,42 @@ publish_to: "none" version: 1.0.0+1 environment: - sdk: ">=3.1.2 <4.0.0" + sdk: ">=3.2.3 <4.0.0" dependencies: - connectivity_plus: ^3.0.2 - cupertino_icons: ^1.0.2 - data_connection_checker: ^0.3.4 + connectivity_plus: ^5.0.2 + cupertino_icons: ^1.0.6 + data_connection_checker_nulls: ^0.0.2 date_time_picker: ^2.1.0 - duration_picker: ^1.1.1 + duration_picker: ^1.1.0+1 flutter: sdk: flutter flutter_animarker: ^3.2.0 flutter_config: ^2.0.2 flutter_countdown_timer: ^4.1.0 - flutter_local_notifications: ^13.0.0 - flutter_polyline_points: ^1.0.0 - flutter_spinkit: ^5.1.0 - fluttertoast: ^8.0.8 + flutter_local_notifications: ^16.3.2 + flutter_polyline_points: ^2.0.0 + flutter_spinkit: ^5.2.0 + fluttertoast: ^8.2.4 geocoder: git: url: https://github.com/nguyenxdat/flutter_geocoder.git ref: 443b875d8ec80ce525cc6e8f17dfbbbbe7fa3028 - geolocator: ^9.0.2 - get_it: ^7.2.0 - google_maps_flutter: ^2.0.5 - graphql_flutter: ^5.1.0 - hive: ^2.0.4 + geolocator: ^10.1.0 + get_it: ^7.6.7 + google_maps_flutter: ^2.5.3 + graphql_flutter: ^5.1.2 + hive: ^2.2.3 intl: ^0.17.0 - location: ^4.3.0 - mockito: ^5.3.2 - modal_progress_hud: ^0.1.3 - overlay_support: ^2.0.1 - path_provider: ^2.0.9 - provider: ^6.0.3 - rxdart: ^0.27.3 - share_plus: ^6.3.0 - shared_preferences: ^2.0.13 + location: ^5.0.3 + mockito: ^5.4.4 + modal_progress_hud_nsn: ^0.5.1 + overlay_support: ^2.1.0 + path_provider: ^2.1.2 + provider: ^6.1.1 + rxdart: ^0.27.7 + share_plus: ^7.2.2 + shared_preferences: ^2.2.2 sizer: ^2.0.15 skeleton_text: ^3.0.1 sliding_up_panel: ^2.0.0+1