dont display navigate button if no GPS is entered
This commit is contained in:
@@ -359,6 +359,12 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isValidGps(String coordinateString) {
|
||||||
|
final RegExp gpsRegex = RegExp(
|
||||||
|
r"^-?([1-8]?\d(\.\d+)?|90(\.0+)?),\s*-?(1[0-7]\d(\.\d+)?|180(\.0+)?|\d{1,2}(\.\d+)?)$");
|
||||||
|
return gpsRegex.hasMatch(coordinateString);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -412,24 +418,32 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Divider(
|
Visibility(
|
||||||
color: MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
visible: isValidGps(widget.business.gps_location),
|
||||||
),
|
child: Column(
|
||||||
_buildContactInfo(
|
children: [
|
||||||
"Location",
|
Divider(
|
||||||
"Come visit us.",
|
color:
|
||||||
Icons.location_on,
|
MzansiInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
MihColors.getOrangeColor(context),
|
),
|
||||||
() {
|
_buildContactInfo(
|
||||||
final latitude =
|
"Location",
|
||||||
double.parse(widget.business.gps_location.split(',')[0]);
|
"Come visit us.",
|
||||||
final longitude =
|
Icons.location_on,
|
||||||
double.parse(widget.business.gps_location.split(',')[1]);
|
MihColors.getOrangeColor(context),
|
||||||
_launchGoogleMapsWithUrl(
|
() {
|
||||||
latitude: latitude,
|
final latitude = double.parse(
|
||||||
longitude: longitude,
|
widget.business.gps_location.split(',')[0]);
|
||||||
);
|
final longitude = double.parse(
|
||||||
},
|
widget.business.gps_location.split(',')[1]);
|
||||||
|
_launchGoogleMapsWithUrl(
|
||||||
|
latitude: latitude,
|
||||||
|
longitude: longitude,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: widget.business.website.isNotEmpty &&
|
visible: widget.business.website.isNotEmpty &&
|
||||||
|
|||||||
Reference in New Issue
Block a user