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
2b7e9897
Unverified
Commit
2b7e9897
authored
Apr 05, 2019
by
chunhtai
Committed by
GitHub
Apr 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue 21640: Assertion Error : '_listenerAttached': is not true (#30513)
parent
32f1b810
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
editable.dart
packages/flutter/lib/src/rendering/editable.dart
+2
-3
editable_test.dart
packages/flutter/test/rendering/editable_test.dart
+21
-0
No files found.
packages/flutter/lib/src/rendering/editable.dart
View file @
2b7e9897
...
@@ -196,7 +196,6 @@ class RenderEditable extends RenderBox {
...
@@ -196,7 +196,6 @@ class RenderEditable extends RenderBox {
_cursorColor
=
cursorColor
,
_cursorColor
=
cursorColor
,
_backgroundCursorColor
=
backgroundCursorColor
,
_backgroundCursorColor
=
backgroundCursorColor
,
_showCursor
=
showCursor
??
ValueNotifier
<
bool
>(
false
),
_showCursor
=
showCursor
??
ValueNotifier
<
bool
>(
false
),
_hasFocus
=
hasFocus
??
false
,
_maxLines
=
maxLines
,
_maxLines
=
maxLines
,
_minLines
=
minLines
,
_minLines
=
minLines
,
_expands
=
expands
,
_expands
=
expands
,
...
@@ -213,6 +212,7 @@ class RenderEditable extends RenderBox {
...
@@ -213,6 +212,7 @@ class RenderEditable extends RenderBox {
_obscureText
=
obscureText
{
_obscureText
=
obscureText
{
assert
(
_showCursor
!=
null
);
assert
(
_showCursor
!=
null
);
assert
(!
_showCursor
.
value
||
cursorColor
!=
null
);
assert
(!
_showCursor
.
value
||
cursorColor
!=
null
);
this
.
hasFocus
=
hasFocus
??
false
;
_tap
=
TapGestureRecognizer
(
debugOwner:
this
)
_tap
=
TapGestureRecognizer
(
debugOwner:
this
)
..
onTapDown
=
_handleTapDown
..
onTapDown
=
_handleTapDown
..
onTap
=
_handleTap
;
..
onTap
=
_handleTap
;
...
@@ -707,7 +707,7 @@ class RenderEditable extends RenderBox {
...
@@ -707,7 +707,7 @@ class RenderEditable extends RenderBox {
/// Whether the editable is currently focused.
/// Whether the editable is currently focused.
bool
get
hasFocus
=>
_hasFocus
;
bool
get
hasFocus
=>
_hasFocus
;
bool
_hasFocus
;
bool
_hasFocus
=
false
;
bool
_listenerAttached
=
false
;
bool
_listenerAttached
=
false
;
set
hasFocus
(
bool
value
)
{
set
hasFocus
(
bool
value
)
{
assert
(
value
!=
null
);
assert
(
value
!=
null
);
...
@@ -723,7 +723,6 @@ class RenderEditable extends RenderBox {
...
@@ -723,7 +723,6 @@ class RenderEditable extends RenderBox {
RawKeyboard
.
instance
.
removeListener
(
_handleKeyEvent
);
RawKeyboard
.
instance
.
removeListener
(
_handleKeyEvent
);
_listenerAttached
=
false
;
_listenerAttached
=
false
;
}
}
markNeedsSemanticsUpdate
();
markNeedsSemanticsUpdate
();
}
}
...
...
packages/flutter/test/rendering/editable_test.dart
View file @
2b7e9897
...
@@ -422,4 +422,25 @@ void main() {
...
@@ -422,4 +422,25 @@ void main() {
expect
(
updatedSelection
.
extentOffset
,
5
);
expect
(
updatedSelection
.
extentOffset
,
5
);
expect
(
selectionChangedCount
,
1
);
expect
(
selectionChangedCount
,
1
);
});
});
test
(
'editable hasFocus correctly initialized'
,
()
{
// Regression test for https://github.com/flutter/flutter/issues/21640
final
TextSelectionDelegate
delegate
=
FakeEditableTextState
();
final
RenderEditable
editable
=
RenderEditable
(
text:
const
TextSpan
(
style:
TextStyle
(
height:
1.0
,
fontSize:
10.0
,
fontFamily:
'Ahem'
),
text:
'12345'
,
),
textAlign:
TextAlign
.
start
,
textDirection:
TextDirection
.
ltr
,
locale:
const
Locale
(
'en'
,
'US'
),
offset:
ViewportOffset
.
zero
(),
textSelectionDelegate:
delegate
,
hasFocus:
true
,
);
expect
(
editable
.
hasFocus
,
true
);
editable
.
hasFocus
=
false
;
expect
(
editable
.
hasFocus
,
false
);
});
}
}
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