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. Myeclipse的使用技巧

    1.1.MyEclipse自定义注释   一.修改进入路径:  Window->Preference->Java->Code Style->Code Template-> ...

  2. 解决python3 pip安装、更新及yaml安装

    问题:python3.6版本使用pip安装第三方库时总是报错 电脑中存在多个python版本写成对应pip版本 解决:pip3 install pyOpenSSL -i http://pypi.dou ...

  3. jackson 流式API

    http://www.cnblogs.com/lee0oo0/articles/2652528.html Jackson提供了三种可选的JSON处理方法 1.流式API     com.fasterx ...

  4. MATLAB算术运算符和常用函数

    1 算术运算符 Matlab中的算术运算符按优先级由高到低为: (1) ^           幂 (2) *            乘      /            右除(正常除)       ...

  5. 一位数组的最大子数组(debug版)

    package 数组; import java.util.Arrays; import java.util.Scanner; public class Sum { public static void ...

  6. Leetcode: The Maze(Unsolved locked problem)

    There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolli ...

  7. VMware卸载有残留,再安装时报错提示MSI Failed

    引用自吾爱破解论坛:https://www.52pojie.cn/thread-455779-1-1.html 解决方法:软件自动清理法: 软件 地址:下载地址1:链接:http://pan.baid ...

  8. PHP----------php的opcache扩展配置参数介绍

    [opcache]zend_extension = "路径/ext/php_opcache.dll" ; Zend Optimizer + 的开关, 关闭时代码不再优化.opcac ...

  9. PHP----------一群猴子排成一圈,按1,2,...,n依次编号。

    1.一群猴子排成一圈,按1,2,...,n依次编号.然后从第1只开始数,数到第m只,把它踢出圈,从它后面再开始数,再数到第m只,在把它踢出去...,如此不停的进行下去, 直到最后只剩下一只猴子为止,那 ...

  10. ultiple Endpoints may not be deployed to the same path

    @Configurationpublic class WebSocketConfig { //打war包启动需要注释掉此:否则报 :DeploymentException: Multiple Endp ...