import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; class TestApp extends StatelessWidget { @override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('test'),
),
body: Center(child:Container(
child: RichText(
text: TextSpan(
children: [
TextSpan(
text: 'just test',
style: TextStyle(color: Colors.black),
recognizer: TapGestureRecognizer()..onTap=()=>Navigator.of(context).push(MaterialPageRoute(builder: (_){
return WebTest();
})),
),
],
),
),
)),
floatingActionButton: FloatingActionButton(
onPressed: (){
Navigator.of(context).pushNamed('/web');
},
),
);
}
} class WebTest extends StatelessWidget {
// WebTest({this.url});
final String url = 'http://www.v2ex.com'; @override
Widget build(BuildContext context) {
print('press here');
return WebviewScaffold(
appBar: AppBar(title: Text('test'),),
url: url,
);
}
} class _LinkTextSpan extends TextSpan { // Beware!
//
// This class is only safe because the TapGestureRecognizer is not
// given a deadline and therefore never allocates any resources.
//
// In any other situation -- setting a deadline, using any of the less trivial
// recognizers, etc -- you would have to manage the gesture recognizer's
// lifetime and call dispose() when the TextSpan was no longer being rendered.
//
// Since TextSpan itself is @immutable, this means that you would have to
// manage the recognizer from outside the TextSpan, e.g. in the State of a
// stateful widget that then hands the recognizer to the TextSpan.
// example:
// _LinkTextSpan(
// style: linkStyle,
// url: 'https://goo.gl/iv1p4G',
// text: 'flutter github repo',
// ), _LinkTextSpan({ TextStyle style, String url, String text }) : super(
style: style,
// text: str ?? url,
text:text,
recognizer: TapGestureRecognizer()..onTap = () {
print('tapped');
return WebviewScaffold(
url:url,
appBar: AppBar(
title: Text(text, style:TextStyle(color: Colors.red)),
),
);
}
);
}

  

textspan 转连接的更多相关文章

  1. nodejs进阶(6)—连接MySQL数据库

    1. 建库连库 连接MySQL数据库需要安装支持 npm install mysql 我们需要提前安装按mysql sever端 建一个数据库mydb1 mysql> CREATE DATABA ...

  2. SQL Server 无法连接到服务器。SQL Server 复制需要有实际的服务器名称才能连接到服务器。请指定实际的服务器名称。

    异常处理汇总-数据库系列  http://www.cnblogs.com/dunitian/p/4522990.html SQL性能优化汇总篇:http://www.cnblogs.com/dunit ...

  3. Linux 开机时网络自动连接

      简单版本: cd /etc/sysconfig/network-scripts/ vi ifcfg-enoXXX 输入:reboot重启 或者输入:service network restart ...

  4. 在ubuntu16.10 PHP测试连接MySQL中出现Call to undefined function: mysql_connect()

    1.问题: 测试php7.0 链接mysql数据库的时候发生错误: Fatal error: Uncaught Error: Call to undefined function mysqli_con ...

  5. 【初学python】使用python连接mysql数据查询结果并显示

    因为测试工作经常需要与后台数据库进行数据比较和统计,所以采用python编写连接数据库脚本方便测试,提高工作效率,脚本如下(python连接mysql需要引入第三方库MySQLdb,百度下载安装) # ...

  6. 一起学微软Power BI系列-使用技巧(1)连接Oracle与Mysql数据库

    说起Oracle数据库,以前没用过Oracle不知道,但是这1年用Oracle后,发现真的是想狂吐槽,特别是那个.NET驱动和链接字符串,特别奇葩.总归是和其他数据库不一样,标新立异,不知道为何.另外 ...

  7. 使用SecureCRT连接虚拟机(ubuntu)配置记录

    这种配置方法,可以非常方便的操作虚拟机里的Linux系统,且让VMware在后台运行,因为有时候我直接在虚拟机里操作会稍微卡顿,或者切换速度不理想,使用该方法亲测本机效果确实ok,特此记录. Secu ...

  8. c# 字符串连接使用“+”和string.format格式化两种方式

    参考文章:http://www.liangshunet.com/ca/201303/218815742.htm 字符串之间的连接常用的两种是:“+”连接.string.format格式化连接.Stri ...

  9. 如何使用本地账户"完整"安装 SharePoint Server 2010+解决“New-SPConfigurationDatabase : 无法连接到 SharePoint_Config 的 SQL Server 的数据 库 master。此数据库可能不存在,或当前用户没有连接权限。”

    注:目前看到的解决本地账户完整安装SharePoint Server 2010的解决方案如下,但是,有但是的哦: 当我们选择了"完整"模式安装SharePointServer201 ...

随机推荐

  1. Float.intBitsToFloat

    Float.intBitsToFloat(0b) Float.intBitsToFloat(0) Float.intBitsToFloat(0x) ========================== ...

  2. Selenium 3----定位一组元素+多表单切换+多窗口切换

    定位一组元素 和定位单个元素类似,WebDriver提供了8种用于定位一组元素的方法.定位一组元素的方法与定位单个元素的方法类似,唯一的区别是在单词element后面多了一个s表示复数. find_e ...

  3. dtFindNearestPolyQuery :: process

    dtFindNearestPolyQuery :: process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count ...

  4. 使用Xilinx UART-LITE IP实现串口--逻辑代码实现

    `timescale 1ns / 1ps /////////////////////////////////////////////////////////////////////////////// ...

  5. 附录A application.properties配置项

    摘自官网,仅作为参考用 Part X. Appendices # =================================================================== ...

  6. Vue.js中集成summernote

    首先引用summernote样式及js: <!--summernote css --> <link href="${ctxPath}/static/css/summerno ...

  7. centos7开启80和8080端口

    开启8080端口 firewall-cmd --permanent --add-port=8080/tcp firewall-cmd --reload 重定向80端口到8080端口firewall-c ...

  8. Python从入坑到放弃!

    Python基础  python基础 python基础之 while 逻辑运算符 格式化输出等 python基础之 基本数据类型,str方法和for循环 python基础之 列表,元组,字典 pyth ...

  9. Servlet服务器、客户端跳转

    服务期跳转.服务器端转发.服务器端重定向是一个意思使用“req.getRequestDispatcher(“跳转路径”).forward(req,resp)”实现服务器端转发 客户端发送请求后数据传输 ...

  10. java实现控件的移动及使用鼠标改变控件大小

    package cn.com.test; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; ...