From 58ee48527f38328b3a549902d408336f0d9504db Mon Sep 17 00:00:00 2001 From: Rongjian Zhang Date: Sat, 7 Sep 2019 16:45:04 +0800 Subject: [PATCH] feat: launch google maps for location --- lib/screens/user.dart | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/screens/user.dart b/lib/screens/user.dart index a3ab902..bbfaa5d 100644 --- a/lib/screens/user.dart +++ b/lib/screens/user.dart @@ -115,8 +115,10 @@ class _UserScreenState extends State { return TableViewItem( leftWidget: leftWidget, text: itemText, - rightWidget: Icon(CupertinoIcons.right_chevron, - size: 18, color: PrimerColors.gray300), + rightWidget: onTap == null + ? null + : Icon(CupertinoIcons.right_chevron, + size: 18, color: PrimerColors.gray300), onTap: onTap, ); } @@ -263,10 +265,16 @@ class _UserScreenState extends State { text: payload['company'], ), _buildTableViewItem( - iconData: Octicons.location, - placeholder: 'Location', - text: payload['location'], - ), + iconData: Octicons.location, + placeholder: 'Location', + text: payload['location'], + onTap: payload['location'] == null + ? null + : () { + launch('https://www.google.com/maps/place/' + + (payload['location'] as String) + .replaceAll(RegExp(r'\s+'), '')); + }), _buildTableViewItem( iconData: Octicons.mail, placeholder: 'Email',