我想从我的 flutter 应用程序中打开 LinkedIn 用户个人资料详细信息。
尝试下面的代码希望对您有帮助。
你必须使用网址启动器包裹来自here https://pub.dev/packages/url_launcher在 pubspec.yaml 文件中添加此依赖项
创建一个小部件
InkWell(
hoverColor: Colors.transparent,
child: Image.network(
'https://cdn-icons-png.flaticon.com/512/174/174857.png',
width: 70,
height: 70,
),
onTap: () => _linkedin(),
)
创建 ontap 函数
_linkedin() async {
const url =
'https://www.linkedin.com';// or add your URL here
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)