# Flutter 好用package - flutter_linkify 介紹 ## flutter_linkify 自動偵測文字內連結 ``` flutter pub add flutter_linkify ``` [官網](https://pub.dev/packages/flutter_linkify) ### 程式範例 ```dart Linkify( onOpen: (link) async { //點擊哪一個網址就展開哪一個網站 Uri uri = Uri.parse(link.url); await canLaunchUrl(uri).then((value) async { await launchUrl(uri, mode: LaunchMode.inAppWebView); }); }, options: const LinkifyOptions(humanize: false), //顯示http文字 style: Theme.of(context) .textTheme .bodySmall ?.apply(decoration: TextDecoration.none), text: '這是一串文字有很多網址 https://stackoverflow.com/questions/29182581/global-variables-in-dart 這\n是另ㄧ串網址 https://pub.dev/packages/url_launcher/example') ``` ###### tags: `flutter`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up