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
1cb6b8bb
Unverified
Commit
1cb6b8bb
authored
Jul 22, 2019
by
chunhtai
Committed by
GitHub
Jul 22, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes iphone force press keybaord select crashes (#36698)
parent
542fbd4c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
2 deletions
+49
-2
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+5
-2
editable_text_cursor_test.dart
packages/flutter/test/widgets/editable_text_cursor_test.dart
+44
-0
No files found.
packages/flutter/lib/src/widgets/editable_text.dart
View file @
1cb6b8bb
...
...
@@ -1145,8 +1145,11 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
}
break
;
case
FloatingCursorDragState
.
End
:
// We skip animation if no update has happened.
if
(
_lastTextPosition
!=
null
&&
_lastBoundedOffset
!=
null
)
{
_floatingCursorResetController
.
value
=
0.0
;
_floatingCursorResetController
.
animateTo
(
1.0
,
duration:
_floatingCursorResetTime
,
curve:
Curves
.
decelerate
);
}
break
;
}
}
...
...
packages/flutter/test/widgets/editable_text_cursor_test.dart
View file @
1cb6b8bb
...
...
@@ -509,6 +509,50 @@ void main() {
expect
(
controller
.
selection
.
baseOffset
,
10
);
},
skip:
isBrowser
);
testWidgets
(
'Updating the floating cursor can end without update'
,
(
WidgetTester
tester
)
async
{
const
String
text
=
'hello world this is fun and cool and awesome!'
;
controller
.
text
=
text
;
final
FocusNode
focusNode
=
FocusNode
();
await
tester
.
pumpWidget
(
MediaQuery
(
data:
const
MediaQueryData
(
devicePixelRatio:
1
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
FocusScope
(
node:
focusScopeNode
,
autofocus:
true
,
child:
EditableText
(
backgroundCursorColor:
Colors
.
grey
,
controller:
controller
,
focusNode:
focusNode
,
style:
textStyle
,
cursorColor:
cursorColor
,
),
),
),
),
);
await
tester
.
tap
(
find
.
byType
(
EditableText
));
final
RenderEditable
renderEditable
=
findRenderEditable
(
tester
);
renderEditable
.
selection
=
const
TextSelection
(
baseOffset:
29
,
extentOffset:
29
);
expect
(
controller
.
selection
.
baseOffset
,
29
);
final
EditableTextState
editableTextState
=
tester
.
firstState
(
find
.
byType
(
EditableText
));
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
Start
));
expect
(
controller
.
selection
.
baseOffset
,
29
);
editableTextState
.
updateFloatingCursor
(
RawFloatingCursorPoint
(
state:
FloatingCursorDragState
.
End
));
await
tester
.
pumpAndSettle
();
// The cursor did not change.
expect
(
controller
.
selection
.
baseOffset
,
29
);
expect
(
tester
.
takeException
(),
null
);
},
skip:
isBrowser
);
// Regression test for https://github.com/flutter/flutter/pull/30475.
testWidgets
(
'Trying to select with the floating cursor does not crash'
,
(
WidgetTester
tester
)
async
{
const
String
text
=
'hello world this is fun and cool and awesome!'
;
...
...
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