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
b4324aed
Unverified
Commit
b4324aed
authored
Sep 17, 2019
by
Michael Goderbauer
Committed by
GitHub
Sep 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Propagate textfield character limits to semantics (#40468)" (#40714)
This reverts commit
6ad88bd5
.
parent
6ad88bd5
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
15 additions
and
329 deletions
+15
-329
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+10
-21
custom_paint.dart
packages/flutter/lib/src/rendering/custom_paint.dart
+0
-6
proxy_box.dart
packages/flutter/lib/src/rendering/proxy_box.dart
+0
-32
semantics.dart
packages/flutter/lib/src/semantics/semantics.dart
+2
-132
basic.dart
packages/flutter/lib/src/widgets/basic.dart
+0
-8
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+0
-62
semantics_test.dart
packages/flutter/test/semantics/semantics_test.dart
+0
-4
semantics_debugger_test.dart
packages/flutter/test/widgets/semantics_debugger_test.dart
+2
-13
semantics_tester.dart
packages/flutter/test/widgets/semantics_tester.dart
+1
-31
matchers.dart
packages/flutter_test/lib/src/matchers.dart
+0
-16
matchers_test.dart
packages/flutter_test/test/matchers_test.dart
+0
-4
No files found.
packages/flutter/lib/src/material/text_field.dart
View file @
b4324aed
...
...
@@ -688,8 +688,6 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
bool
get
_isEnabled
=>
widget
.
enabled
??
widget
.
decoration
?.
enabled
??
true
;
int
get
_currentLength
=>
_effectiveController
.
value
.
text
.
runes
.
length
;
InputDecoration
_getEffectiveDecoration
()
{
final
MaterialLocalizations
localizations
=
MaterialLocalizations
.
of
(
context
);
final
ThemeData
themeData
=
Theme
.
of
(
context
);
...
...
@@ -706,7 +704,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
// If buildCounter was provided, use it to generate a counter widget.
Widget
counter
;
final
int
currentLength
=
_
currentL
ength
;
final
int
currentLength
=
_
effectiveController
.
value
.
text
.
runes
.
l
ength
;
if
(
effectiveDecoration
.
counter
==
null
&&
effectiveDecoration
.
counterText
==
null
&&
widget
.
buildCounter
!=
null
)
{
...
...
@@ -1036,27 +1034,18 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
child:
child
,
);
}
return
IgnorePointer
(
ignoring:
!
_isEnabled
,
return
Semantics
(
onTap:
()
{
if
(!
_effectiveController
.
selection
.
isValid
)
_effectiveController
.
selection
=
TextSelection
.
collapsed
(
offset:
_effectiveController
.
text
.
length
);
_requestKeyboard
();
},
child:
MouseRegion
(
onEnter:
_handleMouseEnter
,
onExit:
_handleMouseExit
,
child:
AnimatedBuilder
(
animation:
controller
,
// changes the _currentLength
builder:
(
BuildContext
context
,
Widget
child
)
{
return
Semantics
(
maxValueLength:
widget
.
maxLengthEnforced
&&
widget
.
maxLength
!=
null
&&
widget
.
maxLength
>
0
?
widget
.
maxLength
:
null
,
currentValueLength:
_currentLength
,
onTap:
()
{
if
(!
_effectiveController
.
selection
.
isValid
)
_effectiveController
.
selection
=
TextSelection
.
collapsed
(
offset:
_effectiveController
.
text
.
length
);
_requestKeyboard
();
},
child:
child
,
);
},
child:
IgnorePointer
(
ignoring:
!
_isEnabled
,
child:
_selectionGestureDetectorBuilder
.
buildGestureDetector
(
behavior:
HitTestBehavior
.
translucent
,
child:
child
,
...
...
packages/flutter/lib/src/rendering/custom_paint.dart
View file @
b4324aed
...
...
@@ -864,12 +864,6 @@ class RenderCustomPaint extends RenderProxyBox {
if
(
properties
.
liveRegion
!=
null
)
{
config
.
liveRegion
=
properties
.
liveRegion
;
}
if
(
properties
.
maxValueLength
!=
null
)
{
config
.
maxValueLength
=
properties
.
maxValueLength
;
}
if
(
properties
.
currentValueLength
!=
null
)
{
config
.
currentValueLength
=
properties
.
currentValueLength
;
}
if
(
properties
.
toggled
!=
null
)
{
config
.
isToggled
=
properties
.
toggled
;
}
...
...
packages/flutter/lib/src/rendering/proxy_box.dart
View file @
b4324aed
...
...
@@ -3497,8 +3497,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
bool
hidden
,
bool
image
,
bool
liveRegion
,
int
maxValueLength
,
int
currentValueLength
,
String
label
,
String
value
,
String
increasedValue
,
...
...
@@ -3546,8 +3544,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
_scopesRoute
=
scopesRoute
,
_namesRoute
=
namesRoute
,
_liveRegion
=
liveRegion
,
_maxValueLength
=
maxValueLength
,
_currentValueLength
=
currentValueLength
,
_hidden
=
hidden
,
_image
=
image
,
_onDismiss
=
onDismiss
,
...
...
@@ -3803,28 +3799,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
markNeedsSemanticsUpdate
();
}
/// If non-null, sets the [SemanticsNode.maxValueLength] semantic to the given
/// value.
int
get
maxValueLength
=>
_maxValueLength
;
int
_maxValueLength
;
set
maxValueLength
(
int
value
)
{
if
(
_maxValueLength
==
value
)
return
;
_maxValueLength
=
value
;
markNeedsSemanticsUpdate
();
}
/// If non-null, sets the [SemanticsNode.currentValueLength] semantic to the
/// given value.
int
get
currentValueLength
=>
_currentValueLength
;
int
_currentValueLength
;
set
currentValueLength
(
int
value
)
{
if
(
_currentValueLength
==
value
)
return
;
_currentValueLength
=
value
;
markNeedsSemanticsUpdate
();
}
/// If non-null, sets the [SemanticsNode.isToggled] semantic to the given
/// value.
bool
get
toggled
=>
_toggled
;
...
...
@@ -4396,12 +4370,6 @@ class RenderSemanticsAnnotations extends RenderProxyBox {
config
.
namesRoute
=
namesRoute
;
if
(
liveRegion
!=
null
)
config
.
liveRegion
=
liveRegion
;
if
(
maxValueLength
!=
null
)
{
config
.
maxValueLength
=
maxValueLength
;
}
if
(
currentValueLength
!=
null
)
{
config
.
currentValueLength
=
currentValueLength
;
}
if
(
textDirection
!=
null
)
config
.
textDirection
=
textDirection
;
if
(
sortKey
!=
null
)
...
...
packages/flutter/lib/src/semantics/semantics.dart
View file @
b4324aed
This diff is collapsed.
Click to expand it.
packages/flutter/lib/src/widgets/basic.dart
View file @
b4324aed
...
...
@@ -6196,8 +6196,6 @@ class Semantics extends SingleChildRenderObjectWidget {
bool
hidden
,
bool
image
,
bool
liveRegion
,
int
maxValueLength
,
int
currentValueLength
,
String
label
,
String
value
,
String
increasedValue
,
...
...
@@ -6249,8 +6247,6 @@ class Semantics extends SingleChildRenderObjectWidget {
hidden:
hidden
,
image:
image
,
liveRegion:
liveRegion
,
maxValueLength:
maxValueLength
,
currentValueLength:
currentValueLength
,
label:
label
,
value:
value
,
increasedValue:
increasedValue
,
...
...
@@ -6354,8 +6350,6 @@ class Semantics extends SingleChildRenderObjectWidget {
readOnly:
properties
.
readOnly
,
focused:
properties
.
focused
,
liveRegion:
properties
.
liveRegion
,
maxValueLength:
properties
.
maxValueLength
,
currentValueLength:
properties
.
currentValueLength
,
inMutuallyExclusiveGroup:
properties
.
inMutuallyExclusiveGroup
,
obscured:
properties
.
obscured
,
multiline:
properties
.
multiline
,
...
...
@@ -6428,8 +6422,6 @@ class Semantics extends SingleChildRenderObjectWidget {
..
hidden
=
properties
.
hidden
..
image
=
properties
.
image
..
liveRegion
=
properties
.
liveRegion
..
maxValueLength
=
properties
.
maxValueLength
..
currentValueLength
=
properties
.
currentValueLength
..
label
=
properties
.
label
..
value
=
properties
.
value
..
increasedValue
=
properties
.
increasedValue
...
...
packages/flutter/test/material/text_field_test.dart
View file @
b4324aed
...
...
@@ -3367,68 +3367,6 @@ void main() {
semantics
.
dispose
();
});
testWidgets
(
'Disabled text field does not have tap action'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
Center
(
child:
TextField
(
maxLength:
10
,
enabled:
false
,
),
),
),
),
);
expect
(
semantics
,
isNot
(
includesNodeWith
(
actions:
<
SemanticsAction
>[
SemanticsAction
.
tap
])));
semantics
.
dispose
();
});
testWidgets
(
'currentValueLength/maxValueLength are in the tree'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
TextEditingController
controller
=
TextEditingController
();
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Center
(
child:
TextField
(
controller:
controller
,
maxLength:
10
,
),
),
),
),
);
expect
(
semantics
,
includesNodeWith
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isTextField
],
maxValueLength:
10
,
currentValueLength:
0
,
));
await
tester
.
showKeyboard
(
find
.
byType
(
TextField
));
const
String
testValue
=
'123'
;
tester
.
testTextInput
.
updateEditingValue
(
const
TextEditingValue
(
text:
testValue
,
selection:
TextSelection
.
collapsed
(
offset:
3
),
composing:
TextRange
(
start:
0
,
end:
testValue
.
length
),
));
await
tester
.
pump
();
expect
(
semantics
,
includesNodeWith
(
flags:
<
SemanticsFlag
>[
SemanticsFlag
.
isTextField
,
SemanticsFlag
.
isFocused
],
maxValueLength:
10
,
currentValueLength:
3
,
));
semantics
.
dispose
();
});
testWidgets
(
'Read only TextField identifies as read only text field in semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
packages/flutter/test/semantics/semantics_test.dart
View file @
b4324aed
...
...
@@ -447,8 +447,6 @@ void main() {
' textDirection: null
\n
'
' sortKey: null
\n
'
' platformViewId: null
\n
'
' maxValueLength: null
\n
'
' currentValueLength: null
\n
'
' scrollChildren: null
\n
'
' scrollIndex: null
\n
'
' scrollExtentMin: null
\n
'
...
...
@@ -545,8 +543,6 @@ void main() {
' textDirection: null
\n
'
' sortKey: null
\n
'
' platformViewId: null
\n
'
' maxValueLength: null
\n
'
' currentValueLength: null
\n
'
' scrollChildren: null
\n
'
' scrollIndex: null
\n
'
' scrollExtentMin: null
\n
'
...
...
packages/flutter/test/widgets/semantics_debugger_test.dart
View file @
b4324aed
...
...
@@ -452,11 +452,8 @@ void main() {
),
);
final
dynamic
semanticsDebuggerPainter
=
_getSemanticsDebuggerPainter
(
debuggerKey:
debugger
,
tester:
tester
);
final
RenderObject
renderTextfield
=
tester
.
renderObject
(
find
.
descendant
(
of:
find
.
byKey
(
textField
),
matching:
find
.
byType
(
Semantics
)).
first
);
expect
(
semanticsDebuggerPainter
.
getMessage
(
renderTextfield
.
debugSemantics
),
_getMessageShownInSemanticsDebugger
(
widgetKey:
textField
,
debuggerKey:
debugger
,
tester:
tester
),
'textfield'
,
);
});
...
...
@@ -466,14 +463,6 @@ String _getMessageShownInSemanticsDebugger({
@required
Key
widgetKey
,
@required
Key
debuggerKey
,
@required
WidgetTester
tester
,
})
{
final
dynamic
semanticsDebuggerPainter
=
_getSemanticsDebuggerPainter
(
debuggerKey:
debuggerKey
,
tester:
tester
);
return
semanticsDebuggerPainter
.
getMessage
(
tester
.
renderObject
(
find
.
byKey
(
widgetKey
)).
debugSemantics
);
}
dynamic
_getSemanticsDebuggerPainter
(
{
@required
Key
debuggerKey
,
@required
WidgetTester
tester
,
})
{
final
CustomPaint
customPaint
=
tester
.
widgetList
(
find
.
descendant
(
of:
find
.
byKey
(
debuggerKey
),
...
...
@@ -481,5 +470,5 @@ dynamic _getSemanticsDebuggerPainter({
)).
first
;
final
dynamic
semanticsDebuggerPainter
=
customPaint
.
foregroundPainter
;
expect
(
semanticsDebuggerPainter
.
runtimeType
.
toString
(),
'_SemanticsDebuggerPainter'
);
return
semanticsDebuggerPainter
;
return
semanticsDebuggerPainter
.
getMessage
(
tester
.
renderObject
(
find
.
byKey
(
widgetKey
)).
debugSemantics
)
;
}
packages/flutter/test/widgets/semantics_tester.dart
View file @
b4324aed
...
...
@@ -442,8 +442,6 @@ class SemanticsTester {
double
scrollPosition
,
double
scrollExtentMax
,
double
scrollExtentMin
,
int
currentValueLength
,
int
maxValueLength
,
SemanticsNode
ancestor
,
})
{
bool
checkNode
(
SemanticsNode
node
)
{
...
...
@@ -473,12 +471,6 @@ class SemanticsTester {
return
false
;
if
(
scrollExtentMin
!=
null
&&
!
nearEqual
(
node
.
scrollExtentMin
,
scrollExtentMin
,
0.1
))
return
false
;
if
(
currentValueLength
!=
null
&&
node
.
currentValueLength
!=
currentValueLength
)
{
return
false
;
}
if
(
maxValueLength
!=
null
&&
node
.
maxValueLength
!=
maxValueLength
)
{
return
false
;
}
return
true
;
}
...
...
@@ -721,19 +713,7 @@ class _IncludesNodeWith extends Matcher {
this
.
scrollPosition
,
this
.
scrollExtentMax
,
this
.
scrollExtentMin
,
this
.
maxValueLength
,
this
.
currentValueLength
,
})
:
assert
(
label
!=
null
||
value
!=
null
||
actions
!=
null
||
flags
!=
null
||
scrollPosition
!=
null
||
scrollExtentMax
!=
null
||
scrollExtentMin
!=
null
||
maxValueLength
!=
null
||
currentValueLength
!=
null
);
})
:
assert
(
label
!=
null
||
value
!=
null
||
actions
!=
null
||
flags
!=
null
||
scrollPosition
!=
null
||
scrollExtentMax
!=
null
||
scrollExtentMin
!=
null
);
final
String
label
;
final
String
value
;
...
...
@@ -744,8 +724,6 @@ class _IncludesNodeWith extends Matcher {
final
double
scrollPosition
;
final
double
scrollExtentMax
;
final
double
scrollExtentMin
;
final
int
currentValueLength
;
final
int
maxValueLength
;
@override
bool
matches
(
covariant
SemanticsTester
item
,
Map
<
dynamic
,
dynamic
>
matchState
)
{
...
...
@@ -759,8 +737,6 @@ class _IncludesNodeWith extends Matcher {
scrollPosition:
scrollPosition
,
scrollExtentMax:
scrollExtentMax
,
scrollExtentMin:
scrollExtentMin
,
currentValueLength:
currentValueLength
,
maxValueLength:
maxValueLength
,
).
isNotEmpty
;
}
...
...
@@ -785,8 +761,6 @@ class _IncludesNodeWith extends Matcher {
if
(
scrollPosition
!=
null
)
'scrollPosition "
$scrollPosition
"'
,
if
(
scrollExtentMax
!=
null
)
'scrollExtentMax "
$scrollExtentMax
"'
,
if
(
scrollExtentMin
!=
null
)
'scrollExtentMin "
$scrollExtentMin
"'
,
if
(
currentValueLength
!=
null
)
'currentValueLength "
$currentValueLength
"'
,
if
(
maxValueLength
!=
null
)
'maxValueLength "
$maxValueLength
"'
,
];
return
strings
.
join
(
', '
);
}
...
...
@@ -806,8 +780,6 @@ Matcher includesNodeWith({
double
scrollPosition
,
double
scrollExtentMax
,
double
scrollExtentMin
,
int
maxValueLength
,
int
currentValueLength
,
})
{
return
_IncludesNodeWith
(
label:
label
,
...
...
@@ -819,7 +791,5 @@ Matcher includesNodeWith({
scrollPosition:
scrollPosition
,
scrollExtentMax:
scrollExtentMax
,
scrollExtentMin:
scrollExtentMin
,
maxValueLength:
maxValueLength
,
currentValueLength:
currentValueLength
,
);
}
packages/flutter_test/lib/src/matchers.dart
View file @
b4324aed
...
...
@@ -433,8 +433,6 @@ Matcher matchesSemantics({
double
elevation
,
double
thickness
,
int
platformViewId
,
int
maxValueLength
,
int
currentValueLength
,
// Flags //
bool
hasCheckedState
=
false
,
bool
isChecked
=
false
,
...
...
@@ -554,8 +552,6 @@ Matcher matchesSemantics({
platformViewId:
platformViewId
,
customActions:
customActions
,
hintOverrides:
hintOverrides
,
currentValueLength:
currentValueLength
,
maxValueLength:
maxValueLength
,
children:
children
,
);
}
...
...
@@ -1749,8 +1745,6 @@ class _MatchesSemanticsData extends Matcher {
this
.
elevation
,
this
.
thickness
,
this
.
platformViewId
,
this
.
maxValueLength
,
this
.
currentValueLength
,
this
.
customActions
,
this
.
hintOverrides
,
this
.
children
,
...
...
@@ -1771,8 +1765,6 @@ class _MatchesSemanticsData extends Matcher {
final
double
elevation
;
final
double
thickness
;
final
int
platformViewId
;
final
int
maxValueLength
;
final
int
currentValueLength
;
final
List
<
Matcher
>
children
;
@override
...
...
@@ -1804,10 +1796,6 @@ class _MatchesSemanticsData extends Matcher {
description
.
add
(
' with thickness:
$thickness
'
);
if
(
platformViewId
!=
null
)
description
.
add
(
' with platformViewId:
$platformViewId
'
);
if
(
maxValueLength
!=
null
)
description
.
add
(
' with maxValueLength:
$maxValueLength
'
);
if
(
currentValueLength
!=
null
)
description
.
add
(
' with currentValueLength:
$currentValueLength
'
);
if
(
customActions
!=
null
)
description
.
add
(
' with custom actions:
$customActions
'
);
if
(
hintOverrides
!=
null
)
...
...
@@ -1850,10 +1838,6 @@ class _MatchesSemanticsData extends Matcher {
return
failWithDescription
(
matchState
,
'thickness was:
${data.thickness}
'
);
if
(
platformViewId
!=
null
&&
platformViewId
!=
data
.
platformViewId
)
return
failWithDescription
(
matchState
,
'platformViewId was:
${data.platformViewId}
'
);
if
(
currentValueLength
!=
null
&&
currentValueLength
!=
data
.
currentValueLength
)
return
failWithDescription
(
matchState
,
'currentValueLength was:
${data.currentValueLength}
'
);
if
(
maxValueLength
!=
null
&&
maxValueLength
!=
data
.
maxValueLength
)
return
failWithDescription
(
matchState
,
'maxValueLength was:
${data.maxValueLength}
'
);
if
(
actions
!=
null
)
{
int
actionBits
=
0
;
for
(
SemanticsAction
action
in
actions
)
...
...
packages/flutter_test/test/matchers_test.dart
View file @
b4324aed
...
...
@@ -525,8 +525,6 @@ void main() {
scrollExtentMin:
null
,
platformViewId:
105
,
customSemanticsActionIds:
<
int
>[
CustomSemanticsAction
.
getIdentifier
(
action
)],
currentValueLength:
10
,
maxValueLength:
15
,
);
final
_FakeSemanticsNode
node
=
_FakeSemanticsNode
();
node
.
data
=
data
;
...
...
@@ -537,8 +535,6 @@ void main() {
elevation:
3.0
,
thickness:
4.0
,
platformViewId:
105
,
currentValueLength:
10
,
maxValueLength:
15
,
/* Flags */
hasCheckedState:
true
,
isChecked:
true
,
...
...
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