当前位置: 首页 > 编程日记 > 正文

11-flutter事件监听

事件监听

1 本身支持事件检测,就可以直接使用onpress

        body:Center(child: RaisedButton(child: Text("Click"),onPressed: (){print("我被Click了");}),),

2 如果本身不支持事件的检测,

使用 GestureDetector 添加一个点击事件

      home:  Scaffold(appBar: AppBar(title: new Text("Hello It's me")),body: GestureDetector(child: Text("Nice"),onTap: (){print("我被点击了");},),),

3 GestureDetector 可以添加多种手势

点击

onTapDown在特定的位置轻触手势接触了屏幕
onTap单击操作
onTapUp在特定的位置产生了一个轻触手势并且停止接触屏幕
onTapCancel触发了onTapDown,但是没有触发onTap

双击

onDoubleTap

长按

onLongPress

拖动

onVerticalDragStart垂直拖动
onVerticalDragUpdate接触屏幕并且继续在垂直方向移动
onVerticalDragEnd之前接触了屏幕并且垂直移动,并且在停止接触屏幕前以某一个垂直速度移动
onHorizontalDragStart水平方向
onHorizontalDragUpdate接触了屏幕并且在水平方向移动
onHorizontalDragEnd水平方向
            child: GestureDetector(child:new Text("Click"),onTap: (){print("点击效果");},// 双击onDoubleTap: (){print("双击效果");},// 长按onLongPress: (){print("长按效果");},//按下去onTapDown: (e){print(e);},// 放手onTapUp: (e){print(e);},)

相关文章:

react前端开发_是的,React正在接管前端开发。 问题是为什么。

react前端开发by Samer Buna通过Samer Buna 是的,React正在接管前端开发。 问题是为什么。 (Yes, React is taking over front-end development. The question is why.) Update: This article is now part of my book “React.js Beyond The Basics”.更新&#xf…

12-flutter Textfield的使用

获取用户的输入用 TextField 或者TextFormField 的实现,通过控制器来实现获取用户的输入。 1 TextField 的属性 const TextField({Key key,this.controller,this.focusNode,// 这个属性可以用来监听输入框是否获取this.decoration const InputDecoration(),Text…

MyEclipse10整合Axis2插件

1、下载axis2的eclipse插件 2、把下载好的两个插件包解压后放置myeclipse10安装目录下的dropins文件夹中 3、重启MyEclipse10后 File->New->Other 到此Axis2插件安装完毕。 转载于:https://www.cnblogs.com/dreammyle/p/4036224.html

STM32GPIO管脚设置

(1)GPIO_Mode_AIN 模拟输入 (2)GPIO_Mode_IN_FLOATING 浮空输入(3)GPIO_Mode_IPD 下拉输入 (4)GPIO_Mode_IPU 上拉输入 (5)GPIO_Mode_Out_OD 开漏输出&#x…

数据结构中等号表示什么_通过分析2016年最重要的252个中等故事我学到了什么...

数据结构中等号表示什么Medium may be struggling to find a sustainable business model, but they have years worth of funding left, and more readers than ever.中型企业可能很难找到一种可持续的商业模式,但他们还有数年的可用资金,而且读者比以往…

event事件

10.2.6 事件传播 当事件目标是Window对象或其他一些单独对象(比如XMLHttpRequest)时,浏览器会简单的通过调用对象上适当的处理程序响应事件。 在调用在目标元素上注册的事件处理函数后,大部分事件会“冒泡”到DOM树根。 发生在文档…

[原创]用命令行工具删除TFS2010服务器上的工作区信息

下面的示例显示有关所有计算机上的所有用户已在地址 http://myserver:8080/tfs/DefaultCollection 上的以下团队项目集合中创建的所有工作区的列表。 c:\projects>tf workspaces /owner:*/computer:* /collection:http://myserver:8080/tfs/DefaultCollection tf workspace …

13-flutter 加载图片

Image Widget 1 flutter 加载图片的方式 new Image从ImageProvider 中获取图像new Image.asset使用key 从assetBundle 获取图片Image.network从网络中获取图片Image.file从本地文件获取图片Image.memory用来加载Uint8List资源(字节数组)图片 2 image 支…

react 组件样式_如何使用样式化组件为React组件创建视觉变体

react 组件样式by Gilad Dayagi通过吉拉德达亚吉 如何使用样式化组件为React组件创建视觉变体 (How to create visual variants for React components using styled-components) Styled-components is a library for styling React components that took the React world by s…

HDU 1406 完数

完数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 18647 Accepted Submission(s): 6894 Problem Description完数的定义:如果一个大于1的正整数的所有因子之和等于它的本身,则称这个…

14-flutter Animation 动画

动画 一 Animation 在Flutter中,Animation对象本身和UI渲染没有任何关系。Animation是一个抽象类,它拥有其当前值和状态(完成或停止)。其中一个比较常用的Animation类是Animation。 Flutter中的Animation对象是一个在一段时间内…

---Intel SSD 750 under Linux

https://wiki.archlinux.org/index.php/Solid_State_Drives/NVMe转载于:https://www.cnblogs.com/bzhao/p/6405268.html

谷歌数字图书馆_如何在没有联系的情况下找到6位数字的工作-提示使我获得了Google和其他技术巨头的工作机会...

谷歌数字图书馆Shortly after college, I began chasing something many people want but few ever get: a job they love.大学毕业后不久,我开始追求许多人想要但很少有人得到的东西:他们热爱的工作。 I left school with a biology degree and a job …

attribute

(verilog-2001) (*keep 1*) wire my_reg; 最大扇出信号设置 (*maxfan 20*)reg clk_en; 上电初始化 reg q 1b1; keep :确保组合逻辑不被优化 preserve:防止寄存器被优化掉。对于扇出较大的信号,可以同时定义两个信号来分担扇出&#xff0c…

算法基础之冒泡排序

data[10,4,33,21,54,3,9,11] //for index,i in enumerate(data[0:-1): for j in range(1,len(data)): for i in range(len(data)-j): if data[i]>data[i1]: tempdata[i1] data[i1]data[i] data[i]temp print(data) 转载于:https://www.cnblogs.com/my334420/p/6407843.html

15-flutter Scaffold详解

Scaffold 是一个实现基本的material design 的布局结构 appBar显示在界面顶部的一个 AppBarbody当前界面所显示的主要内容 WidgetfloatingActionButtonMaterial 设计中所定义的 FAB,界面的主要功能按钮persistentFooterButtons固定在下方显示的按钮,比…

成本管理系统开源_开源教科书如何降低大学成本

成本管理系统开源Over the past 10 years, the cost of textbooks in the US has increased by 88%. This has contributed to more than $1 trillion in total student loan debt, which Americans are struggling pay back.在过去的10年中,美国的教科书成本增加了…

OA项目12:系统管理之用户管理

首注:本学习教程为传智播客汤阳光讲师所公布的免费OA项目视频我的文字版实践笔记,本人用此来加强巩固自己开发知识,如有网友转载,请注明。谢谢。  一 之前在第8节时已经将User实体及映射文件建立好了,所以设计实体已…

16-flutter-Swiper 插件的使用

Flutter-Swiper 插件的使用 1 在pubspec.ymal 中去导入插件 dependencies:flutter:sdk: flutter# The following adds the Cupertino Icons font to your application.# Use with the CupertinoIcons class for iOS style icons.cupertino_icons: ^0.1.2flutter_swiper: ^1.1…

NPOI导Excel样式设置

一、创建一个Excel //创建一个工作簿 XSSFWorkbook workbook new XSSFWorkbook(); //创建一个页 ISheet sheet workbook.CreateSheet("sheet1"); //创建一行 IRow row sheet.CreateRow(0); //创建一列 ICell ce…

谢尔盖.布林的早期思想_谷歌联合创始人谢尔盖·布林(Sergey Brin)谈人工智能与自动化...

谢尔盖.布林的早期思想Here are three links worth your time:这是三个值得您花费时间的链接: Google cofounder Sergey Brin talks about AI, automation, and the future of education (34 minute watch) Google联合创始人谢尔盖布林(Sergey Brin)谈论人工智能&a…

17-flutter导航栏渐变效果

MediaQuery.removePadding 移除顶部的 padding import package:flutter/material.dart; // 导入swiper 组件 import package:flutter_swiper/flutter_swiper.dart;const APPBAR_SCROLL_OFFSET 200; class HomePage extends StatefulWidget {// 重写Create State 方法override…

链表之逆转链表

链表之逆转链表 传入一个Node指针,将它指向的链表进行逆置,返回逆置后的新链表,注意操作过程中不要额外申请空间,即在传入的链表中进行节点逆置. 代码: Node * reverse_list(Node *head){Node * preNULL;Node * curhea…

如何使用Redux-saga和ReactDnD测试React和Redux(哇!)

by Gregory Beaver通过格雷戈里海狸 如何使用Redux-saga和ReactDnD测试React和Redux(哇!) (How to test React and Redux with Redux-saga and ReactDnD (whew!)) 帮助程序和系统使测试更加容易 (Helpers and systems to make testing easier) This article is the…

18-flutter的Future和FutureBuilder

Future 表示接卸来某个时间的值或者错误,借助Future可以在flutter 总实现异步操作。 其本事是dart:async 包中的一个类,使用它的时候需要导入dart:async 包,Future 有两种状态。 pending 执行中completed 执行结束 &#xff0c…

js控制使div自动适应居中

一直都在想怎么样使弹出的DIV能在任何时候都是居中显示的,刚开始的时候是用CSS样式直接定义好层的位置,但是当页面很长的时候,或是浏览器窗口大小不是固定的时候就不能正确的显示,所以只好用JS来控制DIV的显示位置。首先再次详细解…

【poj3420】 Quad Tiling

http://poj.org/problem?id3420 (题目链接) 题意 给出$n*m$的网格,用$1*2$的方块覆盖有多少种方案。 Solution 数据很大,不能直接搞了,我们矩乘一下。0表示已放置,1表示未放置。dfs跑出一个$16*16$的转移矩阵,然后矩乘…

bokeh pandas_使用Pandas和Bokeh将Rolling Stone的500张最伟大专辑可视化

bokeh pandasby Gautham Koorma通过Gautham Koorma 使用Pandas和Bokeh将Rolling Stone的500张最伟大专辑可视化 (Rolling Stone’s 500 Greatest Albums Visualized Using Pandas and Bokeh) In 2003, Rolling Stones Magazine polled musicians, producers, and industry exe…

使用WinINet和WinHTTP实现Http訪问

使用WinINet和WinHTTP实现Http訪问 飘飘白云 l_zhaohui163.com 2007-11-30 Http訪问有两种方式,GET和POST,就编程来说GET方式相对简单点,它不用向server提交数据,在这个例程中我使用POST方式,提交数据value1与value2&a…

19-flutter的ListView 和 GridView的使用

ListView 的水平样式 和垂直样式 1 水平列表 import package:flutter/material.dart;const CITY_LIST ["北京","上海","广州","深圳","南京","郑州","武汉"];void main() > runApp(MyApp());clas…