Flutter-手势GestureDetector,InkWell,navigationBar

599 阅读1分钟
GestureDetector({
Key key,
this.child,

this.onTap,----点击----Function()---
this.onTapDown,----按下:Function(TapDownDetails details)---
this.onTapUp,---- 抬起:Function(TapUpDetails details)----
this.onTapCancel,----取消(onTap无法触发时):Function()----

this.onDoubleTap,----双击----void Function()----
this.onLongPress,----长按----void Function()----
this.onLongPressUp,----长按松开----void Function()----

this.onVerticalDragDown,----竖直拖动按下----Function(DragDownDetails details)----
this.onVerticalDragStart,----竖直拖动开始----Function(DragStartDetails details)----
this.onVerticalDragUpdate,----竖直拖动更新----Function(DragUpdateDetails details)----
this.onVerticalDragEnd,----竖直拖动结束----Function(DragEndDetails details)----
this.onVerticalDragCancel,----竖直拖动取消----Function()----

this.onHorizontalDragDown,
this.onHorizontalDragStart,
this.onHorizontalDragUpdate,
this.onHorizontalDragEnd,
this.onHorizontalDragCancel,

this.onPanDown,
this.onPanStart,
this.onPanUpdate,
this.onPanEnd,
this.onPanCancel,

this.onScaleStart,
this.onScaleUpdate,
this.onScaleEnd,
this.behavior,
this.excludeFromSemantics = false

 

关于跳转

跳转方式1:加routes

return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.lightBlue,
),
home: new CanvasPage(),
routes: <String, WidgetBuilder> {
'/clock': (BuildContext context) => ClockPage(),
},);

//跳转方法:

Navigator.of(context).pushNamed('/clock');

跳转方式2:直接开控件

Navigator.push(context,MaterialPageRoute(builder: (bu) => ClockPage()));

关闭方式:

Navigator.pop(context);