Revert "Teach drag start behaviors to DragGestureRecognizer (#23424)" (#26209)
This reverts commit 08538f91f0b7f3f448355e998bb536b06a1d1145.
diff --git a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
index a978199..3f08bde 100644
--- a/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/drawer_demo.dart
@@ -3,7 +3,6 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../../gallery/demo.dart';
@@ -80,7 +79,6 @@
@override
Widget build(BuildContext context) {
return Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
key: _scaffoldKey,
appBar: AppBar(
leading: IconButton(
@@ -108,7 +106,6 @@
),
otherAccountsPictures: <Widget>[
GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
_onOtherAccountsTap(context);
},
@@ -123,7 +120,6 @@
),
),
GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
_onOtherAccountsTap(context);
},
@@ -153,7 +149,6 @@
removeTop: true,
child: Expanded(
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
padding: const EdgeInsets.only(top: 8.0),
children: <Widget>[
Stack(
diff --git a/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart b/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
index 4deab75..ddbea4b 100644
--- a/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
+++ b/examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
@@ -6,7 +6,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../../gallery/demo.dart';
@@ -68,7 +67,6 @@
labelText: widget.labelText,
helperText: widget.helperText,
suffixIcon: GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
setState(() {
_obscureText = !_obscureText;
@@ -169,7 +167,6 @@
@override
Widget build(BuildContext context) {
return Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
key: _scaffoldKey,
appBar: AppBar(
title: const Text('Text fields'),
@@ -183,7 +180,6 @@
autovalidate: _autovalidate,
onWillPop: _warnUserAboutInvalidData,
child: SingleChildScrollView(
- dragStartBehavior: DragStartBehavior.down,
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
diff --git a/examples/stocks/lib/stock_home.dart b/examples/stocks/lib/stock_home.dart
index f13b51b..c77134e 100644
--- a/examples/stocks/lib/stock_home.dart
+++ b/examples/stocks/lib/stock_home.dart
@@ -5,7 +5,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart' show debugDumpRenderTree, debugDumpLayerTree, debugDumpSemanticsTree, DebugSemanticsDumpOrder;
import 'package:flutter/scheduler.dart' show timeDilation;
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'stock_data.dart';
import 'stock_list.dart';
import 'stock_strings.dart';
@@ -111,7 +110,6 @@
Widget _buildDrawer(BuildContext context) {
return Drawer(
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
const DrawerHeader(child: Center(child: Text('Stocks'))),
const ListTile(
@@ -319,13 +317,11 @@
return DefaultTabController(
length: 2,
child: Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
key: _scaffoldKey,
appBar: _isSearching ? buildSearchBar() : buildAppBar(),
floatingActionButton: buildFloatingActionButton(),
drawer: _buildDrawer(context),
body: TabBarView(
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
_buildStockTab(context, StockHomeTab.market, widget.stocks.allSymbols),
_buildStockTab(context, StockHomeTab.portfolio, portfolioSymbols),
diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart
index f32b2d8..bbb1d7a 100644
--- a/packages/flutter/lib/src/cupertino/switch.dart
+++ b/packages/flutter/lib/src/cupertino/switch.dart
@@ -52,16 +52,12 @@
/// * <https://developer.apple.com/ios/human-interface-guidelines/controls/switches/>
class CupertinoSwitch extends StatefulWidget {
/// Creates an iOS-style switch.
- ///
- /// [dragStartBehavior] must not be null.
const CupertinoSwitch({
Key key,
@required this.value,
@required this.onChanged,
this.activeColor,
- this.dragStartBehavior = DragStartBehavior.start,
- }) : assert(dragStartBehavior != null),
- super(key: key);
+ }) : super(key: key);
/// Whether this switch is on or off.
final bool value;
@@ -96,26 +92,6 @@
/// [CupertinoTheme] in accordance to native iOS behavior.
final Color activeColor;
- /// {@template flutter.cupertino.switch.dragStartBehavior}
- /// Determines the way that drag start behavior is handled.
- ///
- /// If set to [DragStartBehavior.start], the drag behavior used to move the
- /// switch from on to off will begin upon the detection of a drag gesture. If
- /// set to [DragStartBehavior.down] it will begin when a down event is first
- /// detected.
- ///
- /// In general, setting this to [DragStartBehavior.start] will make drag
- /// 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].
- ///
- /// See also:
- ///
- /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
- /// {@endtemplate}
- final DragStartBehavior dragStartBehavior;
-
@override
_CupertinoSwitchState createState() => _CupertinoSwitchState();
@@ -135,7 +111,6 @@
activeColor: widget.activeColor ?? CupertinoColors.activeGreen,
onChanged: widget.onChanged,
vsync: this,
- dragStartBehavior: widget.dragStartBehavior,
);
}
}
@@ -147,14 +122,12 @@
this.activeColor,
this.onChanged,
this.vsync,
- this.dragStartBehavior = DragStartBehavior.start,
}) : super(key: key);
final bool value;
final Color activeColor;
final ValueChanged<bool> onChanged;
final TickerProvider vsync;
- final DragStartBehavior dragStartBehavior;
@override
_RenderCupertinoSwitch createRenderObject(BuildContext context) {
@@ -164,7 +137,6 @@
onChanged: onChanged,
textDirection: Directionality.of(context),
vsync: vsync,
- dragStartBehavior: dragStartBehavior
);
}
@@ -175,8 +147,7 @@
..activeColor = activeColor
..onChanged = onChanged
..textDirection = Directionality.of(context)
- ..vsync = vsync
- ..dragStartBehavior = dragStartBehavior;
+ ..vsync = vsync;
}
}
@@ -200,7 +171,6 @@
ValueChanged<bool> onChanged,
@required TextDirection textDirection,
@required TickerProvider vsync,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : assert(value != null),
assert(activeColor != null),
assert(vsync != null),
@@ -218,8 +188,7 @@
_drag = HorizontalDragGestureRecognizer()
..onStart = _handleDragStart
..onUpdate = _handleDragUpdate
- ..onEnd = _handleDragEnd
- ..dragStartBehavior = dragStartBehavior;
+ ..onEnd = _handleDragEnd;
_positionController = AnimationController(
duration: _kToggleDuration,
value: value ? 1.0 : 0.0,
@@ -307,14 +276,6 @@
markNeedsPaint();
}
- DragStartBehavior get dragStartBehavior => _drag.dragStartBehavior;
- set dragStartBehavior(DragStartBehavior value) {
- assert(value != null);
- if (_drag.dragStartBehavior == value)
- return;
- _drag.dragStartBehavior = value;
- }
-
bool get isInteractive => onChanged != null;
TapGestureRecognizer _tap;
diff --git a/packages/flutter/lib/src/gestures/monodrag.dart b/packages/flutter/lib/src/gestures/monodrag.dart
index c823311..4c25e68 100644
--- a/packages/flutter/lib/src/gestures/monodrag.dart
+++ b/packages/flutter/lib/src/gestures/monodrag.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:flutter/foundation.dart';
-
import 'arena.dart';
import 'constants.dart';
import 'drag_details.dart';
@@ -50,36 +48,7 @@
/// * [PanGestureRecognizer], for drags that are not locked to a single axis.
abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
/// Initialize the object.
- ///
- /// [dragStartBehavior] must not be null.
- DragGestureRecognizer({
- Object debugOwner,
- this.dragStartBehavior = DragStartBehavior.start,
- }) : assert(dragStartBehavior != null),
- super(debugOwner: debugOwner);
-
- /// Configure the behavior of offsets sent to [onStart].
- ///
- /// If set to [DragStartBehavior.start], the [onStart] callback will be called at the time and
- /// position when the gesture detector wins the arena. If [DragStartBehavior.down],
- /// [onStart] will be called at the time and position when a down event was
- /// first detected.
- ///
- /// For more information about the gesture arena:
- /// https://flutter.io/docs/development/ui/advanced/gestures#gesture-disambiguation
- ///
- /// By default, the drag start behavior is [DragStartBehavior.start].
- ///
- /// ## Example:
- ///
- /// A finger presses down on the screen with offset (500.0, 500.0),
- /// and then moves to position (510.0, 500.0) before winning the arena.
- /// With [dragStartBehavior] set to [DragStartBehavior.down], the [onStart]
- /// callback will be called at the time corresponding to the touch's position
- /// at (500.0, 500.0). If it is instead set to [DragStartBehavior.start],
- /// [onStart] will be called at the time corresponding to the touch's position
- /// at (510.0, 500.0).
- DragStartBehavior dragStartBehavior;
+ DragGestureRecognizer({ Object debugOwner }) : super(debugOwner: debugOwner);
/// A pointer has contacted the screen and might begin to move.
///
@@ -91,11 +60,6 @@
///
/// The position of the pointer is provided in the callback's `details`
/// argument, which is a [DragStartDetails] object.
- ///
- /// Depending on the value of [dragStartBehavior], this function will be
- /// called on the initial touch down, if set to [DragStartBehavior.down] or
- /// when the drag gesture is first detected, if set to
- /// [DragStartBehavior.start].
GestureDragStartCallback onStart;
/// A pointer that is in contact with the screen and moving has moved again.
@@ -199,16 +163,6 @@
_state = _DragState.accepted;
final Offset delta = _pendingDragOffset;
final Duration timestamp = _lastPendingEventTimestamp;
- Offset updateDelta;
- switch (dragStartBehavior) {
- case DragStartBehavior.start:
- _initialPosition = _initialPosition + delta;
- updateDelta = Offset.zero;
- break;
- case DragStartBehavior.down:
- updateDelta = _getDeltaForDetails(delta);
- break;
- }
_pendingDragOffset = Offset.zero;
_lastPendingEventTimestamp = null;
if (onStart != null) {
@@ -217,12 +171,13 @@
globalPosition: _initialPosition,
)));
}
- if (updateDelta != Offset.zero && onUpdate != null) {
+ if (delta != Offset.zero && onUpdate != null) {
+ final Offset deltaForDetails = _getDeltaForDetails(delta);
invokeCallback<void>('onUpdate', () => onUpdate(DragUpdateDetails(
sourceTimeStamp: timestamp,
- delta: updateDelta,
- primaryDelta: _getPrimaryValueFromOffset(updateDelta),
- globalPosition: _initialPosition + updateDelta, // Only adds delta for down behaviour
+ delta: deltaForDetails,
+ primaryDelta: _getPrimaryValueFromOffset(delta),
+ globalPosition: _initialPosition + deltaForDetails,
)));
}
}
@@ -277,11 +232,6 @@
_velocityTrackers.clear();
super.dispose();
}
- @override
- void debugFillProperties(DiagnosticPropertiesBuilder properties) {
- super.debugFillProperties(properties);
- properties.add(EnumProperty<DragStartBehavior>('Start Behavior', dragStartBehavior));
- }
}
/// Recognizes movement in the vertical direction.
@@ -330,8 +280,7 @@
/// track each touch point independently.
class HorizontalDragGestureRecognizer extends DragGestureRecognizer {
/// Create a gesture recognizer for interactions in the horizontal axis.
- HorizontalDragGestureRecognizer({ Object debugOwner }) :
- super(debugOwner: debugOwner);
+ HorizontalDragGestureRecognizer({ Object debugOwner }) : super(debugOwner: debugOwner);
@override
bool _isFlingGesture(VelocityEstimate estimate) {
diff --git a/packages/flutter/lib/src/gestures/recognizer.dart b/packages/flutter/lib/src/gestures/recognizer.dart
index d5ddbd6..ca71a26 100644
--- a/packages/flutter/lib/src/gestures/recognizer.dart
+++ b/packages/flutter/lib/src/gestures/recognizer.dart
@@ -24,24 +24,6 @@
/// anonymous functions that return objects of particular types.
typedef RecognizerCallback<T> = T Function();
-/// Configuration of offset passed to [DragStartDetails].
-///
-/// The settings determines when a drag formally starts when the user
-/// initiates a drag.
-///
-/// See also:
-///
-/// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
-enum DragStartBehavior {
- /// Set the initial offset, at the position where the first down even was
- /// detected.
- down,
-
- /// Set the initial position at the position where the drag start event was
- /// detected.
- start,
-}
-
/// The base class that all gesture recognizers inherit from.
///
/// Provides a basic API that can be used by classes that work with
diff --git a/packages/flutter/lib/src/material/date_picker.dart b/packages/flutter/lib/src/material/date_picker.dart
index 908a43a..12261cc 100644
--- a/packages/flutter/lib/src/material/date_picker.dart
+++ b/packages/flutter/lib/src/material/date_picker.dart
@@ -8,7 +8,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'button_bar.dart';
import 'button_theme.dart';
@@ -251,12 +250,10 @@
@required this.lastDate,
@required this.displayedMonth,
this.selectableDayPredicate,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(selectedDate != null),
assert(currentDate != null),
assert(onChanged != null),
assert(displayedMonth != null),
- assert(dragStartBehavior != null),
assert(!firstDate.isAfter(lastDate)),
assert(selectedDate.isAfter(firstDate) || selectedDate.isAtSameMomentAs(firstDate)),
super(key: key);
@@ -284,13 +281,6 @@
/// Optional user supplied predicate function to customize selectable days.
final SelectableDayPredicate selectableDayPredicate;
- /// The initial drag behavior of the date picker wheel.
- ///
- /// If set to [DragStartBehavior.start], picker drag behavior will begin upon the
- /// drag gesture winning the arena. If set to [DragStartBehavior.down] it will
- /// begin when a down event is first detected.
- final DragStartBehavior dragStartBehavior;
-
/// Builds widgets showing abbreviated days of week. The first widget in the
/// returned list corresponds to the first day of week for the current locale.
///
@@ -452,7 +442,6 @@
onChanged(dayToBuild);
},
child: dayWidget,
- dragStartBehavior: dragStartBehavior,
);
}
@@ -513,7 +502,6 @@
@required this.firstDate,
@required this.lastDate,
this.selectableDayPredicate,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(selectedDate != null),
assert(onChanged != null),
assert(!firstDate.isAfter(lastDate)),
@@ -537,9 +525,6 @@
/// Optional user supplied predicate function to customize selectable days.
final SelectableDayPredicate selectableDayPredicate;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
@override
_MonthPickerState createState() => _MonthPickerState();
}
@@ -624,7 +609,6 @@
lastDate: widget.lastDate,
displayedMonth: month,
selectableDayPredicate: widget.selectableDayPredicate,
- dragStartBehavior: widget.dragStartBehavior,
);
}
@@ -685,7 +669,6 @@
return false;
},
child: PageView.builder(
- dragStartBehavior: widget.dragStartBehavior,
key: ValueKey<DateTime>(widget.selectedDate),
controller: _dayPickerController,
scrollDirection: Axis.horizontal,
@@ -776,7 +759,6 @@
@required this.onChanged,
@required this.firstDate,
@required this.lastDate,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(selectedDate != null),
assert(onChanged != null),
assert(!firstDate.isAfter(lastDate)),
@@ -796,9 +778,6 @@
/// The latest date the user is permitted to pick.
final DateTime lastDate;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
@override
_YearPickerState createState() => _YearPickerState();
}
@@ -822,7 +801,6 @@
final ThemeData themeData = Theme.of(context);
final TextStyle style = themeData.textTheme.body1;
return ListView.builder(
- dragStartBehavior: widget.dragStartBehavior,
controller: scrollController,
itemExtent: _itemExtent,
itemCount: widget.lastDate.year - widget.firstDate.year + 1,
diff --git a/packages/flutter/lib/src/material/drawer.dart b/packages/flutter/lib/src/material/drawer.dart
index 6a818e9..89c4e22 100644
--- a/packages/flutter/lib/src/material/drawer.dart
+++ b/packages/flutter/lib/src/material/drawer.dart
@@ -6,7 +6,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'colors.dart';
import 'debug.dart';
@@ -180,9 +179,7 @@
@required this.child,
@required this.alignment,
this.drawerCallback,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(child != null),
- assert(dragStartBehavior != null),
assert(alignment != null),
super(key: key);
@@ -200,26 +197,6 @@
/// Optional callback that is called when a [Drawer] is opened or closed.
final DrawerCallback drawerCallback;
- /// {@template flutter.material.drawer.dragStartBehavior}
- /// Determines the way that drag start behavior is handled.
- ///
- /// If set to [DragStartBehavior.start], the drag behavior used for opening
- /// and closing a drawer will begin upon the detection of a drag gesture. If
- /// set to [DragStartBehavior.down] it will begin when a down event is first
- /// detected.
- ///
- /// In general, setting this to [DragStartBehavior.start] will make drag
- /// 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].
- ///
- /// See also:
- ///
- /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
- /// {@endtemplate}
- final DragStartBehavior dragStartBehavior;
-
@override
DrawerControllerState createState() => DrawerControllerState();
}
@@ -422,7 +399,6 @@
onHorizontalDragEnd: _settle,
behavior: HitTestBehavior.translucent,
excludeFromSemantics: true,
- dragStartBehavior: widget.dragStartBehavior,
child: Container(width: dragAreaWidth),
),
);
@@ -434,7 +410,6 @@
onHorizontalDragEnd: _settle,
onHorizontalDragCancel: _handleDragCancel,
excludeFromSemantics: true,
- dragStartBehavior: widget.dragStartBehavior,
child: RepaintBoundary(
child: Stack(
children: <Widget>[
diff --git a/packages/flutter/lib/src/material/paginated_data_table.dart b/packages/flutter/lib/src/material/paginated_data_table.dart
index cfd0b4c..792eec9 100644
--- a/packages/flutter/lib/src/material/paginated_data_table.dart
+++ b/packages/flutter/lib/src/material/paginated_data_table.dart
@@ -6,7 +6,6 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'button_bar.dart';
import 'button_theme.dart';
@@ -75,11 +74,9 @@
this.rowsPerPage = defaultRowsPerPage,
this.availableRowsPerPage = const <int>[defaultRowsPerPage, defaultRowsPerPage * 2, defaultRowsPerPage * 5, defaultRowsPerPage * 10],
this.onRowsPerPageChanged,
- this.dragStartBehavior = DragStartBehavior.start,
@required this.source
}) : assert(header != null),
assert(columns != null),
- assert(dragStartBehavior != null),
assert(columns.isNotEmpty),
assert(sortColumnIndex == null || (sortColumnIndex >= 0 && sortColumnIndex < columns.length)),
assert(sortAscending != null),
@@ -173,9 +170,6 @@
/// [PaginatedDataTable] constructor is called.
final DataTableSource source;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
@override
PaginatedDataTableState createState() => PaginatedDataTableState();
}
@@ -423,7 +417,6 @@
),
SingleChildScrollView(
scrollDirection: Axis.horizontal,
- dragStartBehavior: widget.dragStartBehavior,
child: DataTable(
key: _tableKey,
columns: widget.columns,
@@ -442,7 +435,6 @@
child: Container(
height: 56.0,
child: SingleChildScrollView(
- dragStartBehavior: widget.dragStartBehavior,
scrollDirection: Axis.horizontal,
reverse: true,
child: Row(
diff --git a/packages/flutter/lib/src/material/scaffold.dart b/packages/flutter/lib/src/material/scaffold.dart
index 7969a86..baba3ac 100644
--- a/packages/flutter/lib/src/material/scaffold.dart
+++ b/packages/flutter/lib/src/material/scaffold.dart
@@ -10,7 +10,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'app_bar.dart';
import 'bottom_sheet.dart';
@@ -733,10 +732,7 @@
this.backgroundColor,
this.resizeToAvoidBottomPadding = true,
this.primary = true,
- this.drawerDragStartBehavior = DragStartBehavior.start,
- }) : assert(primary != null),
- assert(drawerDragStartBehavior != null),
- super(key: key);
+ }) : assert(primary != null), super(key: key);
/// An app bar to display at the top of the scaffold.
final PreferredSizeWidget appBar;
@@ -869,9 +865,6 @@
/// [AppBar.primary], is true.
final bool primary;
- /// {@macro flutter.material.drawer.dragStartBehavior}
- final DragStartBehavior drawerDragStartBehavior;
-
/// The state from the closest instance of this class that encloses the given context.
///
/// Typical usage is as follows:
@@ -1507,7 +1500,6 @@
alignment: DrawerAlignment.end,
child: widget.endDrawer,
drawerCallback: _endDrawerOpenedCallback,
- dragStartBehavior: widget.drawerDragStartBehavior,
),
_ScaffoldSlot.endDrawer,
// remove the side padding from the side we're not touching
@@ -1529,7 +1521,6 @@
alignment: DrawerAlignment.start,
child: widget.drawer,
drawerCallback: _drawerOpenedCallback,
- dragStartBehavior: widget.drawerDragStartBehavior,
),
_ScaffoldSlot.drawer,
// remove the side padding from the side we're not touching
diff --git a/packages/flutter/lib/src/material/switch.dart b/packages/flutter/lib/src/material/switch.dart
index 183d286..6bc832c 100644
--- a/packages/flutter/lib/src/material/switch.dart
+++ b/packages/flutter/lib/src/material/switch.dart
@@ -73,9 +73,7 @@
this.activeThumbImage,
this.inactiveThumbImage,
this.materialTapTargetSize,
- this.dragStartBehavior = DragStartBehavior.start,
}) : _switchType = _SwitchType.material,
- assert(dragStartBehavior != null),
super(key: key);
/// Creates a [CupertinoSwitch] if the target platform is iOS, creates a
@@ -97,7 +95,6 @@
this.activeThumbImage,
this.inactiveThumbImage,
this.materialTapTargetSize,
- this.dragStartBehavior = DragStartBehavior.start,
}) : _switchType = _SwitchType.adaptive,
super(key: key);
@@ -177,9 +174,6 @@
final _SwitchType _switchType;
- /// {@macro flutter.cupertino.switch.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
@override
_SwitchState createState() => _SwitchState();
@@ -225,7 +219,6 @@
}
return _SwitchRenderObjectWidget(
- dragStartBehavior: widget.dragStartBehavior,
value: widget.value,
activeColor: activeThumbColor,
inactiveColor: inactiveThumbColor,
@@ -247,7 +240,6 @@
height: size.height,
alignment: Alignment.center,
child: CupertinoSwitch(
- dragStartBehavior: widget.dragStartBehavior,
value: widget.value,
onChanged: widget.onChanged,
activeColor: widget.activeColor,
@@ -292,7 +284,6 @@
this.onChanged,
this.vsync,
this.additionalConstraints,
- this.dragStartBehavior,
}) : super(key: key);
final bool value;
@@ -306,12 +297,10 @@
final ValueChanged<bool> onChanged;
final TickerProvider vsync;
final BoxConstraints additionalConstraints;
- final DragStartBehavior dragStartBehavior;
@override
_RenderSwitch createRenderObject(BuildContext context) {
return _RenderSwitch(
- dragStartBehavior: dragStartBehavior,
value: value,
activeColor: activeColor,
inactiveColor: inactiveColor,
@@ -341,7 +330,6 @@
..onChanged = onChanged
..textDirection = Directionality.of(context)
..additionalConstraints = additionalConstraints
- ..dragStartBehavior = dragStartBehavior
..vsync = vsync;
}
}
@@ -360,7 +348,6 @@
@required TextDirection textDirection,
ValueChanged<bool> onChanged,
@required TickerProvider vsync,
- DragStartBehavior dragStartBehavior,
}) : assert(textDirection != null),
_activeThumbImage = activeThumbImage,
_inactiveThumbImage = inactiveThumbImage,
@@ -380,8 +367,7 @@
_drag = HorizontalDragGestureRecognizer()
..onStart = _handleDragStart
..onUpdate = _handleDragUpdate
- ..onEnd = _handleDragEnd
- ..dragStartBehavior = dragStartBehavior;
+ ..onEnd = _handleDragEnd;
}
ImageProvider get activeThumbImage => _activeThumbImage;
@@ -442,14 +428,6 @@
markNeedsPaint();
}
- DragStartBehavior get dragStartBehavior => _drag.dragStartBehavior;
- set dragStartBehavior(DragStartBehavior value) {
- assert(value != null);
- if(_drag.dragStartBehavior == value)
- return;
- _drag.dragStartBehavior = value;
- }
-
@override
void detach() {
_cachedThumbPainter?.dispose();
diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart
index 7940579..f83130e 100644
--- a/packages/flutter/lib/src/material/tabs.dart
+++ b/packages/flutter/lib/src/material/tabs.dart
@@ -7,7 +7,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'app_bar.dart';
import 'colors.dart';
@@ -550,11 +549,9 @@
this.labelPadding,
this.unselectedLabelColor,
this.unselectedLabelStyle,
- this.dragStartBehavior = DragStartBehavior.start,
this.onTap,
}) : assert(tabs != null),
assert(isScrollable != null),
- assert(dragStartBehavior != null),
assert(indicator != null || (indicatorWeight != null && indicatorWeight > 0.0)),
assert(indicator != null || (indicatorPadding != null)),
super(key: key);
@@ -665,9 +662,6 @@
/// is null then the text style of the theme's body2 definition is used.
final TextStyle unselectedLabelStyle;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
/// An optional callback that's called when the [TabBar] is tapped.
///
/// The callback is applied to the index of the tab where the tap occurred.
@@ -1017,7 +1011,6 @@
if (widget.isScrollable) {
_scrollController ??= _TabBarScrollController(this);
tabBar = SingleChildScrollView(
- dragStartBehavior: widget.dragStartBehavior,
scrollDirection: Axis.horizontal,
controller: _scrollController,
child: tabBar,
@@ -1042,10 +1035,7 @@
@required this.children,
this.controller,
this.physics,
- this.dragStartBehavior = DragStartBehavior.start,
- }) : assert(children != null),
- assert(dragStartBehavior != null),
- super(key: key);
+ }) : assert(children != null), super(key: key);
/// This widget's selection and animation state.
///
@@ -1067,9 +1057,6 @@
/// Defaults to matching platform conventions.
final ScrollPhysics physics;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
@override
_TabBarViewState createState() => _TabBarViewState();
}
@@ -1214,7 +1201,6 @@
return NotificationListener<ScrollNotification>(
onNotification: _handleScrollNotification,
child: PageView(
- dragStartBehavior: widget.dragStartBehavior,
controller: _pageController,
physics: widget.physics == null ? _kTabBarViewPhysics : _kTabBarViewPhysics.applyTo(widget.physics),
children: _children,
diff --git a/packages/flutter/lib/src/material/text_field.dart b/packages/flutter/lib/src/material/text_field.dart
index d5e374f..4ca47e4 100644
--- a/packages/flutter/lib/src/material/text_field.dart
+++ b/packages/flutter/lib/src/material/text_field.dart
@@ -8,7 +8,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart';
import 'debug.dart';
import 'feedback.dart';
@@ -128,7 +127,6 @@
this.cursorColor,
this.keyboardAppearance,
this.scrollPadding = const EdgeInsets.all(20.0),
- this.dragStartBehavior = DragStartBehavior.start,
this.enableInteractiveSelection,
this.onTap,
}) : assert(textAlign != null),
@@ -137,7 +135,6 @@
assert(autocorrect != null),
assert(maxLengthEnforced != null),
assert(scrollPadding != null),
- assert(dragStartBehavior != null),
assert(maxLines == null || maxLines > 0),
assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0),
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
@@ -349,9 +346,6 @@
/// {@macro flutter.widgets.editableText.enableInteractiveSelection}
final bool enableInteractiveSelection;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
/// {@macro flutter.rendering.editable.selectionEnabled}
bool get selectionEnabled {
return enableInteractiveSelection ?? !obscureText;
@@ -675,7 +669,6 @@
scrollPadding: widget.scrollPadding,
keyboardAppearance: keyboardAppearance,
enableInteractiveSelection: widget.enableInteractiveSelection,
- dragStartBehavior: widget.dragStartBehavior,
),
);
diff --git a/packages/flutter/lib/src/widgets/dismissible.dart b/packages/flutter/lib/src/widgets/dismissible.dart
index 98a94b7..f945da4 100644
--- a/packages/flutter/lib/src/widgets/dismissible.dart
+++ b/packages/flutter/lib/src/widgets/dismissible.dart
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import 'package:flutter/gestures.dart';
-
import 'automatic_keep_alive.dart';
import 'basic.dart';
import 'debug.dart';
@@ -84,10 +82,8 @@
this.dismissThresholds = const <DismissDirection, double>{},
this.movementDuration = const Duration(milliseconds: 200),
this.crossAxisEndOffset = 0.0,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(key != null),
assert(secondaryBackground != null ? background != null : true),
- assert(dragStartBehavior != null),
super(key: key);
/// The widget below this widget in the tree.
@@ -146,23 +142,6 @@
/// it is positive or negative.
final double crossAxisEndOffset;
- /// Determines the way that drag start behavior is handled.
- ///
- /// If set to [DragStartBehavior.start], the drag gesture used to dismiss a
- /// dismissible will begin upon the detection of a drag gesture. If set to
- /// [DragStartBehavior.down] it will begin when a down event is first detected.
- ///
- /// In general, setting this to [DragStartBehavior.start] will make drag
- /// 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].
- ///
- /// See also:
- ///
- /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
- final DragStartBehavior dragStartBehavior;
-
@override
_DismissibleState createState() => _DismissibleState();
}
@@ -348,8 +327,8 @@
Tween<Offset>(
begin: Offset.zero,
end: _directionIsXAxis
- ? Offset(end, widget.crossAxisEndOffset)
- : Offset(widget.crossAxisEndOffset, end),
+ ? Offset(end, widget.crossAxisEndOffset)
+ : Offset(widget.crossAxisEndOffset, end),
),
);
}
@@ -535,6 +514,7 @@
children.add(content);
content = Stack(children: children);
}
+
// We are not resizing but we may be being dragging in widget.direction.
return GestureDetector(
onHorizontalDragStart: _directionIsXAxis ? _handleDragStart : null,
@@ -544,8 +524,7 @@
onVerticalDragUpdate: _directionIsXAxis ? null : _handleDragUpdate,
onVerticalDragEnd: _directionIsXAxis ? null : _handleDragEnd,
behavior: HitTestBehavior.opaque,
- child: content,
- dragStartBehavior: widget.dragStartBehavior,
+ child: content
);
}
}
diff --git a/packages/flutter/lib/src/widgets/editable_text.dart b/packages/flutter/lib/src/widgets/editable_text.dart
index c8dc527..bd22473 100644
--- a/packages/flutter/lib/src/widgets/editable_text.dart
+++ b/packages/flutter/lib/src/widgets/editable_text.dart
@@ -8,7 +8,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'automatic_keep_alive.dart';
import 'basic.dart';
@@ -185,8 +184,7 @@
/// default to [TextInputType.multiline].
///
/// The [controller], [focusNode], [style], [cursorColor], [backgroundCursorColor],
- /// [textAlign], [dragStartBehavior] and [rendererIgnoresPointer] arguments
- /// must not be null.
+ /// [textAlign], and [rendererIgnoresPointer] arguments must not be null.
EditableText({
Key key,
@required this.controller,
@@ -217,7 +215,6 @@
this.cursorRadius,
this.scrollPadding = const EdgeInsets.all(20.0),
this.keyboardAppearance = Brightness.light,
- this.dragStartBehavior = DragStartBehavior.start,
this.enableInteractiveSelection,
}) : assert(controller != null),
assert(focusNode != null),
@@ -231,7 +228,6 @@
assert(autofocus != null),
assert(rendererIgnoresPointer != null),
assert(scrollPadding != null),
- assert(dragStartBehavior != null),
keyboardType = keyboardType ?? (maxLines == 1 ? TextInputType.text : TextInputType.multiline),
inputFormatters = maxLines == 1
? (
@@ -288,10 +284,6 @@
/// its left.
///
/// Defaults to the ambient [Directionality], if any.
- ///
- /// See also:
- ///
- /// * {@macro flutter.gestures.monodrag.dragStartExample}
/// {@endtemplate}
final TextDirection textDirection;
@@ -502,9 +494,6 @@
/// Defaults to false, resulting in a typical blinking cursor.
static bool debugDeterministicCursor = false;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
/// {@macro flutter.rendering.editable.selectionEnabled}
bool get selectionEnabled {
return enableInteractiveSelection ?? !obscureText;
@@ -851,7 +840,6 @@
renderObject: renderObject,
selectionControls: widget.selectionControls,
selectionDelegate: this,
- dragStartBehavior: widget.dragStartBehavior,
);
final bool longPress = cause == SelectionChangedCause.longPress;
if (cause != SelectionChangedCause.keyboard && (_value.text.isNotEmpty || longPress))
@@ -1073,7 +1061,6 @@
axisDirection: _isMultiline ? AxisDirection.down : AxisDirection.right,
controller: _scrollController,
physics: const ClampingScrollPhysics(),
- dragStartBehavior: widget.dragStartBehavior,
viewportBuilder: (BuildContext context, ViewportOffset offset) {
return CompositedTransformTarget(
link: _layerLink,
diff --git a/packages/flutter/lib/src/widgets/gesture_detector.dart b/packages/flutter/lib/src/widgets/gesture_detector.dart
index de41403..158d308 100644
--- a/packages/flutter/lib/src/widgets/gesture_detector.dart
+++ b/packages/flutter/lib/src/widgets/gesture_detector.dart
@@ -184,10 +184,8 @@
this.onScaleUpdate,
this.onScaleEnd,
this.behavior,
- this.excludeFromSemantics = false,
- this.dragStartBehavior = DragStartBehavior.start,
+ this.excludeFromSemantics = false
}) : assert(excludeFromSemantics != null),
- assert(dragStartBehavior != null),
assert(() {
final bool haveVerticalDrag = onVerticalDragStart != null || onVerticalDragUpdate != null || onVerticalDragEnd != null;
final bool haveHorizontalDrag = onHorizontalDragStart != null || onHorizontalDragUpdate != null || onHorizontalDragEnd != null;
@@ -372,23 +370,6 @@
/// duplication of information.
final bool excludeFromSemantics;
- /// Determines the way that drag start behavior is handled.
- ///
- /// If set to [DragStartBehavior.start], gesture drag behavior will
- /// begin upon the detection of a drag gesture. If set to
- /// [DragStartBehavior.down] it will begin when a down event is first detected.
- ///
- /// In general, setting this to [DragStartBehavior.start] will make drag
- /// 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].
- ///
- /// See also:
- ///
- /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
- final DragStartBehavior dragStartBehavior;
-
@override
Widget build(BuildContext context) {
final Map<Type, GestureRecognizerFactory> gestures = <Type, GestureRecognizerFactory>{};
@@ -440,8 +421,7 @@
..onStart = onVerticalDragStart
..onUpdate = onVerticalDragUpdate
..onEnd = onVerticalDragEnd
- ..onCancel = onVerticalDragCancel
- ..dragStartBehavior = dragStartBehavior;
+ ..onCancel = onVerticalDragCancel;
},
);
}
@@ -459,8 +439,7 @@
..onStart = onHorizontalDragStart
..onUpdate = onHorizontalDragUpdate
..onEnd = onHorizontalDragEnd
- ..onCancel = onHorizontalDragCancel
- ..dragStartBehavior = dragStartBehavior;
+ ..onCancel = onHorizontalDragCancel;
},
);
}
@@ -478,8 +457,7 @@
..onStart = onPanStart
..onUpdate = onPanUpdate
..onEnd = onPanEnd
- ..onCancel = onPanCancel
- ..dragStartBehavior = dragStartBehavior;
+ ..onCancel = onPanCancel;
},
);
}
@@ -519,11 +497,6 @@
child: child,
);
}
- @override
- void debugFillProperties(DiagnosticPropertiesBuilder properties) {
- super.debugFillProperties(properties);
- properties.add(EnumProperty<DragStartBehavior>('startBehavior', dragStartBehavior));
- }
}
/// A widget that detects gestures described by the given gesture
@@ -577,7 +550,7 @@
this.child,
this.gestures = const <Type, GestureRecognizerFactory>{},
this.behavior,
- this.excludeFromSemantics = false,
+ this.excludeFromSemantics = false
}) : assert(gestures != null),
assert(excludeFromSemantics != null),
super(key: key);
diff --git a/packages/flutter/lib/src/widgets/nested_scroll_view.dart b/packages/flutter/lib/src/widgets/nested_scroll_view.dart
index 4369334..8d41074 100644
--- a/packages/flutter/lib/src/widgets/nested_scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/nested_scroll_view.dart
@@ -10,7 +10,6 @@
import 'package:flutter/physics.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/scheduler.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'basic.dart';
import 'framework.dart';
@@ -52,7 +51,7 @@
/// in the opposite direction (e.g. allowing the user to swipe horizontally
/// between the pages represented by the tabs, while the list scrolls
/// vertically), then any list inside that [TabBarView] would not interact with
-/// the outer [ScrollView]. For example, flinginsg the inner list to scroll to
+/// the outer [ScrollView]. For example, flinging the inner list to scroll to
/// the top would not cause a collapsed [SliverAppBar] in the outer [ScrollView]
/// to expand.
///
@@ -189,7 +188,6 @@
this.physics,
@required this.headerSliverBuilder,
@required this.body,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(scrollDirection != null),
assert(reverse != null),
assert(headerSliverBuilder != null),
@@ -254,9 +252,6 @@
/// the [PrimaryScrollController] provided by the [NestedScrollView].
final Widget body;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
/// Returns the [SliverOverlapAbsorberHandle] of the nearest ancestor
/// [NestedScrollView].
///
@@ -343,7 +338,6 @@
builder: (BuildContext context) {
_lastHasScrolledBody = _coordinator.hasScrolledBody;
return _NestedScrollViewCustomScrollView(
- dragStartBehavior: widget.dragStartBehavior,
scrollDirection: widget.scrollDirection,
reverse: widget.reverse,
physics: widget.physics != null
@@ -371,14 +365,12 @@
@required ScrollController controller,
@required List<Widget> slivers,
@required this.handle,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : super(
scrollDirection: scrollDirection,
reverse: reverse,
physics: physics,
controller: controller,
slivers: slivers,
- dragStartBehavior: dragStartBehavior,
);
final SliverOverlapAbsorberHandle handle;
diff --git a/packages/flutter/lib/src/widgets/page_view.dart b/packages/flutter/lib/src/widgets/page_view.dart
index a46f22e..371cd58 100644
--- a/packages/flutter/lib/src/widgets/page_view.dart
+++ b/packages/flutter/lib/src/widgets/page_view.dart
@@ -7,7 +7,6 @@
import 'package:flutter/physics.dart';
import 'package:flutter/rendering.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'basic.dart';
import 'debug.dart';
@@ -424,7 +423,6 @@
this.pageSnapping = true,
this.onPageChanged,
List<Widget> children = const <Widget>[],
- this.dragStartBehavior = DragStartBehavior.start,
}) : controller = controller ?? _defaultPageController,
childrenDelegate = SliverChildListDelegate(children),
super(key: key);
@@ -451,7 +449,6 @@
this.onPageChanged,
@required IndexedWidgetBuilder itemBuilder,
int itemCount,
- this.dragStartBehavior = DragStartBehavior.start,
}) : controller = controller ?? _defaultPageController,
childrenDelegate = SliverChildBuilderDelegate(itemBuilder, childCount: itemCount),
super(key: key);
@@ -467,7 +464,6 @@
this.pageSnapping = true,
this.onPageChanged,
@required this.childrenDelegate,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(childrenDelegate != null),
controller = controller ?? _defaultPageController,
super(key: key);
@@ -520,9 +516,6 @@
/// respectively.
final SliverChildDelegate childrenDelegate;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
@override
_PageViewState createState() => _PageViewState();
}
@@ -569,7 +562,6 @@
return false;
},
child: Scrollable(
- dragStartBehavior: widget.dragStartBehavior,
axisDirection: axisDirection,
controller: widget.controller,
physics: physics,
diff --git a/packages/flutter/lib/src/widgets/scroll_view.dart b/packages/flutter/lib/src/widgets/scroll_view.dart
index 7e701a5..f4575e6 100644
--- a/packages/flutter/lib/src/widgets/scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/scroll_view.dart
@@ -5,7 +5,6 @@
import 'dart:math' as math;
import 'package:flutter/rendering.dart';
-import 'package:flutter/gestures.dart';
import 'basic.dart';
import 'framework.dart';
@@ -61,10 +60,8 @@
this.shrinkWrap = false,
this.cacheExtent,
this.semanticChildCount,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(reverse != null),
assert(shrinkWrap != null),
- assert(dragStartBehavior != null),
assert(!(controller != null && primary == true),
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.'
@@ -190,9 +187,6 @@
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
final int semanticChildCount;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
/// Returns the [AxisDirection] in which the scroll view scrolls.
///
/// Combines the [scrollDirection] with the [reverse] boolean to obtain the
@@ -252,7 +246,6 @@
? PrimaryScrollController.of(context)
: controller;
final Scrollable scrollable = Scrollable(
- dragStartBehavior: dragStartBehavior,
axisDirection: axisDirection,
controller: scrollController,
physics: physics,
@@ -404,7 +397,6 @@
double cacheExtent,
this.slivers = const <Widget>[],
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : super(
key: key,
scrollDirection: scrollDirection,
@@ -415,7 +407,6 @@
shrinkWrap: shrinkWrap,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount,
- dragStartBehavior: dragStartBehavior,
);
/// The slivers to place inside the viewport.
@@ -448,7 +439,6 @@
this.padding,
double cacheExtent,
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : super(
key: key,
scrollDirection: scrollDirection,
@@ -459,7 +449,6 @@
shrinkWrap: shrinkWrap,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount,
- dragStartBehavior: dragStartBehavior,
);
/// The amount of space by which to inset the children.
@@ -750,7 +739,6 @@
double cacheExtent,
List<Widget> children = const <Widget>[],
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : childrenDelegate = SliverChildListDelegate(
children,
addAutomaticKeepAlives: addAutomaticKeepAlives,
@@ -767,7 +755,6 @@
padding: padding,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount ?? children.length,
- dragStartBehavior: dragStartBehavior,
);
/// Creates a scrollable, linear array of widgets that are created on demand.
@@ -813,7 +800,6 @@
bool addSemanticIndexes = true,
double cacheExtent,
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : childrenDelegate = SliverChildBuilderDelegate(
itemBuilder,
childCount: itemCount,
@@ -831,7 +817,6 @@
padding: padding,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount ?? itemCount,
- dragStartBehavior: dragStartBehavior,
);
/// Creates a fixed-length scrollable linear array of list "items" separated
@@ -1265,7 +1250,6 @@
@required this.childrenDelegate,
double cacheExtent,
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : assert(gridDelegate != null),
assert(childrenDelegate != null),
super(
@@ -1279,7 +1263,6 @@
padding: padding,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount,
- dragStartBehavior: dragStartBehavior,
);
/// Creates a scrollable, 2D array of widgets with a fixed number of tiles in
@@ -1315,7 +1298,6 @@
double cacheExtent,
List<Widget> children = const <Widget>[],
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : gridDelegate = SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: crossAxisCount,
mainAxisSpacing: mainAxisSpacing,
@@ -1338,7 +1320,6 @@
padding: padding,
cacheExtent: cacheExtent,
semanticChildCount: semanticChildCount ?? children.length,
- dragStartBehavior: dragStartBehavior,
);
/// Creates a scrollable, 2D array of widgets with tiles that each have a
@@ -1373,7 +1354,6 @@
bool addSemanticIndexes = true,
List<Widget> children = const <Widget>[],
int semanticChildCount,
- DragStartBehavior dragStartBehavior = DragStartBehavior.start,
}) : gridDelegate = SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: maxCrossAxisExtent,
mainAxisSpacing: mainAxisSpacing,
@@ -1395,7 +1375,6 @@
shrinkWrap: shrinkWrap,
padding: padding,
semanticChildCount: semanticChildCount ?? children.length,
- dragStartBehavior: dragStartBehavior,
);
/// A delegate that controls the layout of the children within the [GridView].
diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart
index 42b91a9..d6768c0 100644
--- a/packages/flutter/lib/src/widgets/scrollable.dart
+++ b/packages/flutter/lib/src/widgets/scrollable.dart
@@ -81,9 +81,7 @@
@required this.viewportBuilder,
this.excludeFromSemantics = false,
this.semanticChildCount,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(axisDirection != null),
- assert(dragStartBehavior != null),
assert(viewportBuilder != null),
assert(excludeFromSemantics != null),
super (key: key);
@@ -182,25 +180,6 @@
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
final int semanticChildCount;
- /// {@template flutter.widgets.scrollable.dragStartBehavior}
- /// Determines the way that drag start behavior is handled.
- ///
- /// If set to [DragStartBehavior.start], scrolling drag behavior will
- /// begin upon the detection of a drag gesture. If set to
- /// [DragStartBehavior.down] it will begin when a down event is first detected.
- ///
- /// In general, setting this to [DragStartBehavior.start] will make drag
- /// 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].
- ///
- /// See also:
- ///
- /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
- /// {@endtemplate}
- final DragStartBehavior dragStartBehavior;
-
/// The axis along which the scroll view scrolls.
///
/// Determined by the [axisDirection].
@@ -412,8 +391,7 @@
..onCancel = _handleDragCancel
..minFlingDistance = _physics?.minFlingDistance
..minFlingVelocity = _physics?.minFlingVelocity
- ..maxFlingVelocity = _physics?.maxFlingVelocity
- ..dragStartBehavior = widget.dragStartBehavior;
+ ..maxFlingVelocity = _physics?.maxFlingVelocity;
},
),
};
@@ -431,8 +409,7 @@
..onCancel = _handleDragCancel
..minFlingDistance = _physics?.minFlingDistance
..minFlingVelocity = _physics?.minFlingVelocity
- ..maxFlingVelocity = _physics?.maxFlingVelocity
- ..dragStartBehavior = widget.dragStartBehavior;
+ ..maxFlingVelocity = _physics?.maxFlingVelocity;
},
),
};
diff --git a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
index dbd0399..2520283 100644
--- a/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
+++ b/packages/flutter/lib/src/widgets/single_child_scroll_view.dart
@@ -5,7 +5,6 @@
import 'dart:math' as math;
import 'package:flutter/rendering.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'basic.dart';
import 'framework.dart';
@@ -193,9 +192,7 @@
this.physics,
this.controller,
this.child,
- this.dragStartBehavior = DragStartBehavior.start,
}) : assert(scrollDirection != null),
- assert(dragStartBehavior != null),
assert(!(controller != null && primary == true),
'Primary ScrollViews obtain their ScrollController via inheritance from a PrimaryScrollController widget. '
'You cannot both set primary to true and pass an explicit controller.'
@@ -262,9 +259,6 @@
/// {@macro flutter.widgets.child}
final Widget child;
- /// {@macro flutter.widgets.scrollable.dragStartBehavior}
- final DragStartBehavior dragStartBehavior;
-
AxisDirection _getDirection(BuildContext context) {
return getAxisDirectionFromAxisReverseAndDirectionality(context, scrollDirection, reverse);
}
@@ -279,7 +273,6 @@
? PrimaryScrollController.of(context)
: controller;
final Scrollable scrollable = Scrollable(
- dragStartBehavior: dragStartBehavior,
axisDirection: axisDirection,
controller: scrollController,
physics: physics,
diff --git a/packages/flutter/lib/src/widgets/text_selection.dart b/packages/flutter/lib/src/widgets/text_selection.dart
index 5d8110e..7af804f 100644
--- a/packages/flutter/lib/src/widgets/text_selection.dart
+++ b/packages/flutter/lib/src/widgets/text_selection.dart
@@ -8,7 +8,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter/scheduler.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'basic.dart';
import 'container.dart';
@@ -230,7 +229,6 @@
@required this.renderObject,
this.selectionControls,
this.selectionDelegate,
- this.dragStartBehavior = DragStartBehavior.start,
}): assert(value != null),
assert(context != null),
_value = value {
@@ -265,23 +263,6 @@
/// text field.
final TextSelectionDelegate selectionDelegate;
- /// Determines the way that drag start behavior is handled.
- ///
- /// If set to [DragStartBehavior.start], handle drag behavior will
- /// begin upon the detection of a drag gesture. If set to
- /// [DragStartBehavior.down] it will begin when a down event is first detected.
- ///
- /// In general, setting this to [DragStartBehavior.start] will make drag
- /// 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].
- ///
- /// See also:
- ///
- /// * [DragGestureRecognizer.dragStartBehavior], which gives an example for the different behaviors.
- final DragStartBehavior dragStartBehavior;
-
/// Controls the fade-in animations.
static const Duration _fadeDuration = Duration(milliseconds: 150);
AnimationController _handleController;
@@ -384,8 +365,9 @@
Widget _buildHandle(BuildContext context, _TextSelectionHandlePosition position) {
if ((_selection.isCollapsed && position == _TextSelectionHandlePosition.end) ||
- selectionControls == null)
+ selectionControls == null)
return Container(); // hide the second handle when collapsed
+
return FadeTransition(
opacity: _handleOpacity,
child: _TextSelectionHandleOverlay(
@@ -396,7 +378,6 @@
selection: _selection,
selectionControls: selectionControls,
position: position,
- dragStartBehavior: dragStartBehavior,
)
);
}
@@ -466,8 +447,7 @@
@required this.renderObject,
@required this.onSelectionHandleChanged,
@required this.onSelectionHandleTapped,
- @required this.selectionControls,
- this.dragStartBehavior = DragStartBehavior.start,
+ @required this.selectionControls
}) : super(key: key);
final TextSelection selection;
@@ -477,7 +457,6 @@
final ValueChanged<TextSelection> onSelectionHandleChanged;
final VoidCallback onSelectionHandleTapped;
final TextSelectionControls selectionControls;
- final DragStartBehavior dragStartBehavior;
@override
_TextSelectionHandleOverlayState createState() => _TextSelectionHandleOverlayState();
@@ -549,7 +528,6 @@
link: widget.layerLink,
showWhenUnlinked: false,
child: GestureDetector(
- dragStartBehavior: widget.dragStartBehavior,
onPanStart: _handleDragStart,
onPanUpdate: _handleDragUpdate,
onTap: _handleTap,
diff --git a/packages/flutter/test/cupertino/switch_test.dart b/packages/flutter/test/cupertino/switch_test.dart
index 08f4a78..c08ea4a 100644
--- a/packages/flutter/test/cupertino/switch_test.dart
+++ b/packages/flutter/test/cupertino/switch_test.dart
@@ -4,7 +4,6 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart';
void main() {
testWidgets('Switch can toggle on tap', (WidgetTester tester) async {
@@ -19,7 +18,6 @@
child: CupertinoSwitch(
key: switchKey,
value: value,
- dragStartBehavior: DragStartBehavior.down,
onChanged: (bool newValue) {
setState(() {
value = newValue;
@@ -48,7 +46,6 @@
return Center(
child: CupertinoSwitch(
value: value,
- dragStartBehavior: DragStartBehavior.down,
onChanged: (bool newValue) {
setState(() {
value = newValue;
@@ -82,88 +79,6 @@
expect(value, isFalse);
});
- testWidgets('Switch can drag with dragStartBehavior', (WidgetTester tester) async {
- bool value = false;
-
- await tester.pumpWidget(
- Directionality(
- textDirection: TextDirection.ltr,
- child: StatefulBuilder(
- builder: (BuildContext context, StateSetter setState) {
- return Center(
- child: CupertinoSwitch(
- value: value,
- dragStartBehavior: DragStartBehavior.down,
- onChanged: (bool newValue) {
- setState(() {
- value = newValue;
- });
- },
- ),
- );
- },
- ),
- ),
- );
-
- expect(value, isFalse);
- await tester.drag(find.byType(CupertinoSwitch), const Offset(-30.0, 0.0));
- expect(value, isFalse);
-
- await tester.drag(find.byType(CupertinoSwitch), const Offset(30.0, 0.0));
- expect(value, isTrue);
- await tester.pump();
- await tester.drag(find.byType(CupertinoSwitch), const Offset(30.0, 0.0));
- expect(value, isTrue);
- await tester.pump();
- await tester.drag(find.byType(CupertinoSwitch), const Offset(-30.0, 0.0));
- expect(value, isFalse);
-
- await tester.pumpWidget(
- Directionality(
- textDirection: TextDirection.ltr,
- child: StatefulBuilder(
- builder: (BuildContext context, StateSetter setState) {
- return Center(
- child: CupertinoSwitch(
- value: value,
- dragStartBehavior: DragStartBehavior.start,
- onChanged: (bool newValue) {
- setState(() {
- value = newValue;
- });
- },
- ),
- );
- },
- ),
- ),
- );
- await tester.pumpAndSettle();
- final Rect switchRect = tester.getRect(find.byType(CupertinoSwitch));
-
- TestGesture gesture = await tester.startGesture(switchRect.center);
- // We have to execute the drag in two frames because the first update will
- // just set the start position.
- await gesture.moveBy(const Offset(20.0, 0.0));
- await gesture.moveBy(const Offset(20.0, 0.0));
- expect(value, isTrue);
- await gesture.up();
- await tester.pump();
-
- gesture = await tester.startGesture(switchRect.center);
- await gesture.moveBy(const Offset(20.0, 0.0));
- await gesture.moveBy(const Offset(20.0, 0.0));
- expect(value, isTrue);
- await gesture.up();
- await tester.pump();
-
- gesture = await tester.startGesture(switchRect.center);
- await gesture.moveBy(const Offset(-20.0, 0.0));
- await gesture.moveBy(const Offset(-20.0, 0.0));
- expect(value, isFalse);
- });
-
testWidgets('Switch can drag (RTL)', (WidgetTester tester) async {
bool value = false;
@@ -175,7 +90,6 @@
return Center(
child: CupertinoSwitch(
value: value,
- dragStartBehavior: DragStartBehavior.down,
onChanged: (bool newValue) {
setState(() {
value = newValue;
diff --git a/packages/flutter/test/gestures/drag_test.dart b/packages/flutter/test/gestures/drag_test.dart
index 8349c0b..4d99466 100644
--- a/packages/flutter/test/gestures/drag_test.dart
+++ b/packages/flutter/test/gestures/drag_test.dart
@@ -58,7 +58,8 @@
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);
+ expect(updatedScrollDelta, const Offset(10.0, 20.0));
+ updatedScrollDelta = null;
expect(didEndPan, isFalse);
expect(didTap, isFalse);
@@ -81,7 +82,7 @@
});
testGesture('Should recognize drag', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
bool didStartDrag = false;
drag.onStart = (_) {
@@ -134,7 +135,7 @@
});
testGesture('Should report original timestamps', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
Duration startTimestamp;
drag.onStart = (DragStartDetails details) {
@@ -164,98 +165,9 @@
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);
- });
-
- testGesture('Should report initial down point to onStart with a down configuration', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag =
- HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
- final VerticalDragGestureRecognizer competingDrag = VerticalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
-
- Offset positionAtOnStart;
- drag.onStart = (DragStartDetails details) {
- positionAtOnStart = details.globalPosition;
- };
- Offset updateOffset;
- Offset updateDelta;
- drag.onUpdate = (DragUpdateDetails details) {
- updateOffset = details.globalPosition;
- updateDelta = details.delta;
- };
-
- 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(10.0, 10.0));
-
- // The drag is horizontal so we're going to ignore the vertical delta position
- // when calculating the new global position.
- expect(updateOffset, const Offset(30.0, 10.0));
- expect(updateDelta, const Offset(20.0, 0.0));
- });
-
- testGesture('Drag with multiple pointers in down behavior', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag1 =
- HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
- final VerticalDragGestureRecognizer drag2 =
- VerticalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ testGesture('Drag with multiple pointers', (GestureTester tester) {
+ final HorizontalDragGestureRecognizer drag1 = HorizontalDragGestureRecognizer();
+ final VerticalDragGestureRecognizer drag2 = VerticalDragGestureRecognizer();
final List<String> log = <String>[];
drag1.onDown = (_) { log.add('drag1-down'); };
@@ -323,7 +235,7 @@
});
testGesture('Clamp max velocity', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
Velocity velocity;
double primaryVelocity;
@@ -357,7 +269,7 @@
});
testGesture('Synthesized pointer events are ignored for velocity tracking', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
Velocity velocity;
drag.onEnd = (DragEndDetails details) {
@@ -391,7 +303,7 @@
/// Checks that quick flick gestures with 1 down, 2 move and 1 up pointer
/// events still have a velocity
testGesture('Quick flicks have velocity', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
Velocity velocity;
drag.onEnd = (DragEndDetails details) {
@@ -421,18 +333,16 @@
});
testGesture('Should recognize drag', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
bool didStartDrag = false;
drag.onStart = (_) {
didStartDrag = true;
};
- Offset updateDelta;
- double updatePrimaryDelta;
+ double updatedDelta;
drag.onUpdate = (DragUpdateDetails details) {
- updateDelta = details.delta;
- updatePrimaryDelta = details.primaryDelta;
+ updatedDelta = details.primaryDelta;
};
bool didEndDrag = false;
@@ -444,39 +354,31 @@
final PointerDownEvent down = pointer.down(const Offset(10.0, 10.0));
drag.addPointer(down);
tester.closeArena(5);
-
expect(didStartDrag, isFalse);
- expect(updateDelta, isNull);
- expect(updatePrimaryDelta, isNull);
+ expect(updatedDelta, isNull);
expect(didEndDrag, isFalse);
tester.route(down);
expect(didStartDrag, isTrue);
- expect(updateDelta, isNull);
- expect(updatePrimaryDelta, isNull);
+ expect(updatedDelta, isNull);
expect(didEndDrag, isFalse);
+
+ tester.route(pointer.move(const Offset(20.0, 25.0)));
+ expect(didStartDrag, isTrue);
didStartDrag = false;
+ expect(updatedDelta, 10.0);
+ updatedDelta = null;
+ expect(didEndDrag, isFalse);
tester.route(pointer.move(const Offset(20.0, 25.0)));
expect(didStartDrag, isFalse);
- expect(updateDelta, const Offset(10.0, 0.0));
- expect(updatePrimaryDelta, 10.0);
+ expect(updatedDelta, 0.0);
+ updatedDelta = null;
expect(didEndDrag, isFalse);
- updateDelta = null;
- updatePrimaryDelta = null;
-
- tester.route(pointer.move(const Offset(20.0, 25.0)));
- expect(didStartDrag, isFalse);
- expect(updateDelta, const Offset(0.0, 0.0));
- expect(updatePrimaryDelta, 0.0);
- expect(didEndDrag, isFalse);
- updateDelta = null;
- updatePrimaryDelta = null;
tester.route(pointer.up());
expect(didStartDrag, isFalse);
- expect(updateDelta, isNull);
- expect(updatePrimaryDelta, isNull);
+ expect(updatedDelta, isNull);
expect(didEndDrag, isTrue);
didEndDrag = false;
@@ -484,36 +386,21 @@
});
testGesture('Should recognize drag', (GestureTester tester) {
- final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer() ..dragStartBehavior = DragStartBehavior.down;
+ final HorizontalDragGestureRecognizer drag = HorizontalDragGestureRecognizer();
- Offset latestGlobalPosition;
- drag.onStart = (DragStartDetails details) {
- latestGlobalPosition = details.globalPosition;
- };
- Offset latestDelta;
+ Offset newGlobalPosition;
drag.onUpdate = (DragUpdateDetails details) {
- latestGlobalPosition = details.globalPosition;
- latestDelta = details.delta;
+ newGlobalPosition = details.globalPosition;
};
final TestPointer pointer = TestPointer(5);
final PointerDownEvent down = pointer.down(const Offset(10.0, 10.0));
drag.addPointer(down);
- tester.closeArena(5);
-
- tester.route(down);
- expect(latestGlobalPosition, const Offset(10.0, 10.0));
- expect(latestDelta, isNull);
-
tester.route(pointer.move(const Offset(20.0, 25.0)));
- expect(latestGlobalPosition, const Offset(20.0, 25.0));
- expect(latestDelta, const Offset(10.0, 0.0));
-
- tester.route(pointer.move(const Offset(0.0, 45.0)));
- expect(latestGlobalPosition, const Offset(0.0, 45.0));
- expect(latestDelta, const Offset(-20.0, 0.0));
-
+ tester.closeArena(5);
+ tester.route(down);
+ expect(newGlobalPosition, const Offset(20.0, 10.0));
tester.route(pointer.up());
drag.dispose();
});
-}
\ No newline at end of file
+}
diff --git a/packages/flutter/test/material/date_picker_test.dart b/packages/flutter/test/material/date_picker_test.dart
index a5fa105..ca5f19b 100644
--- a/packages/flutter/test/material/date_picker_test.dart
+++ b/packages/flutter/test/material/date_picker_test.dart
@@ -8,7 +8,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../widgets/semantics_tester.dart';
import 'feedback_tester.dart';
@@ -47,10 +46,8 @@
return Container(
width: 400.0,
child: SingleChildScrollView(
- dragStartBehavior: DragStartBehavior.down,
child: Material(
child: MonthPicker(
- dragStartBehavior: DragStartBehavior.down,
firstDate: DateTime(0),
lastDate: DateTime(9999),
key: _datePickerKey,
@@ -66,7 +63,7 @@
);
},
),
- ),
+ )
);
expect(_selectedDate, equals(DateTime(2016, DateTime.july, 26)));
diff --git a/packages/flutter/test/material/ink_well_test.dart b/packages/flutter/test/material/ink_well_test.dart
index e89d1ba..0ae9410 100644
--- a/packages/flutter/test/material/ink_well_test.dart
+++ b/packages/flutter/test/material/ink_well_test.dart
@@ -5,7 +5,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart';
import '../rendering/mock_canvas.dart';
import '../widgets/semantics_tester.dart';
@@ -165,7 +164,6 @@
link: LayerLink(),
child: ListView(
addAutomaticKeepAlives: keepAlive,
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(height: 500.0, child: InkWell(onTap: () { }, child: const Placeholder())),
Container(height: 500.0),
diff --git a/packages/flutter/test/material/paginated_data_table_test.dart b/packages/flutter/test/material/paginated_data_table_test.dart
index c1d833e..9221a6b 100644
--- a/packages/flutter/test/material/paginated_data_table_test.dart
+++ b/packages/flutter/test/material/paginated_data_table_test.dart
@@ -4,7 +4,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'data_table_test_utils.dart';
@@ -249,29 +248,26 @@
testWidgets('PaginatedDataTable footer scrolls', (WidgetTester tester) async {
final TestDataSource source = TestDataSource();
- await tester.pumpWidget(
- MaterialApp(
- home: Align(
- alignment: Alignment.topLeft,
- child: SizedBox(
- width: 100.0,
- child: PaginatedDataTable(
- header: const Text('HEADER'),
- source: source,
- rowsPerPage: 5,
- dragStartBehavior: DragStartBehavior.down,
- availableRowsPerPage: const <int>[ 5 ],
- onRowsPerPageChanged: (int rowsPerPage) { },
- columns: const <DataColumn>[
- DataColumn(label: Text('COL1')),
- DataColumn(label: Text('COL2')),
- DataColumn(label: Text('COL3')),
- ],
- ),
+ await tester.pumpWidget(MaterialApp(
+ home: Align(
+ alignment: Alignment.topLeft,
+ child: SizedBox(
+ width: 100.0,
+ child: PaginatedDataTable(
+ header: const Text('HEADER'),
+ source: source,
+ rowsPerPage: 5,
+ availableRowsPerPage: const <int>[ 5 ],
+ onRowsPerPageChanged: (int rowsPerPage) { },
+ columns: const <DataColumn>[
+ DataColumn(label: Text('COL1')),
+ DataColumn(label: Text('COL2')),
+ DataColumn(label: Text('COL3')),
+ ],
),
),
),
- );
+ ));
expect(find.text('Rows per page:'), findsOneWidget);
expect(tester.getTopLeft(find.text('Rows per page:')).dx, lessThan(0.0)); // off screen
await tester.dragFrom(
diff --git a/packages/flutter/test/material/scaffold_test.dart b/packages/flutter/test/material/scaffold_test.dart
index d104601..f8d87d3 100644
--- a/packages/flutter/test/material/scaffold_test.dart
+++ b/packages/flutter/test/material/scaffold_test.dart
@@ -6,7 +6,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../widgets/semantics_tester.dart';
@@ -202,7 +201,6 @@
drawer: Drawer(
key: drawerKey,
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
controller: scrollOffset,
children: List<Widget>.generate(10,
(int index) => SizedBox(height: 100.0, child: Text('D$index'))
@@ -632,7 +630,6 @@
viewInsets: EdgeInsets.only(bottom: 200.0),
),
child: Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
appBar: PreferredSize(
preferredSize: const Size(11.0, 13.0),
child: Container(
diff --git a/packages/flutter/test/material/switch_test.dart b/packages/flutter/test/material/switch_test.dart
index 84b8beb..59a7c5f 100644
--- a/packages/flutter/test/material/switch_test.dart
+++ b/packages/flutter/test/material/switch_test.dart
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart';
import '../rendering/mock_canvas.dart';
import '../widgets/semantics_tester.dart';
@@ -25,7 +25,6 @@
return Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
key: switchKey,
value: value,
onChanged: (bool newValue) {
@@ -55,7 +54,6 @@
child: Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: true,
onChanged: (bool newValue) {},
),
@@ -75,7 +73,6 @@
child: Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: true,
onChanged: (bool newValue) {},
),
@@ -99,7 +96,6 @@
return Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: value,
onChanged: (bool newValue) {
setState(() {
@@ -135,93 +131,6 @@
expect(value, isFalse);
});
- testWidgets('Switch can drag with dragStartBehavior', (WidgetTester tester) async {
- bool value = false;
-
- await tester.pumpWidget(
- Directionality(
- textDirection: TextDirection.ltr,
- child: StatefulBuilder(
- builder: (BuildContext context, StateSetter setState) {
- return Material(
- child: Center(
- child: Switch(
- dragStartBehavior: DragStartBehavior.down,
- value: value,
- onChanged: (bool newValue) {
- setState(() {
- value = newValue;
- }
- );
- }
- ),
- ),
- );
- },
- ),
- ),
- );
-
- expect(value, isFalse);
- await tester.drag(find.byType(Switch), const Offset(-30.0, 0.0));
- expect(value, isFalse);
-
- await tester.drag(find.byType(Switch), const Offset(30.0, 0.0));
- expect(value, isTrue);
- await tester.pump();
- await tester.drag(find.byType(Switch), const Offset(30.0, 0.0));
- expect(value, isTrue);
- await tester.pump();
- await tester.drag(find.byType(Switch), const Offset(-30.0, 0.0));
- expect(value, isFalse);
-
- await tester.pumpWidget(
- Directionality(
- textDirection: TextDirection.ltr,
- child: StatefulBuilder(
- builder: (BuildContext context, StateSetter setState) {
- return Material(
- child: Center(
- child: Switch(
- dragStartBehavior: DragStartBehavior.start,
- value: value,
- onChanged: (bool newValue) {
- setState(() {
- value = newValue;
- });
- }
- ),
- ),
- );
- },
- ),
- ),
- );
- await tester.pumpAndSettle();
- final Rect switchRect = tester.getRect(find.byType(Switch));
-
- TestGesture gesture = await tester.startGesture(switchRect.center);
- // We have to execute the drag in two frames because the first update will
- // just set the start position.
- await gesture.moveBy(const Offset(20.0, 0.0));
- await gesture.moveBy(const Offset(20.0, 0.0));
- expect(value, isTrue);
- await gesture.up();
- await tester.pump();
-
- gesture = await tester.startGesture(switchRect.center);
- await gesture.moveBy(const Offset(20.0, 0.0));
- await gesture.moveBy(const Offset(20.0, 0.0));
- expect(value, isTrue);
- await gesture.up();
- await tester.pump();
-
- gesture = await tester.startGesture(switchRect.center);
- await gesture.moveBy(const Offset(-20.0, 0.0));
- await gesture.moveBy(const Offset(-20.0, 0.0));
- expect(value, isFalse);
- });
-
testWidgets('Switch can drag (RTL)', (WidgetTester tester) async {
bool value = false;
@@ -233,7 +142,6 @@
return Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: value,
onChanged: (bool newValue) {
setState(() {
@@ -277,7 +185,6 @@
return Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: value,
onChanged: (bool newValue) {
setState(() {
@@ -399,7 +306,6 @@
return Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: value,
onChanged: (bool newValue) {
setState(() {
@@ -459,7 +365,6 @@
return Material(
child: Center(
child: Switch(
- dragStartBehavior: DragStartBehavior.down,
value: value,
onChanged: (bool newValue) {
setState(() {
diff --git a/packages/flutter/test/material/text_field_test.dart b/packages/flutter/test/material/text_field_test.dart
index 59b90ca..3e1327b 100644
--- a/packages/flutter/test/material/text_field_test.dart
+++ b/packages/flutter/test/material/text_field_test.dart
@@ -12,7 +12,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../widgets/semantics_tester.dart';
import 'feedback_tester.dart';
@@ -502,12 +501,9 @@
final TextEditingController controller = TextEditingController();
await tester.pumpWidget(
- MaterialApp(
- home: Material(
- child: TextField(
- dragStartBehavior: DragStartBehavior.down,
- controller: controller,
- ),
+ overlay(
+ child: TextField(
+ controller: controller,
),
),
);
@@ -546,7 +542,7 @@
await tester.pump();
expect(controller.selection.baseOffset, selection.baseOffset);
- expect(controller.selection.extentOffset, selection.extentOffset);
+ expect(controller.selection.extentOffset, selection.extentOffset+2);
// Drag the left handle 2 letters to the left.
handlePos = endpoints[0].point + const Offset(-1.0, 1.0);
@@ -558,8 +554,8 @@
await gesture.up();
await tester.pump();
- expect(controller.selection.baseOffset, selection.baseOffset);
- expect(controller.selection.extentOffset, selection.extentOffset);
+ expect(controller.selection.baseOffset, selection.baseOffset-2);
+ expect(controller.selection.extentOffset, selection.extentOffset+2);
});
testWidgets('Can use selection toolbar', (WidgetTester tester) async {
@@ -830,7 +826,6 @@
await tester.pumpWidget(
overlay(
child: TextField(
- dragStartBehavior: DragStartBehavior.down,
controller: controller,
style: const TextStyle(color: Colors.black, fontSize: 34.0),
maxLines: 3,
@@ -914,7 +909,6 @@
await tester.pumpWidget(
overlay(
child: TextField(
- dragStartBehavior: DragStartBehavior.down,
key: textFieldKey,
controller: controller,
style: const TextStyle(color: Colors.black, fontSize: 34.0),
diff --git a/packages/flutter/test/widgets/automatic_keep_alive_test.dart b/packages/flutter/test/widgets/automatic_keep_alive_test.dart
index 68bfe86..404e633 100644
--- a/packages/flutter/test/widgets/automatic_keep_alive_test.dart
+++ b/packages/flutter/test/widgets/automatic_keep_alive_test.dart
@@ -5,7 +5,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
class Leaf extends StatefulWidget {
const Leaf({ Key key, this.child }) : super(key: key);
@@ -477,7 +476,6 @@
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: ListView.builder(
- dragStartBehavior: DragStartBehavior.down,
addSemanticIndexes: false,
itemCount: 50,
itemBuilder: (BuildContext context, int index){
diff --git a/packages/flutter/test/widgets/dismissible_test.dart b/packages/flutter/test/widgets/dismissible_test.dart
index 9623121..420fdcc 100644
--- a/packages/flutter/test/widgets/dismissible_test.dart
+++ b/packages/flutter/test/widgets/dismissible_test.dart
@@ -5,7 +5,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
const double itemExtent = 100.0;
Axis scrollDirection = Axis.vertical;
@@ -22,7 +21,6 @@
builder: (BuildContext context, StateSetter setState) {
Widget buildDismissibleItem(int item) {
return Dismissible(
- dragStartBehavior: DragStartBehavior.down,
key: ValueKey<int>(item),
direction: dismissDirection,
onDismissed: (DismissDirection direction) {
@@ -51,7 +49,6 @@
return Container(
padding: const EdgeInsets.all(10.0),
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
scrollDirection: scrollDirection,
itemExtent: itemExtent,
children: <int>[0, 1, 2, 3, 4]
@@ -202,7 +199,6 @@
@override
Widget build(BuildContext context) {
return Dismissible(
- dragStartBehavior: DragStartBehavior.down,
key: ObjectKey(text),
child: AspectRatio(
aspectRatio: 1.0,
diff --git a/packages/flutter/test/widgets/draggable_test.dart b/packages/flutter/test/widgets/draggable_test.dart
index ef8e964..97941fc 100644
--- a/packages/flutter/test/widgets/draggable_test.dart
+++ b/packages/flutter/test/widgets/draggable_test.dart
@@ -383,7 +383,6 @@
await tester.pumpWidget(MaterialApp(
home: ListView(
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
DragTarget<int>(
builder: (BuildContext context, List<int> data, List<dynamic> rejects) {
@@ -490,7 +489,6 @@
await tester.pumpWidget(MaterialApp(
home: ListView(
- dragStartBehavior: DragStartBehavior.down,
scrollDirection: Axis.horizontal,
children: <Widget>[
DragTarget<int>(
diff --git a/packages/flutter/test/widgets/drawer_test.dart b/packages/flutter/test/widgets/drawer_test.dart
index 5dc9a7f..30868b0 100644
--- a/packages/flutter/test/widgets/drawer_test.dart
+++ b/packages/flutter/test/widgets/drawer_test.dart
@@ -9,7 +9,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'semantics_tester.dart';
@@ -83,7 +82,6 @@
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
key: scaffoldKey,
drawer: Drawer(
child: ListView(
@@ -136,7 +134,6 @@
home: Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
key: scaffoldKey,
drawer: Drawer(
child: ListView(
diff --git a/packages/flutter/test/widgets/gesture_detector_test.dart b/packages/flutter/test/widgets/gesture_detector_test.dart
index 922126b..f7acb45 100644
--- a/packages/flutter/test/widgets/gesture_detector_test.dart
+++ b/packages/flutter/test/widgets/gesture_detector_test.dart
@@ -64,7 +64,6 @@
const Offset upLocation = Offset(10.0, 50.0); // must be far enough to be more than kTouchSlop
final Widget widget = GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onVerticalDragUpdate: (DragUpdateDetails details) { dragDistance += details.primaryDelta; },
onVerticalDragEnd: (DragEndDetails details) { gestureCount += 1; },
onHorizontalDragUpdate: (DragUpdateDetails details) { fail('gesture should not match'); },
diff --git a/packages/flutter/test/widgets/grid_view_test.dart b/packages/flutter/test/widgets/grid_view_test.dart
index 3938ac1..38b4786 100644
--- a/packages/flutter/test/widgets/grid_view_test.dart
+++ b/packages/flutter/test/widgets/grid_view_test.dart
@@ -4,7 +4,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../rendering/mock_canvas.dart';
import 'states.dart';
@@ -15,7 +14,6 @@
Directionality(
textDirection: TextDirection.ltr,
child: GridView.count(
- dragStartBehavior: DragStartBehavior.down,
crossAxisCount: 4,
children: const <Widget>[],
),
@@ -30,11 +28,9 @@
Directionality(
textDirection: TextDirection.ltr,
child: GridView.count(
- dragStartBehavior: DragStartBehavior.down,
crossAxisCount: 4,
children: kStates.map<Widget>((String state) {
return GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
log.add(state);
},
@@ -103,11 +99,9 @@
Directionality(
textDirection: TextDirection.ltr,
child: GridView.extent(
- dragStartBehavior: DragStartBehavior.down,
maxCrossAxisExtent: 200.0,
children: kStates.map<Widget>((String state) {
return GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
log.add(state);
},
diff --git a/packages/flutter/test/widgets/heroes_test.dart b/packages/flutter/test/widgets/heroes_test.dart
index 23e6460..e33291b 100644
--- a/packages/flutter/test/widgets/heroes_test.dart
+++ b/packages/flutter/test/widgets/heroes_test.dart
@@ -1373,11 +1373,8 @@
expect(find.byKey(secondKey), isOnstage);
expect(find.byKey(secondKey), isInCard);
- final TestGesture gesture = await tester.startGesture(const Offset(5.0, 200.0));
- await gesture.moveBy(const Offset(20.0, 0.0));
- await gesture.moveBy(const Offset(180.0, 0.0));
- await gesture.up();
- await tester.pump();
+ final TestGesture gesture = await tester.startGesture(const Offset(5.0, 200.0));
+ await gesture.moveBy(const Offset(200.0, 0.0));
await tester.pump();
diff --git a/packages/flutter/test/widgets/listview_end_append_test.dart b/packages/flutter/test/widgets/listview_end_append_test.dart
index e09969e..0f9f1f4 100644
--- a/packages/flutter/test/widgets/listview_end_append_test.dart
+++ b/packages/flutter/test/widgets/listview_end_append_test.dart
@@ -4,7 +4,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
void main() {
testWidgets('ListView.builder() fixed itemExtent, scroll to end, append, scroll', (WidgetTester tester) async {
@@ -14,7 +13,6 @@
return Directionality(
textDirection: TextDirection.ltr,
child: ListView.builder(
- dragStartBehavior: DragStartBehavior.down,
itemExtent: 200.0,
itemCount: itemCount,
itemBuilder: (BuildContext context, int index) => Text('item $index'),
@@ -42,7 +40,6 @@
return Directionality(
textDirection: TextDirection.ltr,
child: ListView.builder(
- dragStartBehavior: DragStartBehavior.down,
itemCount: itemCount,
itemBuilder: (BuildContext context, int index) {
return SizedBox(
diff --git a/packages/flutter/test/widgets/nested_scroll_view_test.dart b/packages/flutter/test/widgets/nested_scroll_view_test.dart
index 354126d..b52360b 100644
--- a/packages/flutter/test/widgets/nested_scroll_view_test.dart
+++ b/packages/flutter/test/widgets/nested_scroll_view_test.dart
@@ -5,7 +5,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import '../rendering/mock_canvas.dart';
@@ -35,11 +34,9 @@
child: MediaQuery(
data: const MediaQueryData(),
child: Scaffold(
- drawerDragStartBehavior: DragStartBehavior.down,
body: DefaultTabController(
length: 4,
child: NestedScrollView(
- dragStartBehavior: DragStartBehavior.down,
controller: controller,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
@@ -82,7 +79,6 @@
],
),
ListView(
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(
height: 100.0,
@@ -94,7 +90,6 @@
child: const Center(child: Text('ccc1')),
),
ListView(
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(
height: 10000.0,
@@ -366,7 +361,6 @@
DefaultTabController(
length: _tabs.length, // This is the number of tabs.
child: NestedScrollView(
- dragStartBehavior: DragStartBehavior.down,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
buildCount += 1; // THIS LINE IS NOT IN THE ORIGINAL -- ADDED FOR TEST
// These are the slivers that show up in the "outer" scroll view.
@@ -396,14 +390,12 @@
bottom: TabBar(
// These are the widgets to put in each tab in the tab bar.
tabs: _tabs.map<Widget>((String name) => Tab(text: name)).toList(),
- dragStartBehavior: DragStartBehavior.down,
),
),
),
];
},
body: TabBarView(
- dragStartBehavior: DragStartBehavior.down,
// These are the contents of the tab views, below the tabs.
children: _tabs.map<Widget>((String name) {
return SafeArea(
@@ -424,7 +416,6 @@
// it allows the list to remember its scroll position when
// the tab view is not on the screen.
key: PageStorageKey<String>(name),
- dragStartBehavior: DragStartBehavior.down,
slivers: <Widget>[
SliverOverlapInjector(
// This is the flip side of the SliverOverlapAbsorber above.
@@ -599,7 +590,6 @@
child: DefaultTabController(
length: 1,
child: NestedScrollView(
- dragStartBehavior: DragStartBehavior.down,
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
const SliverPersistentHeader(
@@ -608,7 +598,6 @@
];
},
body: SingleChildScrollView(
- dragStartBehavior: DragStartBehavior.down,
child: Container(
height: 1000.0,
child: const Placeholder(key: key2),
diff --git a/packages/flutter/test/widgets/page_view_test.dart b/packages/flutter/test/widgets/page_view_test.dart
index 4c858ad..c8ecdbe 100644
--- a/packages/flutter/test/widgets/page_view_test.dart
+++ b/packages/flutter/test/widgets/page_view_test.dart
@@ -6,7 +6,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'semantics_tester.dart';
import 'states.dart';
@@ -20,10 +19,8 @@
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: PageView(
- dragStartBehavior: DragStartBehavior.down,
children: kStates.map<Widget>((String state) {
return GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
log.add(state);
},
diff --git a/packages/flutter/test/widgets/scroll_notification_test.dart b/packages/flutter/test/widgets/scroll_notification_test.dart
index b4cdcec..0fbadfa 100644
--- a/packages/flutter/test/widgets/scroll_notification_test.dart
+++ b/packages/flutter/test/widgets/scroll_notification_test.dart
@@ -60,7 +60,6 @@
return false;
},
child: SingleChildScrollView(
- dragStartBehavior: DragStartBehavior.down,
child: SizedBox(
height: 1200.0,
child: NotificationListener<ScrollNotification>(
@@ -71,14 +70,11 @@
},
child: Container(
padding: const EdgeInsets.all(50.0),
- child: const SingleChildScrollView(
- child: SizedBox(height: 1200.0),
- dragStartBehavior: DragStartBehavior.down,
- ),
- ),
- ),
- ),
- ),
+ child: const SingleChildScrollView(child: SizedBox(height: 1200.0))
+ )
+ )
+ )
+ )
));
final TestGesture gesture = await tester.startGesture(const Offset(100.0, 100.0));
diff --git a/packages/flutter/test/widgets/scroll_view_test.dart b/packages/flutter/test/widgets/scroll_view_test.dart
index 3fcd382..15e161d 100644
--- a/packages/flutter/test/widgets/scroll_view_test.dart
+++ b/packages/flutter/test/widgets/scroll_view_test.dart
@@ -4,7 +4,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'package:flutter/material.dart';
import 'states.dart';
@@ -17,7 +16,6 @@
Directionality(
textDirection: TextDirection.ltr,
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
children: kStates.map<Widget>((String state) {
return GestureDetector(
onTap: () {
@@ -28,7 +26,6 @@
color: const Color(0xFF0000FF),
child: Text(state),
),
- dragStartBehavior: DragStartBehavior.down,
);
}).toList(),
),
@@ -57,7 +54,6 @@
return Directionality(
textDirection: TextDirection.ltr,
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
children: kStates.take(n).map<Widget>((String state) {
return Container(
height: 200.0,
@@ -89,13 +85,11 @@
Directionality(
textDirection: TextDirection.ltr,
child: CustomScrollView(
- dragStartBehavior: DragStartBehavior.down,
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate(
kStates.map<Widget>((String state) {
return GestureDetector(
- dragStartBehavior: DragStartBehavior.down,
onTap: () {
log.add(state);
},
diff --git a/packages/flutter/test/widgets/scrollable_fling_test.dart b/packages/flutter/test/widgets/scrollable_fling_test.dart
index 68b8ba6..2dd30a0 100644
--- a/packages/flutter/test/widgets/scrollable_fling_test.dart
+++ b/packages/flutter/test/widgets/scrollable_fling_test.dart
@@ -4,7 +4,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
const TextStyle testFont = TextStyle(
color: Color(0xFF00FF00),
@@ -20,7 +19,6 @@
home: Container(
color: const Color(0xFF111111),
child: ListView.builder(
- dragStartBehavior: DragStartBehavior.down,
itemBuilder: (BuildContext context, int index) {
return Text('$index', style: testFont);
},
@@ -66,7 +64,7 @@
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
- child: ListView(children: textWidgets, dragStartBehavior: DragStartBehavior.down)
+ child: ListView(children: textWidgets)
),
);
@@ -94,7 +92,7 @@
await tester.pumpWidget(
Directionality(
textDirection: TextDirection.ltr,
- child: ListView(children: textWidgets, dragStartBehavior: DragStartBehavior.down)
+ child: ListView(children: textWidgets)
),
);
diff --git a/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart b/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart
index 2f7f0bf..c06da6d 100644
--- a/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart
+++ b/packages/flutter/test/widgets/scrollable_list_hit_testing_test.dart
@@ -5,7 +5,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
const List<int> items = <int>[0, 1, 2, 3, 4, 5];
@@ -19,7 +18,6 @@
child: Container(
height: 50.0,
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
itemExtent: 290.0,
scrollDirection: Axis.horizontal,
children: items.map<Widget>((int item) {
@@ -27,7 +25,6 @@
child: GestureDetector(
onTap: () { tapped.add(item); },
child: Text('$item'),
- dragStartBehavior: DragStartBehavior.down,
),
);
}).toList(),
@@ -63,7 +60,6 @@
child: Container(
width: 50.0,
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
itemExtent: 290.0,
scrollDirection: Axis.vertical,
children: items.map<Widget>((int item) {
@@ -71,7 +67,6 @@
child: GestureDetector(
onTap: () { tapped.add(item); },
child: Text('$item'),
- dragStartBehavior: DragStartBehavior.down,
),
);
}).toList(),
diff --git a/packages/flutter/test/widgets/scrollable_semantics_test.dart b/packages/flutter/test/widgets/scrollable_semantics_test.dart
index 986eb6b..2dcf7e6 100644
--- a/packages/flutter/test/widgets/scrollable_semantics_test.dart
+++ b/packages/flutter/test/widgets/scrollable_semantics_test.dart
@@ -8,7 +8,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
import 'semantics_tester.dart';
@@ -267,7 +266,6 @@
await tester.pumpWidget(Directionality(
textDirection: TextDirection.ltr,
child: ListView.builder(
- dragStartBehavior: DragStartBehavior.down,
itemExtent: 20.0,
itemBuilder: (BuildContext context, int index) {
return Text('entry $index');
diff --git a/packages/flutter/test/widgets/widget_inspector_test.dart b/packages/flutter/test/widgets/widget_inspector_test.dart
index bfefa12..8b77bb2 100644
--- a/packages/flutter/test/widgets/widget_inspector_test.dart
+++ b/packages/flutter/test/widgets/widget_inspector_test.dart
@@ -12,7 +12,6 @@
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart';
-import 'package:flutter/gestures.dart' show DragStartBehavior;
// Start of block of code where widget creation location line numbers and
// columns will impact whether tests pass.
@@ -397,7 +396,6 @@
key: inspectorKey,
selectButtonBuilder: selectButtonBuilder,
child: ListView(
- dragStartBehavior: DragStartBehavior.down,
children: <Widget>[
Container(
key: childKey,
@@ -1511,7 +1509,7 @@
_CreationLocation location = knownLocations[id];
expect(location.file, equals(file));
// ClockText widget.
- expect(location.line, equals(50));
+ expect(location.line, equals(49));
expect(location.column, equals(9));
expect(count, equals(1));
@@ -1520,7 +1518,7 @@
location = knownLocations[id];
expect(location.file, equals(file));
// Text widget in _ClockTextState build method.
- expect(location.line, equals(88));
+ expect(location.line, equals(87));
expect(location.column, equals(12));
expect(count, equals(1));
@@ -1545,7 +1543,7 @@
location = knownLocations[id];
expect(location.file, equals(file));
// ClockText widget.
- expect(location.line, equals(50));
+ expect(location.line, equals(49));
expect(location.column, equals(9));
expect(count, equals(3)); // 3 clock widget instances rebuilt.
@@ -1554,7 +1552,7 @@
location = knownLocations[id];
expect(location.file, equals(file));
// Text widget in _ClockTextState build method.
- expect(location.line, equals(88));
+ expect(location.line, equals(87));
expect(location.column, equals(12));
expect(count, equals(3)); // 3 clock widget instances rebuilt.