mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Reverts default DragStartBehavior to DragStartBehavior.down (#26734)
This commit is contained in:
parent
563972ecac
commit
4fe79442c8
@ -59,7 +59,7 @@ class CupertinoSwitch extends StatefulWidget {
|
||||
@required this.value,
|
||||
@required this.onChanged,
|
||||
this.activeColor,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(dragStartBehavior != null),
|
||||
super(key: key);
|
||||
|
||||
@ -96,6 +96,7 @@ class CupertinoSwitch extends StatefulWidget {
|
||||
/// [CupertinoTheme] in accordance to native iOS behavior.
|
||||
final Color activeColor;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// {@template flutter.cupertino.switch.dragStartBehavior}
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
@ -108,7 +109,7 @@ class CupertinoSwitch extends StatefulWidget {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
@ -147,7 +148,7 @@ class _CupertinoSwitchRenderObjectWidget extends LeafRenderObjectWidget {
|
||||
this.activeColor,
|
||||
this.onChanged,
|
||||
this.vsync,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : super(key: key);
|
||||
|
||||
final bool value;
|
||||
@ -200,7 +201,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
|
||||
ValueChanged<bool> onChanged,
|
||||
@required TextDirection textDirection,
|
||||
@required TickerProvider vsync,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(value != null),
|
||||
assert(activeColor != null),
|
||||
assert(vsync != null),
|
||||
|
@ -54,7 +54,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
|
||||
/// [dragStartBehavior] must not be null.
|
||||
DragGestureRecognizer({
|
||||
Object debugOwner,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(dragStartBehavior != null),
|
||||
super(debugOwner: debugOwner);
|
||||
|
||||
|
@ -251,7 +251,7 @@ class DayPicker extends StatelessWidget {
|
||||
@required this.lastDate,
|
||||
@required this.displayedMonth,
|
||||
this.selectableDayPredicate,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(selectedDate != null),
|
||||
assert(currentDate != null),
|
||||
assert(onChanged != null),
|
||||
@ -284,6 +284,7 @@ class DayPicker extends StatelessWidget {
|
||||
/// Optional user supplied predicate function to customize selectable days.
|
||||
final SelectableDayPredicate selectableDayPredicate;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
/// If set to [DragStartBehavior.start], the drag gesture used to scroll a
|
||||
@ -295,7 +296,7 @@ class DayPicker extends StatelessWidget {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
@ -524,7 +525,7 @@ class MonthPicker extends StatefulWidget {
|
||||
@required this.firstDate,
|
||||
@required this.lastDate,
|
||||
this.selectableDayPredicate,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(selectedDate != null),
|
||||
assert(onChanged != null),
|
||||
assert(!firstDate.isAfter(lastDate)),
|
||||
@ -787,7 +788,7 @@ class YearPicker extends StatefulWidget {
|
||||
@required this.onChanged,
|
||||
@required this.firstDate,
|
||||
@required this.lastDate,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(selectedDate != null),
|
||||
assert(onChanged != null),
|
||||
assert(!firstDate.isAfter(lastDate)),
|
||||
|
@ -180,7 +180,7 @@ class DrawerController extends StatefulWidget {
|
||||
@required this.child,
|
||||
@required this.alignment,
|
||||
this.drawerCallback,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(child != null),
|
||||
assert(dragStartBehavior != null),
|
||||
assert(alignment != null),
|
||||
@ -200,6 +200,7 @@ class DrawerController extends StatefulWidget {
|
||||
/// Optional callback that is called when a [Drawer] is opened or closed.
|
||||
final DrawerCallback drawerCallback;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// {@template flutter.material.drawer.dragStartBehavior}
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
@ -212,7 +213,7 @@ class DrawerController extends StatefulWidget {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
|
@ -75,7 +75,7 @@ class PaginatedDataTable extends StatefulWidget {
|
||||
this.rowsPerPage = defaultRowsPerPage,
|
||||
this.availableRowsPerPage = const <int>[defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10],
|
||||
this.onRowsPerPageChanged,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
@required this.source
|
||||
}) : assert(header != null),
|
||||
assert(columns != null),
|
||||
|
@ -796,7 +796,7 @@ class Scaffold extends StatefulWidget {
|
||||
this.resizeToAvoidBottomPadding,
|
||||
this.resizeToAvoidBottomInset,
|
||||
this.primary = true,
|
||||
this.drawerDragStartBehavior = DragStartBehavior.start,
|
||||
this.drawerDragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(primary != null),
|
||||
assert(drawerDragStartBehavior != null),
|
||||
super(key: key);
|
||||
|
@ -551,7 +551,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
|
||||
this.labelPadding,
|
||||
this.unselectedLabelColor,
|
||||
this.unselectedLabelStyle,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
this.onTap,
|
||||
}) : assert(tabs != null),
|
||||
assert(isScrollable != null),
|
||||
@ -1043,7 +1043,7 @@ class TabBarView extends StatefulWidget {
|
||||
@required this.children,
|
||||
this.controller,
|
||||
this.physics,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(children != null),
|
||||
assert(dragStartBehavior != null),
|
||||
super(key: key);
|
||||
|
@ -143,7 +143,7 @@ class TextField extends StatefulWidget {
|
||||
this.cursorColor,
|
||||
this.keyboardAppearance,
|
||||
this.scrollPadding = const EdgeInsets.all(20.0),
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
this.enableInteractiveSelection,
|
||||
this.onTap,
|
||||
this.buildCounter,
|
||||
|
@ -84,7 +84,7 @@ class Dismissible extends StatefulWidget {
|
||||
this.dismissThresholds = const <DismissDirection, double>{},
|
||||
this.movementDuration = const Duration(milliseconds: 200),
|
||||
this.crossAxisEndOffset = 0.0,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(key != null),
|
||||
assert(secondaryBackground != null ? background != null : true),
|
||||
assert(dragStartBehavior != null),
|
||||
@ -146,6 +146,7 @@ class Dismissible extends StatefulWidget {
|
||||
/// it is positive or negative.
|
||||
final double crossAxisEndOffset;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
/// If set to [DragStartBehavior.start], the drag gesture used to dismiss a
|
||||
@ -156,7 +157,7 @@ class Dismissible extends StatefulWidget {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
|
@ -217,7 +217,7 @@ class EditableText extends StatefulWidget {
|
||||
this.cursorRadius,
|
||||
this.scrollPadding = const EdgeInsets.all(20.0),
|
||||
this.keyboardAppearance = Brightness.light,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
this.enableInteractiveSelection,
|
||||
}) : assert(controller != null),
|
||||
assert(focusNode != null),
|
||||
|
@ -186,7 +186,7 @@ class GestureDetector extends StatelessWidget {
|
||||
this.onScaleEnd,
|
||||
this.behavior,
|
||||
this.excludeFromSemantics = false,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(excludeFromSemantics != null),
|
||||
assert(dragStartBehavior != null),
|
||||
assert(() {
|
||||
@ -373,6 +373,7 @@ class GestureDetector extends StatelessWidget {
|
||||
/// duplication of information.
|
||||
final bool excludeFromSemantics;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
/// If set to [DragStartBehavior.start], gesture drag behavior will
|
||||
@ -383,7 +384,7 @@ class GestureDetector extends StatelessWidget {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// Only the [onStart] callbacks for the [VerticalDragGestureRecognizer],
|
||||
/// [HorizontalDragGestureRecognizer] and [PanGestureRecognizer] are affected
|
||||
|
@ -189,7 +189,7 @@ class NestedScrollView extends StatefulWidget {
|
||||
this.physics,
|
||||
@required this.headerSliverBuilder,
|
||||
@required this.body,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(scrollDirection != null),
|
||||
assert(reverse != null),
|
||||
assert(headerSliverBuilder != null),
|
||||
@ -371,7 +371,7 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView {
|
||||
@required ScrollController controller,
|
||||
@required List<Widget> slivers,
|
||||
@required this.handle,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : super(
|
||||
scrollDirection: scrollDirection,
|
||||
reverse: reverse,
|
||||
|
@ -424,7 +424,7 @@ class PageView extends StatefulWidget {
|
||||
this.pageSnapping = true,
|
||||
this.onPageChanged,
|
||||
List<Widget> children = const <Widget>[],
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : controller = controller ?? _defaultPageController,
|
||||
childrenDelegate = SliverChildListDelegate(children),
|
||||
super(key: key);
|
||||
@ -451,7 +451,7 @@ class PageView extends StatefulWidget {
|
||||
this.onPageChanged,
|
||||
@required IndexedWidgetBuilder itemBuilder,
|
||||
int itemCount,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : controller = controller ?? _defaultPageController,
|
||||
childrenDelegate = SliverChildBuilderDelegate(itemBuilder, childCount: itemCount),
|
||||
super(key: key);
|
||||
@ -467,7 +467,7 @@ class PageView extends StatefulWidget {
|
||||
this.pageSnapping = true,
|
||||
this.onPageChanged,
|
||||
@required this.childrenDelegate,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(childrenDelegate != null),
|
||||
controller = controller ?? _defaultPageController,
|
||||
super(key: key);
|
||||
|
@ -61,7 +61,7 @@ abstract class ScrollView extends StatelessWidget {
|
||||
this.shrinkWrap = false,
|
||||
this.cacheExtent,
|
||||
this.semanticChildCount,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(reverse != null),
|
||||
assert(shrinkWrap != null),
|
||||
assert(dragStartBehavior != null),
|
||||
@ -404,7 +404,7 @@ class CustomScrollView extends ScrollView {
|
||||
double cacheExtent,
|
||||
this.slivers = const <Widget>[],
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : super(
|
||||
key: key,
|
||||
scrollDirection: scrollDirection,
|
||||
@ -448,7 +448,7 @@ abstract class BoxScrollView extends ScrollView {
|
||||
this.padding,
|
||||
double cacheExtent,
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : super(
|
||||
key: key,
|
||||
scrollDirection: scrollDirection,
|
||||
@ -750,7 +750,7 @@ class ListView extends BoxScrollView {
|
||||
double cacheExtent,
|
||||
List<Widget> children = const <Widget>[],
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : childrenDelegate = SliverChildListDelegate(
|
||||
children,
|
||||
addAutomaticKeepAlives: addAutomaticKeepAlives,
|
||||
@ -813,7 +813,7 @@ class ListView extends BoxScrollView {
|
||||
bool addSemanticIndexes = true,
|
||||
double cacheExtent,
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : childrenDelegate = SliverChildBuilderDelegate(
|
||||
itemBuilder,
|
||||
childCount: itemCount,
|
||||
@ -1265,7 +1265,7 @@ class GridView extends BoxScrollView {
|
||||
@required this.childrenDelegate,
|
||||
double cacheExtent,
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(gridDelegate != null),
|
||||
assert(childrenDelegate != null),
|
||||
super(
|
||||
@ -1315,7 +1315,7 @@ class GridView extends BoxScrollView {
|
||||
double cacheExtent,
|
||||
List<Widget> children = const <Widget>[],
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : gridDelegate = SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: crossAxisCount,
|
||||
mainAxisSpacing: mainAxisSpacing,
|
||||
@ -1373,7 +1373,7 @@ class GridView extends BoxScrollView {
|
||||
bool addSemanticIndexes = true,
|
||||
List<Widget> children = const <Widget>[],
|
||||
int semanticChildCount,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.start,
|
||||
DragStartBehavior dragStartBehavior = DragStartBehavior.down,
|
||||
}) : gridDelegate = SliverGridDelegateWithMaxCrossAxisExtent(
|
||||
maxCrossAxisExtent: maxCrossAxisExtent,
|
||||
mainAxisSpacing: mainAxisSpacing,
|
||||
|
@ -81,7 +81,7 @@ class Scrollable extends StatefulWidget {
|
||||
@required this.viewportBuilder,
|
||||
this.excludeFromSemantics = false,
|
||||
this.semanticChildCount,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(axisDirection != null),
|
||||
assert(dragStartBehavior != null),
|
||||
assert(viewportBuilder != null),
|
||||
@ -182,6 +182,7 @@ class Scrollable extends StatefulWidget {
|
||||
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
|
||||
final int semanticChildCount;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// {@template flutter.widgets.scrollable.dragStartBehavior}
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
@ -193,7 +194,7 @@ class Scrollable extends StatefulWidget {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
|
@ -193,7 +193,7 @@ class SingleChildScrollView extends StatelessWidget {
|
||||
this.physics,
|
||||
this.controller,
|
||||
this.child,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : assert(scrollDirection != null),
|
||||
assert(dragStartBehavior != null),
|
||||
assert(!(controller != null && primary == true),
|
||||
|
@ -230,7 +230,7 @@ class TextSelectionOverlay {
|
||||
@required this.renderObject,
|
||||
this.selectionControls,
|
||||
this.selectionDelegate,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}): assert(value != null),
|
||||
assert(context != null),
|
||||
_value = value {
|
||||
@ -265,6 +265,7 @@ class TextSelectionOverlay {
|
||||
/// text field.
|
||||
final TextSelectionDelegate selectionDelegate;
|
||||
|
||||
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
|
||||
/// Determines the way that drag start behavior is handled.
|
||||
///
|
||||
/// If set to [DragStartBehavior.start], handle drag behavior will
|
||||
@ -275,7 +276,7 @@ class TextSelectionOverlay {
|
||||
/// animation smoother and setting it to [DragStartBehavior.down] will make
|
||||
/// drag behavior feel slightly more reactive.
|
||||
///
|
||||
/// By default, the drag start behavior is [DragStartBehavior.start].
|
||||
/// By default, the drag start behavior is [DragStartBehavior.down].
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
@ -467,7 +468,7 @@ class _TextSelectionHandleOverlay extends StatefulWidget {
|
||||
@required this.onSelectionHandleChanged,
|
||||
@required this.onSelectionHandleTapped,
|
||||
@required this.selectionControls,
|
||||
this.dragStartBehavior = DragStartBehavior.start,
|
||||
this.dragStartBehavior = DragStartBehavior.down,
|
||||
}) : super(key: key);
|
||||
|
||||
final TextSelection selection;
|
||||
|
@ -58,7 +58,9 @@ void main() {
|
||||
tester.route(pointer.move(const Offset(20.0, 30.0))); // moved 10 horizontally and 20 vertically which is 22 total
|
||||
expect(didStartPan, isTrue); // 22 > 18
|
||||
didStartPan = false;
|
||||
expect(updatedScrollDelta, null);
|
||||
// TODO(jslavitz): revert this testing change.
|
||||
expect(updatedScrollDelta, const Offset(10.0, 20.0));
|
||||
updatedScrollDelta = null;
|
||||
expect(didEndPan, isFalse);
|
||||
expect(didTap, isFalse);
|
||||
|
||||
@ -164,57 +166,7 @@ void main() {
|
||||
drag.dispose();
|
||||
});
|
||||
|
||||
testGesture('Should report most recent point to onStart by default', (GestureTester tester) {
|
||||
final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
|
||||
final VerticalDragGestureRecognizer competingDrag = VerticalDragGestureRecognizer();
|
||||
|
||||
Offset positionAtOnStart;
|
||||
drag.onStart = (DragStartDetails details) {
|
||||
positionAtOnStart = details.globalPosition;
|
||||
};
|
||||
|
||||
final TestPointer pointer = TestPointer(5);
|
||||
final PointerDownEvent down = pointer.down(const Offset(10.0, 10.0));
|
||||
drag.addPointer(down);
|
||||
competingDrag.addPointer(down);
|
||||
tester.closeArena(5);
|
||||
tester.route(down);
|
||||
|
||||
tester.route(pointer.move(const Offset(30.0, 0.0)));
|
||||
drag.dispose();
|
||||
competingDrag.dispose();
|
||||
|
||||
expect(positionAtOnStart, const Offset(30.0, 00.0));
|
||||
});
|
||||
|
||||
testGesture('Should report most recent point to onStart with a start configuration', (GestureTester tester) {
|
||||
final HorizontalDragGestureRecognizer drag =
|
||||
HorizontalDragGestureRecognizer();
|
||||
final VerticalDragGestureRecognizer competingDrag = VerticalDragGestureRecognizer();
|
||||
|
||||
Offset positionAtOnStart;
|
||||
drag.onStart = (DragStartDetails details) {
|
||||
positionAtOnStart = details.globalPosition;
|
||||
};
|
||||
Offset updateOffset;
|
||||
drag.onUpdate = (DragUpdateDetails details) {
|
||||
updateOffset = details.globalPosition;
|
||||
};
|
||||
|
||||
final TestPointer pointer = TestPointer(5);
|
||||
final PointerDownEvent down = pointer.down(const Offset(10.0, 10.0));
|
||||
drag.addPointer(down);
|
||||
competingDrag.addPointer(down);
|
||||
tester.closeArena(5);
|
||||
tester.route(down);
|
||||
|
||||
tester.route(pointer.move(const Offset(30.0, 0.0)));
|
||||
drag.dispose();
|
||||
competingDrag.dispose();
|
||||
|
||||
expect(positionAtOnStart, const Offset(30.0, 0.0));
|
||||
expect(updateOffset, null);
|
||||
});
|
||||
// TODO(jslavitz): Revert these tests.
|
||||
|
||||
testGesture('Should report initial down point to onStart with a down configuration', (GestureTester tester) {
|
||||
final HorizontalDragGestureRecognizer drag =
|
||||
|
Loading…
Reference in New Issue
Block a user