Commit 4fe79442 authored by jslavitz's avatar jslavitz Committed by Mehmet Fidanboylu

Reverts default DragStartBehavior to DragStartBehavior.down (#26734)

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