|
@@ -13,6 +13,7 @@ import 'package:liftmanager/internal/maintenance/model/maintenance_list_entity.d
|
|
import 'package:liftmanager/net/api_service.dart';
|
|
import 'package:liftmanager/net/api_service.dart';
|
|
import 'package:liftmanager/res/resources.dart';
|
|
import 'package:liftmanager/res/resources.dart';
|
|
import 'package:liftmanager/routers/fluro_navigator.dart';
|
|
import 'package:liftmanager/routers/fluro_navigator.dart';
|
|
|
|
+import 'package:liftmanager/utils/location_helper.dart';
|
|
import 'package:liftmanager/utils/theme_utils.dart';
|
|
import 'package:liftmanager/utils/theme_utils.dart';
|
|
import 'package:liftmanager/utils/toast.dart';
|
|
import 'package:liftmanager/utils/toast.dart';
|
|
import 'package:liftmanager/widgets/app_bar.dart';
|
|
import 'package:liftmanager/widgets/app_bar.dart';
|
|
@@ -44,31 +45,47 @@ class MaintenanceSafePageState extends State<MaintenanceSafePage> {
|
|
@override
|
|
@override
|
|
void initState() {
|
|
void initState() {
|
|
super.initState();
|
|
super.initState();
|
|
- _locationListener = _locationPlugin
|
|
|
|
- .onLocationChanged()
|
|
|
|
- .listen((Map<String, Object> result) {
|
|
|
|
- setState(() {
|
|
|
|
- _locationPlugin.stopLocation();
|
|
|
|
- _locationResult = result;
|
|
|
|
-// address latitude longitude
|
|
|
|
- _locationResult.forEach((key, value) {
|
|
|
|
- if (key == 'address') {
|
|
|
|
- currentAddress = '$value';
|
|
|
|
- setState(() {});
|
|
|
|
- } else if (key == 'latitude') {
|
|
|
|
- latLng.latitude = double.parse('$value');
|
|
|
|
- setState(() {});
|
|
|
|
- } else if (key == 'longitude') {
|
|
|
|
- latLng.longitude = double.parse('$value');
|
|
|
|
- setState(() {});
|
|
|
|
- }
|
|
|
|
- print('key:$key :');
|
|
|
|
- print('value:$value :');
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- });
|
|
|
|
- WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
- getLocation();
|
|
|
|
|
|
+// _locationListener = _locationPlugin
|
|
|
|
+// .onLocationChanged()
|
|
|
|
+// .listen((Map<String, Object> result) {
|
|
|
|
+// setState(() {
|
|
|
|
+// _locationPlugin.stopLocation();
|
|
|
|
+// _locationResult = result;
|
|
|
|
+// // address latitude longitude
|
|
|
|
+// _locationResult.forEach((key, value) {
|
|
|
|
+// if (key == 'address') {
|
|
|
|
+// currentAddress = '$value';
|
|
|
|
+// setState(() {});
|
|
|
|
+// } else if (key == 'latitude') {
|
|
|
|
+// latLng.latitude = double.parse('$value');
|
|
|
|
+// setState(() {});
|
|
|
|
+// } else if (key == 'longitude') {
|
|
|
|
+// latLng.longitude = double.parse('$value');
|
|
|
|
+// setState(() {});
|
|
|
|
+// }
|
|
|
|
+// print('key:$key :');
|
|
|
|
+// print('value:$value :');
|
|
|
|
+// });
|
|
|
|
+// });
|
|
|
|
+// });
|
|
|
|
+// WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
+// getLocation();
|
|
|
|
+// });
|
|
|
|
+ setlatlng();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setlatlng() {
|
|
|
|
+ var helper = LocationHelper();
|
|
|
|
+
|
|
|
|
+ helper
|
|
|
|
+ .getLocation((String lat, String lng, String cityName, {provinceName}) {
|
|
|
|
+ if (lat != null && lng != null) {
|
|
|
|
+ helper.stopGettingLocation();
|
|
|
|
+ }
|
|
|
|
+ latLng = LatLng(double.parse(lat), double.parse(lng));
|
|
|
|
+
|
|
|
|
+ // setState(() {});
|
|
|
|
+ // NavigatorUtils.goBackWithParams(context, "$lng,$lat");
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|