http://www.lxweimin.com/p/faf175c66c91
一款支持android和IOS的插件,其中包含打開網(wǎng)址、發(fā)送郵件、撥打電話、以及發(fā)送信息功能。
實(shí)例作用
http:<URL>,https:<URL>, e.g.http://flutter.io? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 在默認(rèn)瀏覽器中打開網(wǎng)址
mailto:<email address>?subject=<subject>&body=<body>, e.g.
mailto:smith@example.org?subject=News&body=New%20plugin? ? ? ? ? 發(fā)送郵件
tel:<phone number>, e.g.tel:+1 555 010 999????????????????????????????????????????????撥打電話
sms:<phone number>, e.g.sms:5550101234????????????????????????????????????????????發(fā)送信息
撥打電話
import 'package:url_launcher/url_launcher.dart';
......
class LeaderPhone extends StatelessWidget {
?final String leaderPhone;?// 電話號(hào)碼
?LeaderPhone({Key key, this.leaderImage, this.leaderPhone}) : super(key: key);
?@override
? Widgetbuild(BuildContext context) {
?? ?return Container(
????? child: InkWell(
??????? onTap: _launchURL,
??????? child: Image.network(leaderImage),
???? ?),
?? ?);
?}
?void _launchURL() async {
??? String url='tel:'+leaderPhone;
?? ?if(await canLaunch(url)) {
???? ?await launch(url);
?? ?} else {
???? ?print('不能訪問(wèn)');
?? ?}
?}
效果圖
其他方式類似,重要的是遵守他的規(guī)則
作者:zda123000
鏈接:http://www.lxweimin.com/p/faf175c66c91
來(lái)源:簡(jiǎn)書
著作權(quán)歸作者所有。商業(yè)轉(zhuǎn)載請(qǐng)聯(lián)系作者獲得授權(quán),非商業(yè)轉(zhuǎn)載請(qǐng)注明出處。