September 2019
Beginner
512 pages
12h 52m
English
Let's see how the horizontal version looks in code:
// part of drag_event_example.dart (full source code in the attached files)GestureDetector( onHorizontalDragStart: (DragStartDetails details) { setState(() { _move = Offset.zero; _dragging = true; }); }, onHorizontalDragUpdate: (DragUpdateDetails details) { setState(() { _move += details.delta; }); }, onHorizontalDragEnd: (DragEndDetails details) { setState(() { _dragging = false; _dragCount++; }); }, child: ... // for brevity)
This time, we need a bit more work than for tap events. In the example, we have three properties present in the state:
Read now
Unlock full access