当前位置:网站首页>[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
2022-07-02 22:09:00 【Programmer community】
List of articles
- One 、url_launcher Plug in search and installation
- 1、 Search for url_launcher plug-in unit
- 2、 install url_launcher plug-in unit
- Two 、url_launcher Official plug-in example
- 3、 ... and 、 Open the browser
- Four 、 Open a third party app
- 5、 ... and 、 Complete code example
- 6、 ... and 、 Related resources
One 、url_launcher Plug in search and installation
1、 Search for url_launcher plug-in unit
With the help of url_launcher Third party plug-ins , You can open third-party applications ;
The plug-in is Flutter Official plug-in for opening third-party applications ;
stay https://pub.dev/packages Search and install url_launcher plug-in unit ;

The address of the plug-in is https://pub.dev/packages/url_launcher

2、 install url_launcher plug-in unit
Installing a plug-in : stay https://pub.dev/packages/url_launcher/install The page has the installation method of the plug-in ;
1 . Configuration dependency : stay pubspec.yaml Configure dependencies in the configuration file ;
dependencies: url_launcher: ^5.7.102 . Get plug-ins : Click on the " Pub get " Button to get the plug-in , In the following Message The panel shows Running "flutter pub get" in flutter_cmd... 0.5s , This indicates that the plug-in has been downloaded successfully ;

3 . Import header file :
import 'package:url_launcher/url_launcher.dart';Two 、url_launcher Official plug-in example
The official sample : This is a https://pub.dev/packages/url_launcher The official code provided by ;
import 'package:flutter/material.dart';import 'package:url_launcher/url_launcher.dart';void main() {
runApp(Scaffold( body: Center( child: RaisedButton( onPressed: _launchURL, child: Text('Show Flutter homepage'), ), ), ));}_launchURL() async {
const url = 'https://flutter.dev'; if (await canLaunch(url)) {
await launch(url); } else {
throw 'Could not launch $url'; }}3、 ... and 、 Open the browser
Set up RaisedButton Button components , Click this button , Open browser automatically , And open the home page of this blog ;
// Open browser button RaisedButton( // Anonymous functions onPressed: () async {
const url = 'https://blog.csdn.net/shulianghan'; if (await canLaunch(url)) {
await launch(url); } else {
throw 'Could not launch $url'; } }, // The components displayed by the button child: Text(" Open the browser "),),Four 、 Open a third party app
The premise of opening third-party applications is , Know the of the application schema or url , These are all made by third parties app The developers of ;
Google maps scheme yes “geo: precision , dimension ” ;
Apple map url yes “http://maps.apple.com/?ll= precision , dimension ”
// open Google Map RaisedButton( // Anonymous functions onPressed: () async {
// Android Google maps scheme , Behind is the latitude and longitude of Haidian District, Beijing const url = 'geo:116.3,39.95'; if (await canLaunch(url)) {
// Android mobile phone , open Google Map await launch(url); } else {
// If the Android phone doesn't open, it means it's an Apple phone const url_ios = 'http://maps.apple.com/?ll=116.3,39.95'; if (await canLaunch(url_ios)) {
await launch(url_ios); } else {
throw 'Could not launch $url'; } } }, // The components displayed by the button child: Text(" Open the map "),),5、 ... and 、 Complete code example
Complete code example :
import 'package:flutter/material.dart';import 'package:url_launcher/url_launcher.dart';class LauncherPage extends StatefulWidget {
@override _LauncherPageState createState() => _LauncherPageState();}class _LauncherPageState extends State<LauncherPage> {
@override Widget build(BuildContext context) {
return MaterialApp( title: " Third party application jump ", theme: ThemeData(primarySwatch: Colors.blue), home: Scaffold( appBar: AppBar( title: Text(" Third party application jump "), leading: GestureDetector( onTap: (){
Navigator.pop(context); }, child: Icon(Icons.arrow_back_ios), ), ), body: Container( // centered alignment: Alignment.center, // Vertical linear layout child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ // Open browser button RaisedButton( // Anonymous functions onPressed: () async {
const url = 'https://blog.csdn.net/shulianghan'; if (await canLaunch(url)) {
await launch(url); } else {
throw 'Could not launch $url'; } }, // The components displayed by the button child: Text(" Open the browser "), ), // open Google Map RaisedButton( // Anonymous functions onPressed: () async {
// Android Google maps scheme , Behind is the latitude and longitude of Haidian District, Beijing const url = 'geo:116.3,39.95'; if (await canLaunch(url)) {
// Android mobile phone , open Google Map await launch(url); } else {
// If the Android phone doesn't open, it means it's an Apple phone const url_ios = 'http://maps.apple.com/?ll=116.3,39.95'; if (await canLaunch(url_ios)) {
await launch(url_ios); } else {
throw 'Could not launch $url'; } } }, // The components displayed by the button child: Text(" Open the map "), ), ], ), ), ), ); }}Running effect :

6、 ... and 、 Related resources
Reference material :
- Flutter Official website : https://flutter.dev/
- Flutter Plug in download address : https://pub.dev/packages
- Flutter Developing documents : https://flutter.cn/docs ( Strongly recommend )
- official GitHub Address : https://github.com/flutter
- Flutter The Chinese community : https://flutter.cn/
- Flutter Practical tutorial : https://flutter.cn/docs/cookbook
- Flutter CodeLab : https://codelabs.flutter-io.cn/
- Dart Chinese document : https://dart.cn/
- Dart Developer website : https://api.dart.dev/
- Flutter Chinese net ( unofficial , The translation is very good ) : https://flutterchina.club/ , http://flutter.axuer.com/docs/
- Flutter Related issues : https://flutterchina.club/faq/ ( It is recommended to watch it at the introductory stage )
Blog source download :
GitHub Address : https://github.com/han1202012/flutter_cmd ( Keep updating with the progress of the blog , There may not be the source code of this blog )
Blog source snapshot : https://download.csdn.net/download/han1202012/15541330 ( The source code snapshot of this blog , You can find the source code of this blog )
边栏推荐
- The book "new programmer 002" is officially on the market! From "new database era" to "software defined car"
- Off chip ADC commissioning record
- 攻防世界pwn题:Recho
- 技术人创业:失败不是成功,但反思是
- Browser - clean up the cache of JS in the page
- MySQL learning record (1)
- Sql service intercepts string
- Pyqt picture decodes and encodes and loads pictures
- Oriental Aesthetics and software design
- 【剑指 Offer 】56 - II. 数组中数字出现的次数 II
猜你喜欢

sql service 截取字符串

Introduction to victoriametrics
![[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)](/img/fa/5c1b6c16d9aabd13e9a4f7c7b9c7da.jpg)
[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)

PIP audit: a powerful security vulnerability scanning tool

Etcd Raft 协议

Redis distributed lock failure, I can't help but want to burst

#include<>和#include“”的区别
![[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology](/img/2f/bb99836bb3ad725483f30531ff4d53.jpg)
[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology

Secondary development of ANSYS APDL: post processing uses command flow to analyze the result file

C language, to achieve three chess games
随机推荐
MySQL installation failed -gpg verification failed
*C language final course design * -- address book management system (complete project + source code + detailed notes)
【C 题集】of Ⅴ
Unity3D学习笔记4——创建Mesh高级接口
[use of pointer and pointer and array]
Record the functions of sharing web pages on wechat, QQ and Weibo
sql service 截取字符串
将 EMQX Cloud 数据通过公网桥接到 AWS IoT
Oriental Aesthetics and software design
PIP audit: a powerful security vulnerability scanning tool
A specially designed loss is used to deal with data sets with unbalanced categories
读博士吧,研究奶牛的那种!鲁汶大学 Livestock Technology 组博士招生,牛奶质量监测...
Ransack组合条件搜索实现
Error in PIP installation WHL file: error: is not a supported wheel on this platform
Structure array, pointer and function and application cases
Try to get property'num for PHP database data reading_ rows' of non-object?
【剑指 Offer】57. 和为s的两个数字
GEE:(二)对影像进行重采样
*C语言期末课程设计*——通讯录管理系统(完整项目+源代码+详细注释)
App page sharing password rails implementation