Flutter教学

Flutter(85):Draggable组件之Draggabl

2020-11-30  本文已影响0人  starryxp

Flutter教学目录持续更新中

Github源代码持续更新中

1.Draggable介绍

拖拽组件

2.Draggable属性

3.使用

      body: Center(
        child: Draggable(
          child: Container(
            width: 100,
            height: 100,
            color: Colors.blue,
          ),
          feedback: Container(
            color: Colors.red,
            width: 100,
            height: 100,
          ),
          childWhenDragging: Container(
            color: Colors.amber,
            width: 100,
            height: 100,
          ),
          feedbackOffset: Offset(0, 10),
          dragAnchor: DragAnchor.child,
          onDragStarted: () {
            print("onDragStarted");
          },
          onDragEnd: (DraggableDetails details) {
            print("onDragEnd : $details");
          },
          onDraggableCanceled: (Velocity velocity, Offset offset) {
            print('onDraggableCanceled velocity:$velocity,offset:$offset');
          },
          onDragCompleted: () {
            print('onDragCompleted');
          },
        ),
      ),�
未拖拽.png 拖拽中.png

下一节:Draggable组件之DragTarget

Flutter(86):Draggable组件之DragTarget

Flutter教学目录持续更新中

Github源代码持续更新中

上一篇 下一篇

猜你喜欢

热点阅读