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. 螺旋矩阵 java实现(待消化)

    import java.util.Scanner; /** * @author:(LiberHome) * @date:Created in 2019/3/4 17:13 * @description ...

  2. python自动化打开网页

    from selenium.webdriver.firefox.options import Options as FOptionsfrom selenium.webdriver.chrome.opt ...

  3. EF Core HasQueryFilter 的小坑

    这是今天在实际项目中遇到的一个问题,Entity Framework Core 2.2 生成了下面的 SQL 语句,INNER JOIN 部分丑陋的 SQL 语句让人无法忍受. SELECT TOP( ...

  4. C++标准库algorithm

    (1) 基本数学相关: max(t1, t2)和min(t1, t2), 返回t1和t2中的较大.较小者. max_element(b, e)和min_element(b, e), 返回两个迭代器所指 ...

  5. $_SERVER服务器端

    url = 'http://www.5idev.com/php/index.php/test/foo?username=hbolive' php 获取$_SERVER信息 $_SERVER['PHP_ ...

  6. SQL开发——SQL语法

    文档资料参考: 参考:http://www.w3school.com.cn/sql/sql_syntax.asp 参考:http://wiki.jikexueyuan.com/project/sql/ ...

  7. 推送测试,生产环境无法打印log获取deviceToken,可以通过弹窗获取deviceToken

    z- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:( ...

  8. linux(centos7)设置tomcat开机启动

    1.在/etc/rc.d/rc.local中加入: #java environment export JAVA_HOME=/usr/java/jdk1.8.0_161 export CLASSPATH ...

  9. spring-boot mybatis配置

    接着我们的spring boot项目,spring boot如何使用mybatis访问数据库呢? 个人习惯使用mapper接口和xml配置sql,从pom.xml入手 1.1 添加依赖 <dep ...

  10. webpack4.0.1安装问题和webpack.config.js的配置变化

    The CLI moved into a separate package: webpack-cli. Please install 'webpack-cli' in addition to webp ...