Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
4fe79442
Commit
4fe79442
authored
Jan 18, 2019
by
jslavitz
Committed by
Mehmet Fidanboylu
Jan 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reverts default DragStartBehavior to DragStartBehavior.down (#26734)
parent
563972ec
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
51 additions
and
92 deletions
+51
-92
switch.dart
packages/flutter/lib/src/cupertino/switch.dart
+5
-4
monodrag.dart
packages/flutter/lib/src/gestures/monodrag.dart
+1
-1
date_picker.dart
packages/flutter/lib/src/material/date_picker.dart
+5
-4
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+3
-2
paginated_data_table.dart
packages/flutter/lib/src/material/paginated_data_table.dart
+1
-1
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+1
-1
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+2
-2
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+1
-1
dismissible.dart
packages/flutter/lib/src/widgets/dismissible.dart
+3
-2
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+1
-1
gesture_detector.dart
packages/flutter/lib/src/widgets/gesture_detector.dart
+3
-2
nested_scroll_view.dart
packages/flutter/lib/src/widgets/nested_scroll_view.dart
+2
-2
page_view.dart
packages/flutter/lib/src/widgets/page_view.dart
+3
-3
scroll_view.dart
packages/flutter/lib/src/widgets/scroll_view.dart
+8
-8
scrollable.dart
packages/flutter/lib/src/widgets/scrollable.dart
+3
-2
single_child_scroll_view.dart
...ges/flutter/lib/src/widgets/single_child_scroll_view.dart
+1
-1
text_selection.dart
packages/flutter/lib/src/widgets/text_selection.dart
+4
-3
drag_test.dart
packages/flutter/test/gestures/drag_test.dart
+4
-52
No files found.
packages/flutter/lib/src/cupertino/switch.dart
View file @
4fe79442
...
...
@@ -59,7 +59,7 @@ class CupertinoSwitch extends StatefulWidget {
@required
this
.
value
,
@required
this
.
onChanged
,
this
.
activeColor
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
dragStartBehavior
!=
null
),
super
(
key:
key
);
...
...
@@ -96,6 +96,7 @@ class CupertinoSwitch extends StatefulWidget {
/// [CupertinoTheme] in accordance to native iOS behavior.
final
Color
activeColor
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// {@template flutter.cupertino.switch.dragStartBehavior}
/// Determines the way that drag start behavior is handled.
///
...
...
@@ -108,7 +109,7 @@ class CupertinoSwitch extends StatefulWidget {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// See also:
///
...
...
@@ -147,7 +148,7 @@ class _CupertinoSwitchRenderObjectWidget extends LeafRenderObjectWidget {
this
.
activeColor
,
this
.
onChanged
,
this
.
vsync
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
super
(
key:
key
);
final
bool
value
;
...
...
@@ -200,7 +201,7 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
ValueChanged
<
bool
>
onChanged
,
@required
TextDirection
textDirection
,
@required
TickerProvider
vsync
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
value
!=
null
),
assert
(
activeColor
!=
null
),
assert
(
vsync
!=
null
),
...
...
packages/flutter/lib/src/gestures/monodrag.dart
View file @
4fe79442
...
...
@@ -54,7 +54,7 @@ abstract class DragGestureRecognizer extends OneSequenceGestureRecognizer {
/// [dragStartBehavior] must not be null.
DragGestureRecognizer
({
Object
debugOwner
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
dragStartBehavior
!=
null
),
super
(
debugOwner:
debugOwner
);
...
...
packages/flutter/lib/src/material/date_picker.dart
View file @
4fe79442
...
...
@@ -251,7 +251,7 @@ class DayPicker extends StatelessWidget {
@required
this
.
lastDate
,
@required
this
.
displayedMonth
,
this
.
selectableDayPredicate
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
selectedDate
!=
null
),
assert
(
currentDate
!=
null
),
assert
(
onChanged
!=
null
),
...
...
@@ -284,6 +284,7 @@ class DayPicker extends StatelessWidget {
/// Optional user supplied predicate function to customize selectable days.
final
SelectableDayPredicate
selectableDayPredicate
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// Determines the way that drag start behavior is handled.
///
/// If set to [DragStartBehavior.start], the drag gesture used to scroll a
...
...
@@ -295,7 +296,7 @@ class DayPicker extends StatelessWidget {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// See also:
///
...
...
@@ -524,7 +525,7 @@ class MonthPicker extends StatefulWidget {
@required
this
.
firstDate
,
@required
this
.
lastDate
,
this
.
selectableDayPredicate
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
selectedDate
!=
null
),
assert
(
onChanged
!=
null
),
assert
(!
firstDate
.
isAfter
(
lastDate
)),
...
...
@@ -787,7 +788,7 @@ class YearPicker extends StatefulWidget {
@required
this
.
onChanged
,
@required
this
.
firstDate
,
@required
this
.
lastDate
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
selectedDate
!=
null
),
assert
(
onChanged
!=
null
),
assert
(!
firstDate
.
isAfter
(
lastDate
)),
...
...
packages/flutter/lib/src/material/drawer.dart
View file @
4fe79442
...
...
@@ -180,7 +180,7 @@ class DrawerController extends StatefulWidget {
@required
this
.
child
,
@required
this
.
alignment
,
this
.
drawerCallback
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
child
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(
alignment
!=
null
),
...
...
@@ -200,6 +200,7 @@ class DrawerController extends StatefulWidget {
/// Optional callback that is called when a [Drawer] is opened or closed.
final
DrawerCallback
drawerCallback
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// {@template flutter.material.drawer.dragStartBehavior}
/// Determines the way that drag start behavior is handled.
///
...
...
@@ -212,7 +213,7 @@ class DrawerController extends StatefulWidget {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// See also:
///
...
...
packages/flutter/lib/src/material/paginated_data_table.dart
View file @
4fe79442
...
...
@@ -75,7 +75,7 @@ class PaginatedDataTable extends StatefulWidget {
this
.
rowsPerPage
=
defaultRowsPerPage
,
this
.
availableRowsPerPage
=
const
<
int
>[
defaultRowsPerPage
,
defaultRowsPerPage
*
2
,
defaultRowsPerPage
*
5
,
defaultRowsPerPage
*
10
],
this
.
onRowsPerPageChanged
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
@required
this
.
source
})
:
assert
(
header
!=
null
),
assert
(
columns
!=
null
),
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
4fe79442
...
...
@@ -796,7 +796,7 @@ class Scaffold extends StatefulWidget {
this
.
resizeToAvoidBottomPadding
,
this
.
resizeToAvoidBottomInset
,
this
.
primary
=
true
,
this
.
drawerDragStartBehavior
=
DragStartBehavior
.
start
,
this
.
drawerDragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
primary
!=
null
),
assert
(
drawerDragStartBehavior
!=
null
),
super
(
key:
key
);
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
4fe79442
...
...
@@ -551,7 +551,7 @@ class TabBar extends StatefulWidget implements PreferredSizeWidget {
this
.
labelPadding
,
this
.
unselectedLabelColor
,
this
.
unselectedLabelStyle
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
this
.
onTap
,
})
:
assert
(
tabs
!=
null
),
assert
(
isScrollable
!=
null
),
...
...
@@ -1043,7 +1043,7 @@ class TabBarView extends StatefulWidget {
@required
this
.
children
,
this
.
controller
,
this
.
physics
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
children
!=
null
),
assert
(
dragStartBehavior
!=
null
),
super
(
key:
key
);
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
4fe79442
...
...
@@ -143,7 +143,7 @@ class TextField extends StatefulWidget {
this
.
cursorColor
,
this
.
keyboardAppearance
,
this
.
scrollPadding
=
const
EdgeInsets
.
all
(
20.0
),
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
this
.
enableInteractiveSelection
,
this
.
onTap
,
this
.
buildCounter
,
...
...
packages/flutter/lib/src/widgets/dismissible.dart
View file @
4fe79442
...
...
@@ -84,7 +84,7 @@ class Dismissible extends StatefulWidget {
this
.
dismissThresholds
=
const
<
DismissDirection
,
double
>{},
this
.
movementDuration
=
const
Duration
(
milliseconds:
200
),
this
.
crossAxisEndOffset
=
0.0
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
key
!=
null
),
assert
(
secondaryBackground
!=
null
?
background
!=
null
:
true
),
assert
(
dragStartBehavior
!=
null
),
...
...
@@ -146,6 +146,7 @@ class Dismissible extends StatefulWidget {
/// it is positive or negative.
final
double
crossAxisEndOffset
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// Determines the way that drag start behavior is handled.
///
/// If set to [DragStartBehavior.start], the drag gesture used to dismiss a
...
...
@@ -156,7 +157,7 @@ class Dismissible extends StatefulWidget {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// See also:
///
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
4fe79442
...
...
@@ -217,7 +217,7 @@ class EditableText extends StatefulWidget {
this
.
cursorRadius
,
this
.
scrollPadding
=
const
EdgeInsets
.
all
(
20.0
),
this
.
keyboardAppearance
=
Brightness
.
light
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
this
.
enableInteractiveSelection
,
})
:
assert
(
controller
!=
null
),
assert
(
focusNode
!=
null
),
...
...
packages/flutter/lib/src/widgets/gesture_detector.dart
View file @
4fe79442
...
...
@@ -186,7 +186,7 @@ class GestureDetector extends StatelessWidget {
this
.
onScaleEnd
,
this
.
behavior
,
this
.
excludeFromSemantics
=
false
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
excludeFromSemantics
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(()
{
...
...
@@ -373,6 +373,7 @@ class GestureDetector extends StatelessWidget {
/// duplication of information.
final
bool
excludeFromSemantics
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// Determines the way that drag start behavior is handled.
///
/// If set to [DragStartBehavior.start], gesture drag behavior will
...
...
@@ -383,7 +384,7 @@ class GestureDetector extends StatelessWidget {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// Only the [onStart] callbacks for the [VerticalDragGestureRecognizer],
/// [HorizontalDragGestureRecognizer] and [PanGestureRecognizer] are affected
...
...
packages/flutter/lib/src/widgets/nested_scroll_view.dart
View file @
4fe79442
...
...
@@ -189,7 +189,7 @@ class NestedScrollView extends StatefulWidget {
this
.
physics
,
@required
this
.
headerSliverBuilder
,
@required
this
.
body
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
scrollDirection
!=
null
),
assert
(
reverse
!=
null
),
assert
(
headerSliverBuilder
!=
null
),
...
...
@@ -371,7 +371,7 @@ class _NestedScrollViewCustomScrollView extends CustomScrollView {
@required
ScrollController
controller
,
@required
List
<
Widget
>
slivers
,
@required
this
.
handle
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
super
(
scrollDirection:
scrollDirection
,
reverse:
reverse
,
...
...
packages/flutter/lib/src/widgets/page_view.dart
View file @
4fe79442
...
...
@@ -424,7 +424,7 @@ class PageView extends StatefulWidget {
this
.
pageSnapping
=
true
,
this
.
onPageChanged
,
List
<
Widget
>
children
=
const
<
Widget
>[],
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
controller
=
controller
??
_defaultPageController
,
childrenDelegate
=
SliverChildListDelegate
(
children
),
super
(
key:
key
);
...
...
@@ -451,7 +451,7 @@ class PageView extends StatefulWidget {
this
.
onPageChanged
,
@required
IndexedWidgetBuilder
itemBuilder
,
int
itemCount
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
controller
=
controller
??
_defaultPageController
,
childrenDelegate
=
SliverChildBuilderDelegate
(
itemBuilder
,
childCount:
itemCount
),
super
(
key:
key
);
...
...
@@ -467,7 +467,7 @@ class PageView extends StatefulWidget {
this
.
pageSnapping
=
true
,
this
.
onPageChanged
,
@required
this
.
childrenDelegate
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
childrenDelegate
!=
null
),
controller
=
controller
??
_defaultPageController
,
super
(
key:
key
);
...
...
packages/flutter/lib/src/widgets/scroll_view.dart
View file @
4fe79442
...
...
@@ -61,7 +61,7 @@ abstract class ScrollView extends StatelessWidget {
this
.
shrinkWrap
=
false
,
this
.
cacheExtent
,
this
.
semanticChildCount
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
reverse
!=
null
),
assert
(
shrinkWrap
!=
null
),
assert
(
dragStartBehavior
!=
null
),
...
...
@@ -404,7 +404,7 @@ class CustomScrollView extends ScrollView {
double
cacheExtent
,
this
.
slivers
=
const
<
Widget
>[],
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
super
(
key:
key
,
scrollDirection:
scrollDirection
,
...
...
@@ -448,7 +448,7 @@ abstract class BoxScrollView extends ScrollView {
this
.
padding
,
double
cacheExtent
,
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
super
(
key:
key
,
scrollDirection:
scrollDirection
,
...
...
@@ -750,7 +750,7 @@ class ListView extends BoxScrollView {
double
cacheExtent
,
List
<
Widget
>
children
=
const
<
Widget
>[],
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
childrenDelegate
=
SliverChildListDelegate
(
children
,
addAutomaticKeepAlives:
addAutomaticKeepAlives
,
...
...
@@ -813,7 +813,7 @@ class ListView extends BoxScrollView {
bool
addSemanticIndexes
=
true
,
double
cacheExtent
,
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
childrenDelegate
=
SliverChildBuilderDelegate
(
itemBuilder
,
childCount:
itemCount
,
...
...
@@ -1265,7 +1265,7 @@ class GridView extends BoxScrollView {
@required
this
.
childrenDelegate
,
double
cacheExtent
,
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
gridDelegate
!=
null
),
assert
(
childrenDelegate
!=
null
),
super
(
...
...
@@ -1315,7 +1315,7 @@ class GridView extends BoxScrollView {
double
cacheExtent
,
List
<
Widget
>
children
=
const
<
Widget
>[],
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
gridDelegate
=
SliverGridDelegateWithFixedCrossAxisCount
(
crossAxisCount:
crossAxisCount
,
mainAxisSpacing:
mainAxisSpacing
,
...
...
@@ -1373,7 +1373,7 @@ class GridView extends BoxScrollView {
bool
addSemanticIndexes
=
true
,
List
<
Widget
>
children
=
const
<
Widget
>[],
int
semanticChildCount
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
start
,
DragStartBehavior
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
gridDelegate
=
SliverGridDelegateWithMaxCrossAxisExtent
(
maxCrossAxisExtent:
maxCrossAxisExtent
,
mainAxisSpacing:
mainAxisSpacing
,
...
...
packages/flutter/lib/src/widgets/scrollable.dart
View file @
4fe79442
...
...
@@ -81,7 +81,7 @@ class Scrollable extends StatefulWidget {
@required
this
.
viewportBuilder
,
this
.
excludeFromSemantics
=
false
,
this
.
semanticChildCount
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
axisDirection
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(
viewportBuilder
!=
null
),
...
...
@@ -182,6 +182,7 @@ class Scrollable extends StatefulWidget {
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
final
int
semanticChildCount
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// {@template flutter.widgets.scrollable.dragStartBehavior}
/// Determines the way that drag start behavior is handled.
///
...
...
@@ -193,7 +194,7 @@ class Scrollable extends StatefulWidget {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// See also:
///
...
...
packages/flutter/lib/src/widgets/single_child_scroll_view.dart
View file @
4fe79442
...
...
@@ -193,7 +193,7 @@ class SingleChildScrollView extends StatelessWidget {
this
.
physics
,
this
.
controller
,
this
.
child
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
assert
(
scrollDirection
!=
null
),
assert
(
dragStartBehavior
!=
null
),
assert
(!(
controller
!=
null
&&
primary
==
true
),
...
...
packages/flutter/lib/src/widgets/text_selection.dart
View file @
4fe79442
...
...
@@ -230,7 +230,7 @@ class TextSelectionOverlay {
@required
this
.
renderObject
,
this
.
selectionControls
,
this
.
selectionDelegate
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
}):
assert
(
value
!=
null
),
assert
(
context
!=
null
),
_value
=
value
{
...
...
@@ -265,6 +265,7 @@ class TextSelectionOverlay {
/// text field.
final
TextSelectionDelegate
selectionDelegate
;
// TODO(jslavitz): Set the DragStartBehavior default to be start across all widgets.
/// Determines the way that drag start behavior is handled.
///
/// If set to [DragStartBehavior.start], handle drag behavior will
...
...
@@ -275,7 +276,7 @@ class TextSelectionOverlay {
/// animation smoother and setting it to [DragStartBehavior.down] will make
/// drag behavior feel slightly more reactive.
///
/// By default, the drag start behavior is [DragStartBehavior.
start
].
/// By default, the drag start behavior is [DragStartBehavior.
down
].
///
/// See also:
///
...
...
@@ -467,7 +468,7 @@ class _TextSelectionHandleOverlay extends StatefulWidget {
@required
this
.
onSelectionHandleChanged
,
@required
this
.
onSelectionHandleTapped
,
@required
this
.
selectionControls
,
this
.
dragStartBehavior
=
DragStartBehavior
.
start
,
this
.
dragStartBehavior
=
DragStartBehavior
.
down
,
})
:
super
(
key:
key
);
final
TextSelection
selection
;
...
...
packages/flutter/test/gestures/drag_test.dart
View file @
4fe79442
...
...
@@ -58,7 +58,9 @@ void main() {
tester
.
route
(
pointer
.
move
(
const
Offset
(
20.0
,
30.0
)));
// moved 10 horizontally and 20 vertically which is 22 total
expect
(
didStartPan
,
isTrue
);
// 22 > 18
didStartPan
=
false
;
expect
(
updatedScrollDelta
,
null
);
// TODO(jslavitz): revert this testing change.
expect
(
updatedScrollDelta
,
const
Offset
(
10.0
,
20.0
));
updatedScrollDelta
=
null
;
expect
(
didEndPan
,
isFalse
);
expect
(
didTap
,
isFalse
);
...
...
@@ -164,57 +166,7 @@ void main() {
drag
.
dispose
();
});
testGesture
(
'Should report most recent point to onStart by default'
,
(
GestureTester
tester
)
{
final
HorizontalDragGestureRecognizer
drag
=
HorizontalDragGestureRecognizer
();
final
VerticalDragGestureRecognizer
competingDrag
=
VerticalDragGestureRecognizer
();
Offset
positionAtOnStart
;
drag
.
onStart
=
(
DragStartDetails
details
)
{
positionAtOnStart
=
details
.
globalPosition
;
};
final
TestPointer
pointer
=
TestPointer
(
5
);
final
PointerDownEvent
down
=
pointer
.
down
(
const
Offset
(
10.0
,
10.0
));
drag
.
addPointer
(
down
);
competingDrag
.
addPointer
(
down
);
tester
.
closeArena
(
5
);
tester
.
route
(
down
);
tester
.
route
(
pointer
.
move
(
const
Offset
(
30.0
,
0.0
)));
drag
.
dispose
();
competingDrag
.
dispose
();
expect
(
positionAtOnStart
,
const
Offset
(
30.0
,
00.0
));
});
testGesture
(
'Should report most recent point to onStart with a start configuration'
,
(
GestureTester
tester
)
{
final
HorizontalDragGestureRecognizer
drag
=
HorizontalDragGestureRecognizer
();
final
VerticalDragGestureRecognizer
competingDrag
=
VerticalDragGestureRecognizer
();
Offset
positionAtOnStart
;
drag
.
onStart
=
(
DragStartDetails
details
)
{
positionAtOnStart
=
details
.
globalPosition
;
};
Offset
updateOffset
;
drag
.
onUpdate
=
(
DragUpdateDetails
details
)
{
updateOffset
=
details
.
globalPosition
;
};
final
TestPointer
pointer
=
TestPointer
(
5
);
final
PointerDownEvent
down
=
pointer
.
down
(
const
Offset
(
10.0
,
10.0
));
drag
.
addPointer
(
down
);
competingDrag
.
addPointer
(
down
);
tester
.
closeArena
(
5
);
tester
.
route
(
down
);
tester
.
route
(
pointer
.
move
(
const
Offset
(
30.0
,
0.0
)));
drag
.
dispose
();
competingDrag
.
dispose
();
expect
(
positionAtOnStart
,
const
Offset
(
30.0
,
0.0
));
expect
(
updateOffset
,
null
);
});
// TODO(jslavitz): Revert these tests.
testGesture
(
'Should report initial down point to onStart with a down configuration'
,
(
GestureTester
tester
)
{
final
HorizontalDragGestureRecognizer
drag
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment