繁体   English   中英

如何在颤振中创建超链接图标?

[英]How to create hyperlink icon in flutter?

我想在 Icon 中创建一个超链接:

IconButton(
  icon: Icon(Icons.ac_unit,),
  onPressed: ()=>launch('https://github.com/himanshusharma89'),
)

我们怎样才能做到这一点?

错误:

Exception has occurred.
MissingPluginException (MissingPluginException(No implementation found for method launch on channel plugins.flutter.io/url_launcher))

这是解决方案,感谢: Pavel

IconButton(
 icon: Icon(Icons.ac_unit,),
 onPressed: () async {
  const url = 'https://github.com/himanshusharma89';
  if (await canLaunch(url)) {
   await launch(url);
  } else {
   throw 'Could not launch $url';
  }
 }
)

问题是您在pubspec.yaml添加了依赖pubspec.yaml ,然后只是热重载了应用程序。 热重载期间不会添加本机依赖项。 MissingPluginException意味着错过了原生 (Android/iOS) 插件实现。

您应该完全停止并重新启动应用程序

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM