Skip to content

Commit a47a9b3

Browse files
kushchoudhary98Kush Choudhary
andauthored
Fix: Updated weather_tile and location_activity_tile (#700)
* fix for 'Weather Condition' * fix for 'Location Based' --------- Co-authored-by: Kush Choudhary <kushchoudhary@Kushs-MacBook-Pro.local>
1 parent e955111 commit a47a9b3

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

lib/app/modules/addOrUpdateAlarm/controllers/add_or_update_alarm_controller.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class AddOrUpdateAlarmController extends GetxController {
329329
}
330330

331331
Future<void> getLocation() async {
332-
if (await _checkAndRequestPermission()) {
332+
if (await checkAndRequestPermission()) {
333333
const timeLimit = Duration(seconds: 10);
334334
await FlLocation.getLocation(
335335
timeLimit: timeLimit,
@@ -342,7 +342,7 @@ class AddOrUpdateAlarmController extends GetxController {
342342
}
343343
}
344344

345-
Future<bool> _checkAndRequestPermission({bool? background}) async {
345+
Future<bool> checkAndRequestPermission({bool? background}) async {
346346
if (!await FlLocation.isLocationServicesEnabled) {
347347
// Location services are disabled.
348348
return false;

lib/app/modules/addOrUpdateAlarm/views/location_activity_tile.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ class LocationTile extends StatelessWidget {
9898
if (value == 0) {
9999
controller.isLocationEnabled.value = false;
100100
} else if (value == 1) {
101-
if (controller.isLocationEnabled.value == false) {
102-
await controller.getLocation();
103-
}
104-
105101
Get.defaultDialog(
106102
backgroundColor: themeController.secondaryBackgroundColor.value,
107103
title: 'Set location to automatically cancel alarm!',
@@ -152,6 +148,11 @@ class LocationTile extends StatelessWidget {
152148
],
153149
),
154150
);
151+
152+
if (controller.isLocationEnabled.value == false) {
153+
await controller.getLocation();
154+
controller.mapController.move(controller.selectedPoint.value, 15);
155+
}
155156
}
156157
});
157158
},

lib/app/modules/addOrUpdateAlarm/views/weather_tile.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class WeatherTile extends StatelessWidget {
2626
child: ListTile(
2727
onTap: () async {
2828
Utils.hapticFeedback();
29-
await controller.getLocation();
29+
await controller.checkAndRequestPermission();
3030
Get.defaultDialog(
3131
titlePadding: const EdgeInsets.symmetric(vertical: 20),
3232
backgroundColor: themeController.secondaryBackgroundColor.value,

macos/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
isa = PBXProject;
183183
attributes = {
184184
LastSwiftUpdateCheck = 0920;
185-
LastUpgradeCheck = 1300;
185+
LastUpgradeCheck = 1510;
186186
ORGANIZATIONNAME = "";
187187
TargetAttributes = {
188188
33CC10EC2044A3C60003C045 = {

macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1300"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

0 commit comments

Comments
 (0)