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. Python Learning - Three

    1. Set  Set is a collection which is unordered and unindexed. No duplicate members In Python sets ar ...

  2. linux03:系统常用的命令

    1,蜗牛,硬件-内核-接口API(系统调用接口)-程序或者服务,用户不能直接和硬件对话,所以需要一个翻译器,这个翻译器就是shell.美国盾牌 2,shell是一个翻译官,bash是所有翻译官里面干的 ...

  3. linux信息收集

    1.系统区分debian系列:debian.ubunturedhat系列:redhat.centos 是否为docker.或者为虚拟机 分为通用模块.单独模块的信息获取 2.系统信息收集 内核(是否为 ...

  4. Windows命令行设置dns

    管理员运行cmd 1.dns配置成192.168.1.200 netsh interface ip set dns name="以太网" source=static addr=19 ...

  5. 于用cocoapods添加第三方库,并且cocoapods添加成功,但是却在任何一个文件上都导入不了头文件

    关于用cocoapods添加第三方库,并且cocoapods添加成功,但是却在任何一个文件上都导入不了头文件,而且根本没有提示,即使手动打#import "xxxx.h"也报错xx ...

  6. turtlebot3安装遇到的问题总结

    turtlebot3安装遇到的问题总结 问题如下 1.ubuntu mate 开机启动 开始试了很多方法都不行,注意不要输错用户名,不然进不了系统了(进不了解决方法,找个电脑读一下这个turtlebo ...

  7. linux怎么查看进程启动,用户的工作目录,pwdx,/proc/11256/cwd

    linux 通过pid 寻找程序路径的最简单命令(pwdx)  #pwdx  pid号1  [pid2] .... 在linux实际操作命令中,查看pid的方式有很多种,通过pid找程序路径的方式也有 ...

  8. linux架构师之路!

    目录 1.shell编程总结 2.python编程总结 3.网络基础总结 4.存储的基本知识 5.linux常用 架构学习目录 1.网站架构 2.架构师技术图谱 3.python之路 4.IBM技术主 ...

  9. Mac OS 安装robotframework

    1,查看当前系统默认的Python路径 which python1==> /usr/bin/python 2,查看当前python 版本 python1==> Python 2.7.10 ...

  10. JAVA8 中 LocalDateTime的使用小栗子

    LocalDate givenDate = LocalDate.parse("2019-04-23",DateTimeFormatter.ofPattern("yyyy- ...