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
b94f757d
Unverified
Commit
b94f757d
authored
Jan 17, 2018
by
Hans Muller
Committed by
GitHub
Jan 17, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small simplification in RenderEditable (#14119)
parent
b0d5d2d9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
27 deletions
+5
-27
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+0
-1
editable.dart
packages/flutter/lib/src/rendering/editable.dart
+5
-26
No files found.
packages/flutter/lib/src/material/text_field.dart
View file @
b94f757d
...
...
@@ -389,7 +389,6 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
}
void
_handleTapCancel
()
{
_renderEditable
.
handleTapCancel
();
_cancelCurrentSplash
();
}
...
...
packages/flutter/lib/src/rendering/editable.dart
View file @
b94f757d
...
...
@@ -155,8 +155,7 @@ class RenderEditable extends RenderBox {
assert
(!
_showCursor
.
value
||
cursorColor
!=
null
);
_tap
=
new
TapGestureRecognizer
(
debugOwner:
this
)
..
onTapDown
=
_handleTapDown
..
onTap
=
_handleTap
..
onTapCancel
=
_handleTapCancel
;
..
onTap
=
_handleTap
;
_longPress
=
new
LongPressGestureRecognizer
(
debugOwner:
this
)
..
onLongPress
=
_handleLongPress
;
}
...
...
@@ -171,7 +170,7 @@ class RenderEditable extends RenderBox {
/// If true [handleEvent] does nothing and it's assumed that this
/// renderer will be notified of input gestures via [handleTapDown],
/// [handleTap],
[handleTapCancel],
and [handleLongPress].
/// [handleTap], and [handleLongPress].
///
/// The default value of this property is false.
bool
ignorePointer
;
...
...
@@ -569,7 +568,6 @@ class RenderEditable extends RenderBox {
}
Offset
_lastTapDownPosition
;
Offset
_longPressPosition
;
/// If [ignorePointer] is false (the default) then this method is called by
/// the internal gesture recognizer's [TapGestureRecognizer.onTapDown]
...
...
@@ -594,10 +592,8 @@ class RenderEditable extends RenderBox {
void
handleTap
()
{
_layoutText
(
constraints
.
maxWidth
);
assert
(
_lastTapDownPosition
!=
null
);
final
Offset
globalPosition
=
_lastTapDownPosition
;
_lastTapDownPosition
=
null
;
if
(
onSelectionChanged
!=
null
)
{
final
TextPosition
position
=
_textPainter
.
getPositionForOffset
(
globalToLocal
(
global
Position
));
final
TextPosition
position
=
_textPainter
.
getPositionForOffset
(
globalToLocal
(
_lastTapDown
Position
));
onSelectionChanged
(
new
TextSelection
.
fromPosition
(
position
),
this
,
SelectionChangedCause
.
tap
);
}
}
...
...
@@ -606,22 +602,6 @@ class RenderEditable extends RenderBox {
handleTap
();
}
/// If [ignorePointer] is false (the default) then this method is called by
/// the internal gesture recognizer's [TapGestureRecognizer.onTapCancel]
/// callback.
///
/// When [ignorePointer] is true, an ancestor widget must respond to tap
/// cancel events by calling this method.
void
handleTapCancel
()
{
// longPress arrives after tapCancel, so remember the tap position.
_longPressPosition
=
_lastTapDownPosition
;
_lastTapDownPosition
=
null
;
}
void
_handleTapCancel
()
{
assert
(!
ignorePointer
);
handleTapCancel
();
}
/// If [ignorePointer] is false (the default) then this method is called by
/// the internal gesture recognizer's [LongPressRecognizer.onLongPress]
/// callback.
...
...
@@ -630,10 +610,9 @@ class RenderEditable extends RenderBox {
/// press events by calling this method.
void
handleLongPress
()
{
_layoutText
(
constraints
.
maxWidth
);
final
Offset
globalPosition
=
_longPressPosition
;
_longPressPosition
=
null
;
assert
(
_lastTapDownPosition
!=
null
);
if
(
onSelectionChanged
!=
null
)
{
final
TextPosition
position
=
_textPainter
.
getPositionForOffset
(
globalToLocal
(
global
Position
));
final
TextPosition
position
=
_textPainter
.
getPositionForOffset
(
globalToLocal
(
_lastTapDown
Position
));
onSelectionChanged
(
_selectWordAtOffset
(
position
),
this
,
SelectionChangedCause
.
longPress
);
}
}
...
...
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