textspan 转连接
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 转连接的更多相关文章
- nodejs进阶(6)—连接MySQL数据库
1. 建库连库 连接MySQL数据库需要安装支持 npm install mysql 我们需要提前安装按mysql sever端 建一个数据库mydb1 mysql> CREATE DATABA ...
- SQL Server 无法连接到服务器。SQL Server 复制需要有实际的服务器名称才能连接到服务器。请指定实际的服务器名称。
异常处理汇总-数据库系列 http://www.cnblogs.com/dunitian/p/4522990.html SQL性能优化汇总篇:http://www.cnblogs.com/dunit ...
- Linux 开机时网络自动连接
简单版本: cd /etc/sysconfig/network-scripts/ vi ifcfg-enoXXX 输入:reboot重启 或者输入:service network restart ...
- 在ubuntu16.10 PHP测试连接MySQL中出现Call to undefined function: mysql_connect()
1.问题: 测试php7.0 链接mysql数据库的时候发生错误: Fatal error: Uncaught Error: Call to undefined function mysqli_con ...
- 【初学python】使用python连接mysql数据查询结果并显示
因为测试工作经常需要与后台数据库进行数据比较和统计,所以采用python编写连接数据库脚本方便测试,提高工作效率,脚本如下(python连接mysql需要引入第三方库MySQLdb,百度下载安装) # ...
- 一起学微软Power BI系列-使用技巧(1)连接Oracle与Mysql数据库
说起Oracle数据库,以前没用过Oracle不知道,但是这1年用Oracle后,发现真的是想狂吐槽,特别是那个.NET驱动和链接字符串,特别奇葩.总归是和其他数据库不一样,标新立异,不知道为何.另外 ...
- 使用SecureCRT连接虚拟机(ubuntu)配置记录
这种配置方法,可以非常方便的操作虚拟机里的Linux系统,且让VMware在后台运行,因为有时候我直接在虚拟机里操作会稍微卡顿,或者切换速度不理想,使用该方法亲测本机效果确实ok,特此记录. Secu ...
- c# 字符串连接使用“+”和string.format格式化两种方式
参考文章:http://www.liangshunet.com/ca/201303/218815742.htm 字符串之间的连接常用的两种是:“+”连接.string.format格式化连接.Stri ...
- 如何使用本地账户"完整"安装 SharePoint Server 2010+解决“New-SPConfigurationDatabase : 无法连接到 SharePoint_Config 的 SQL Server 的数据 库 master。此数据库可能不存在,或当前用户没有连接权限。”
注:目前看到的解决本地账户完整安装SharePoint Server 2010的解决方案如下,但是,有但是的哦: 当我们选择了"完整"模式安装SharePointServer201 ...
随机推荐
- Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Unable to compile class for JSP] with root cause java.lang.IllegalArgumentException: Page directive: inval
严重: Servlet.service() for servlet [jsp] in context with path [/Healthy_manager] threw exception [Una ...
- HDU 6311 Cover (无向图最小路径覆盖)
HDU 6311 Cover (无向图最小路径覆盖) Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/ ...
- 织梦手机站下一篇变上一篇而且还出错Request Error!
最新的织梦dedecms程序手机版下一篇变上一篇而且还出错Request Error!,这是因为官方写错了一个地方 打开 /include/arc.archives.class.php 找到 $mli ...
- 微信小程序弹出操作菜单
微信小程序弹出操作菜单 比如在页面上放一个按钮,点击按钮弹出操作菜单,那么在按钮的 bindtap 事件里,执行下面的代码即可: wx.showActionSheet({ itemList: ['A' ...
- ST表 || RMQ问题 || BZOJ 1699: [Usaco2007 Jan]Balanced Lineup排队 || Luogu P2880 [USACO07JAN]平衡的阵容Balanced Lineup
题面:P2880 [USACO07JAN]平衡的阵容Balanced Lineup 题解: ST表板子 代码: #include<cstdio> #include<cstring&g ...
- hive时间日期函数及典型场景应用
1.hive取得当前日期时间: 1.1) 取得当前日期: select current_date(); 1.2) 取得当前日期时间: select current_timestamp(); 1.3) ...
- Go并发示例-Pool
https://mp.weixin.qq.com/s/MBY6l5VxrFPJ4AA8nGeQUQ <Go语言实战>笔记(十六) | Go并发示例-Pool 飞雪无情 异步图书 2017- ...
- mayan游戏
这道题超级好 就是我太菜了写了几个小时不算是debug了几个小时. 我只想出了几个小剪枝 可能是状态不太好吧 写完这道题真的是完美诠释了什么,叫做: 暴力出奇迹!!! 真的是太暴力了. 最多只移动5步 ...
- oracle初级语法
--select关键字第一个句型: select emp.ename,emp.sal from emp; --from 关键字后面跟 需要查询表名: select ename from emp; -- ...
- docker安装,err:exit status 255,提示找不到虚拟机IP
我遇到这个问题是因为,BIOS没有打开虚拟化技术,导致虚拟机无法成功创建,自然找不到IP. 解决: 1.进入BIOS,高级选项卡下,找到虚拟化技术开关,打开即可.具体做法,可搜网文. 2.删除原来自动 ...