fix address

merge-requests/415/head
Elham Rababh 3 years ago
parent 3b79d0ac41
commit 055b888ba2

@ -51,6 +51,9 @@ class _PickupLocationState extends State<PickupLocation> {
void initState() { void initState() {
super.initState(); super.initState();
_getCurrentLocation(); _getCurrentLocation();
setState(() {
});
} }
_getCurrentLocation() async { _getCurrentLocation() async {
@ -61,6 +64,7 @@ class _PickupLocationState extends State<PickupLocation> {
_longitude = 0; _longitude = 0;
_latitude = 0; _latitude = 0;
}); });
} }
@override @override
@ -89,8 +93,8 @@ class _PickupLocationState extends State<PickupLocation> {
context, context,
FadePage( FadePage(
page: PickupLocationFromMap( page: PickupLocationFromMap(
latitude: _latitude, latitude: _latitude??0,
longitude: _longitude, longitude: _longitude??0,
onPick: (value) { onPick: (value) {
setState(() { setState(() {
_result = value; _result = value;

@ -35,8 +35,14 @@ class _AddAddressPageState extends State<AddAddressPage> {
} else { } else {
_getCurrentLocation(); _getCurrentLocation();
} }
setState(() {
});
} }
_getCurrentLocation() async { _getCurrentLocation() async {
await Geolocator.getLastKnownPosition().then((value) { await Geolocator.getLastKnownPosition().then((value) {
_latitude = value.latitude; _latitude = value.latitude;
@ -44,9 +50,12 @@ class _AddAddressPageState extends State<AddAddressPage> {
}).catchError((e) { }).catchError((e) {
_longitude = 0; _longitude = 0;
_latitude = 0; _latitude = 0;
}); });
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
@ -63,8 +72,8 @@ class _AddAddressPageState extends State<AddAddressPage> {
body: Container( body: Container(
height: height * 1, height: height * 1,
child: PickupLocationFromMap( child: PickupLocationFromMap(
latitude: _latitude, latitude: _latitude??0,
longitude: _longitude, longitude: _longitude??0,
isWithAppBar: false, isWithAppBar: false,
buttonColor: Color(0xFF5AB145), buttonColor: Color(0xFF5AB145),
buttonLabel: TranslationBase.of(context).save, buttonLabel: TranslationBase.of(context).save,

Loading…
Cancel
Save