diff --git a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart index ce4eb2f7..e05f0e95 100644 --- a/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart +++ b/lib/pages/ErService/AmbulanceRequestIndexPages/PickupLocation.dart @@ -51,6 +51,9 @@ class _PickupLocationState extends State { void initState() { super.initState(); _getCurrentLocation(); + setState(() { + + }); } _getCurrentLocation() async { @@ -61,6 +64,7 @@ class _PickupLocationState extends State { _longitude = 0; _latitude = 0; }); + } @override @@ -89,8 +93,8 @@ class _PickupLocationState extends State { context, FadePage( page: PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, + latitude: _latitude??0, + longitude: _longitude??0, onPick: (value) { setState(() { _result = value; diff --git a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart index 7569ed43..1665cb78 100644 --- a/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart +++ b/lib/pages/pharmacy/pharmacyAddresses/AddAddress.dart @@ -35,8 +35,14 @@ class _AddAddressPageState extends State { } else { _getCurrentLocation(); } + + setState(() { + }); } + + + _getCurrentLocation() async { await Geolocator.getLastKnownPosition().then((value) { _latitude = value.latitude; @@ -44,9 +50,12 @@ class _AddAddressPageState extends State { }).catchError((e) { _longitude = 0; _latitude = 0; + + }); } + @override Widget build(BuildContext context) { final mediaQuery = MediaQuery.of(context); @@ -63,8 +72,8 @@ class _AddAddressPageState extends State { body: Container( height: height * 1, child: PickupLocationFromMap( - latitude: _latitude, - longitude: _longitude, + latitude: _latitude??0, + longitude: _longitude??0, isWithAppBar: false, buttonColor: Color(0xFF5AB145), buttonLabel: TranslationBase.of(context).save,