簡體   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