Nvidia和数据存储公司NetApp今天联合宣布一个解决方案:Ontap AI,他们称之为“经过AI验证的架构。” Ontap AI的核心是Nvidia的DGX-1,这是一款专为深度学习而优化的AI超级计算机。 “ Ontap AI的第一批从业者之一是Cambridge Consultants,一家总部位于英国的工程咨询公司。 它将Ontap AI应用于垂直医疗保健领域,利用该技术构建评估药物治疗及其对患者预后的影响的系统。它还使用Ontap AI来创建Vincent,这是一个深度学习程序,旨在学习如何像人类一样绘画。 其他Ontap AI发布合作伙伴包括IAS,Groupware Technology,ePlus和WWT。
GestureDetector({ Key key, this.child, this.onTapDown, // 按下 this.onTapUp, // 抬起 this.onTap Function() 类型的 ; 作用组件 : 在 child 字段设置手势检测的主体组件 , 就是监听哪个组件的手势事件 ; // 手势检测组件 GestureDetector( // 点击事件 onTap color: Colors.red, ), ), ), ) 二、GestureDetector 常用事件说明 ---- GestureDetector 常用事件说明 : onTap 手势检测"), // 返回按钮设置 leading: GestureDetector( // 点击事件回调函数 onTap // 手势检测组件 GestureDetector( // 点击事件 onTap
Ink.image( image: AssetImage('sample.jpg'), fit: BoxFit.cover, child: InkWell( onTap Positioned.fill( child: Material( color: Colors.transparent, child: InkWell( onTap ; InkWrapper({ this.splashColor, @required this.child, @required this.onTap, }); Colors.transparent, child: InkWell( splashColor: splashColor, onTap : onTap, ), ), ), ], ); } } 优秀的方法。
InkWell InkWell组件在用户点击时出现“水波纹”效果,InkWell简单用法: InkWell( onTap: (){}, child: Text('这是InkWell 点击效果'), ) onTap是点击事件回调,如果不设置无法出现“水波纹”效果,效果如下: ? 设置水波纹颜色: InkWell( onTap: () {}, splashColor: Colors.red, ... ) 效果如下: ? 设置高亮颜色颜色: InkWell( onTap: () {}, highlightColor: Colors.blue, ... ) 高亮颜色是按住时显示的颜色,效果如下: ? 给字体添加边距和圆角边框,扩大“水波纹”效果: InkWell( onTap: (){}, child: Container( padding:
2️⃣ 最简单用法(点击) GestureDetector( onTap: () { print('被点击了'); }, child: Container( padding: InkWell 是 Material 体系的一部分,特点是: 点击时有水波纹效果 2️⃣ 基本用法 InkWell( onTap: () { print('点击了'); }, child Text('点击我'), ), ) 3️⃣ 水波纹的前提条件(重要) ⚠️ InkWell 必须有 Material 祖先 正确写法: Material( child: InkWell( onTap ⭐ ⭐⭐⭐ 常见场景 自定义交互 列表 / 卡片 经验法则: 列表、卡片 → InkWell 高度自定义 → GestureDetector 五、点击整行列表项(经典场景) InkWell( onTap 六、设置水波纹形状(圆角) InkWell( borderRadius: BorderRadius.circular(12), onTap: () {}, child: Container(
2 durationMs int 动画时长 毫秒 200 curve Curve 动画曲线 - Curves.fastOutSlowIn clockwise bool 是否顺时针旋转 - true onTap ToggleRotate( child: Icon(Icons.arrow_upward,size: 60,color: Colors.orangeAccent), onTap: () {}, clockwise: false, //是否是顺时针 child: Icon(Icons.arrow_upward,size: 60,color: Colors.orangeAccent), onTap Curves.linear, child: Image(width:60,height: 60,image: AssetImage("assets/images/icon_28.jpg")), onTap 否则第二次是不会动的 在这里只用onTap回调点击事件,暴露给外界处理。 clockwise决定是否是顺时针旋转,这样该组件就完成了。
top: (height - 200) * 0.5, left: (width - 200) * 0.5, child: GestureDetector( onTap height - 200) * 0.5 - 50, left: (width - 200) * 0.5 - 50, child: GestureDetector( onTap height - 200) * 0.5 + 50, left: (width - 200) * 0.5 + 50, child: GestureDetector( onTap height - 200) * 0.5 - 50, left: (width - 200) * 0.5 - 50, child: GestureDetector( onTap 200) * 0.5, left: (width - 200) * 0.5, child: GestureDetector( onTap
动画作用的组件在两个界面中都存在 , 给这两个 Hero 组件都设置相同的标识 , 通过该标识可以标识两个 Hero 组件之间进行动画过渡 ; 该 Hero 动画组件封装内容 : VoidCallback onTap 组件之间进行动画过渡 /// 同时该字符串也是图片的 url 网络地址 final String imageUrl; /// 点击后的回调事件 final VoidCallback onTap : onTap, child: Image.network(imageUrl, fit: BoxFit.contain,), ), ),), ); 20210329101628636.jpg", width: 300, // 点击事件 , 这里点击该组件后 , 跳转到新页面 onTap : onTap, child: Image.network(imageUrl, fit: BoxFit.contain,), ), ),), );
final IconData icons; final MaterialColor color; final String btnName; final GestureTapCallback onTap {@required this.icons, @required this.btnName, this.color = Colors.grey, this.onTap widget.color), Text(widget.btnName, style: TextStyle(color: widget.color)) ], ), onTap : widget.onTap, ); } } 使用的时候 CustomComponent( icons: Icons.comment, btnName: '评论', ), 或者换一种定义方式 CustomComponent(this.icons, this.btnName, {this.color= Colors.grey, this.onTap}); 使用的方式 CustomComponent
MineItemWidget extends StatelessWidget { String imageName; String title; @required VoidCallback onTap ; MineItemWidget(this.imageName,this.title,{this.onTap}); @override Widget build(BuildContext , ) ); } Widget _mineItem(String imageName,String title) { return InkWell( onTap : (){ this.onTap(); }, child: Row( children: <Widget>[ Expanded }), _listViewLine, MineItemWidget("images/tab_car_n.png","联系客服",onTap
} }, { text: '确定', style: 'color:#108ee9;', onTap .85, btns: [ { text: '微信支付', style: 'color:#179b16;', onTap ; } }, { text: '取消', onTap() { console.log( false, btns: [ { text: '恢复', style: 'color:#108ee9;', onTap } }, { text: '删除', style: 'color:#e63d23;', onTap
child: InkWell( onTap: widget.onPressed, } ---->[flutter/lib/src/material/ink_well.dart:813 ( onTap: onTap,//onTap传给了父类 } ---->[flutter/lib/src/material/ink_well.dart:184]------- class InkResponse child: GestureDetector(//通过onTap回调_handleTap方法 onTap: enabled ? if (widget.onTap ! : () { print("onTap in my box"); }, ); 2.2:事件一览(第一波):葫芦七兄弟 首先介绍的的是常用的这七个,根据名字来看应该都不难理解 事件名
首先我们看一段代码,如下代码所示,可以看到: 首先我们定义了一个叫 idx 的 int 型参数; 然后在 for 循环里添加了三个 InkWell 可点击控件; 最后在 onTap 里面将 idx 打印出来 contents = []; int idx = 0; for (var imgUrl in images) { contents.add(InkWell( onTap {core::List::add}(new ink5::InkWell::•(onTap: () → Null { core::print("######## ${idx}" {core::List::add}(new ink5::InkWell::•(onTap: () → Null { core::print("######## ${index 而对于 for 循环外定义的 core::int* idx , 循环内的所有 onTap 都可以指向它这个地址,所以导致点击时都输出了同一个 idx 的值。
} }, { text: '确定', style: 'color:#108ee9;', onTap .85, btns: [ { text: '微信支付', style: 'color:#179b16;', onTap ; } }, { text: '取消', onTap() { console.log( false, btns: [ { text: '恢复', style: 'color:#108ee9;', onTap } }, { text: '删除', style: 'color:#e63d23;', onTap
child: Text('Drawer Header'), ), ListTile( title: const Text('Item 1'), onTap /// Drawer 头部 Header Material( color: Colors.blueAccent, child: InkWell( onTap: (){ /// ), ListTile( leading: Icon(Icons.favorite_border), title: Text('Favourites'), onTap }, ), ListTile( leading: Icon(Icons.workspaces), title: Text('Workflow'), onTap : (){}, ), ListTile( leading: Icon(Icons.update), title: Text('Updates'), onTap
Gesture recognition: ListTile 可以检测用户的点击和长按事件,onTap 为单击,onLongPress 为长按。 subtitle: Text('A strong animal'), trailing: Icon(Icons.keyboard_arrow_right), onTap subtitle: Text('Provider of milk'), trailing: Icon(Icons.keyboard_arrow_right), onTap subtitle: Text('Comes with humps'), trailing: Icon(Icons.keyboard_arrow_right), onTap subtitle: Text('Provides wool'), trailing: Icon(Icons.keyboard_arrow_right), onTap
this.height, BoxConstraints constraints, this.margin, this.transform, @required this.onTap 基于这个问题,在创建整个 SlideItem 的时候,通过构造函数把每一个 menu 都添加上了 GestureDetector,然后在 onTap() 回调中调用 menu 的 onTap() 方法, w.onTap(); dismiss(); }, )) .toList()); 5. 完整的代码如下: GestureDetector( behavior: HitTestBehavior.opaque, onTap: (){ if(_controller.offset = 0){ dismiss(); }else{ onTap(); } }, child: SizedBox( width: screenWidth
点击其他2个item时没有反应,添加切换效果: int _currentIndex = 0; BottomNavigationBar( onTap: (int index) { currentIndex代表当前显示导航的索引,当前切换时调用onTap,在onTap回调中调用setState方法改变_currentIndex的值达到切换的效果。 效果如下: ? 通过切换导航而改变页面是App中最常用的方式,开始构建页面的切换: int _currentIndex = 0; Widget _currBody = HomePage(); _onTap(int }); } Scaffold( body: _currBody, bottomNavigationBar: BottomNavigationBar( onTap : _onTap, type: BottomNavigationBarType.shifting, selectedItemColor: Theme.of(context
, btns: [ { text: '确定', style: 'background:#12b7f5;color:#fff;font-size:14px;', onTap , btns: [ { text: '取消', onTap() { wcPop.close(shieldIdx); } }, { text : '确定', style: 'color: #12b7f9;', onTap() { wcPop({ content: '消息屏蔽成功!'
onTap: () => Navigator.pop(context, "A"), ), Divider(), //分割线 ListTile( title: Text("分享B"), onTap: () => Navigator.pop(context, "B" Divider(), ListTile( title: Text("分享C"), onTap Divider(), ListTile( title: Text("分享D"), onTap Divider(), ListTile( title: Text("分享E"), onTap