I have to redirect to Facebook and Google Maps (from both I have, in the case of Facebook, the url of the profile that you want to go to, and from Google Maps the x, y coordinates).
I have the following Row of Icons:
With the code:
class fila_botones extends StatelessWidget {
String celular,facebook,x,y;
fila_botones(this.celular,this.facebook,this.x,this.y);
@override
Widget build(BuildContext context) {
final barraiconos = Container(
width: 100.0,
height: 50.0,
decoration: BoxDecoration(
color: Color(0xFFFFFFFF),
),
margin: EdgeInsets.only(
top: 20.0,
left: 20.0,
right: 20.0,
),
child: Row(
children: [
InkWell(
child: Container(
child: Tooltip(
child: Icon(
Icons.call,
size: 50.0,
),
message: 'El celu es: ' + celular.toString()),
margin: EdgeInsets.only(
right: 50.0,
left: 20.0,
),
),
onTap: () {
_launchURL();
}
),
InkWell(
child: Container(
child: Icon(
FontAwesomeIcons.facebookSquare, //FAVORITOS EN CRHOME
size: 50.0,
),
margin: EdgeInsets.only(
right: 50.0,
),
),
onTap: () {
//ACA IRIA EL REDICCIONAMIENTO A FACEBOOK DONDE TENGO EN EL STRING FACEBOOK TENGO LA URL
}
,
),
InkWell(
child: Container(
child: Icon(
FontAwesomeIcons.mapMarkedAlt,
size: 50.0,
),
margin: EdgeInsets.only(
right: 50.0,
),
),
onTap: () {
//ACA IRIA EL REDICCIONAMIENTO A GOOGLE MAPS DONDE EN X , Y TENGO LAS COORDENADAS
}
,
),
],
),
);
return barraiconos;
}
_launchURL() async {
var url = 'tel: '+celular;
print(celular);
if (celular != null){
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}else{
AlertDialog(
content: Text('No contiene numero telefonico'),
);
}
}
}
You can use the same package
url_launcher
for example:For Facebook (same for any URL):
For Google Maps: According to the Google Maps documentation, the url can be like this:
Call functions: