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
dae7e7b9
Unverified
Commit
dae7e7b9
authored
Jan 04, 2019
by
Hans Muller
Committed by
GitHub
Jan 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix typos introduced with the TextField.onTap PR, udpated debugFillProperties (#26088)
parent
0d667859
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
16 deletions
+90
-16
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+25
-16
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+65
-0
No files found.
packages/flutter/lib/src/material/text_field.dart
View file @
dae7e7b9
...
...
@@ -83,7 +83,7 @@ class TextField extends StatefulWidget {
/// [TextField.noMaxLength] then only the current length is displayed.
///
/// After [maxLength] characters have been input, additional input
/// is ignored, unless [maxLengthEnforced] is set to false. The
TextF
ield
/// is ignored, unless [maxLengthEnforced] is set to false. The
text f
ield
/// enforces the length with a [LengthLimitingTextInputFormatter], which is
/// evaluated after the supplied [inputFormatters], if any. The [maxLength]
/// value must be either null or greater than zero.
...
...
@@ -173,7 +173,7 @@ class TextField extends StatefulWidget {
/// Requesting the focus will typically cause the keyboard to be shown
/// if it's not showing already.
///
/// On Android, the user can hide the keyboard - without
h
changing the focus -
/// On Android, the user can hide the keyboard - without changing the focus -
/// with the system back button. They can restore the keyboard's visibility
/// by tapping on a text field. The user might hide the keyboard and
/// switch to a physical keyboard, or they might just need to get it
...
...
@@ -244,7 +244,7 @@ class TextField extends StatefulWidget {
/// to [TextField.noMaxLength] then only the current character count is displayed.
///
/// After [maxLength] characters have been input, additional input
/// is ignored, unless [maxLengthEnforced] is set to false. The
TextF
ield
/// is ignored, unless [maxLengthEnforced] is set to false. The
text f
ield
/// enforces the length with a [LengthLimitingTextInputFormatter], which is
/// evaluated after the supplied [inputFormatters], if any.
///
...
...
@@ -262,7 +262,7 @@ class TextField extends StatefulWidget {
///
/// ## Limitations
///
/// The
TextF
ield does not currently count Unicode grapheme clusters (i.e.
/// The
text f
ield does not currently count Unicode grapheme clusters (i.e.
/// characters visible to the user), it counts Unicode scalar values, which
/// leaves out a number of useful possible characters (like many emoji and
/// composed characters), so this will be inaccurate in the presence of those
...
...
@@ -315,7 +315,7 @@ class TextField extends StatefulWidget {
/// {@macro flutter.widgets.editableText.inputFormatters}
final
List
<
TextInputFormatter
>
inputFormatters
;
/// If false the textfield is "disabled": it ignores taps and its
/// If false the text
field is "disabled": it ignores taps and its
/// [decoration] is rendered in grey.
///
/// If non-null this property overrides the [decoration]'s
...
...
@@ -351,24 +351,24 @@ class TextField extends StatefulWidget {
return
enableInteractiveSelection
??
!
obscureText
;
}
/// Called when the user taps on this textfield.
/// Called when the user taps on this text
field.
///
/// The textfield builds a [GestureDetector] to handle input events like tap,
/// The text
field builds a [GestureDetector] to handle input events like tap,
/// to trigger focus requests, to move the caret, adjust the selection, etc.
/// Handling some of those events by wrapping the textfield with a competing
/// Handling some of those events by wrapping the text
field with a competing
/// GestureDetector is problematic.
///
/// To unconditionally handle taps, without interfering with the textfield's
/// To unconditionally handle taps, without interfering with the text
field's
/// internal gesture detector, provide this callback.
///
/// If the textfield is created with [enabled] false, taps will not be
/// If the text
field is created with [enabled] false, taps will not be
/// recognized.
///
/// To be notified when the textfield gains or loses the focus, provide a
/// To be notified when the text
field gains or loses the focus, provide a
/// [focusNode] and add a listener to that.
///
/// To listen to arbitrary pointer events without competing with the
/// textfield's internal gesture detector, use a [Listener].
/// text
field's internal gesture detector, use a [Listener].
final
GestureTapCallback
onTap
;
@override
...
...
@@ -380,16 +380,25 @@ class TextField extends StatefulWidget {
properties
.
add
(
DiagnosticsProperty
<
TextEditingController
>(
'controller'
,
controller
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
FocusNode
>(
'focusNode'
,
focusNode
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'enabled'
,
enabled
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
InputDecoration
>(
'decoration'
,
decoration
));
properties
.
add
(
DiagnosticsProperty
<
InputDecoration
>(
'decoration'
,
decoration
,
defaultValue:
const
InputDecoration
()
));
properties
.
add
(
DiagnosticsProperty
<
TextInputType
>(
'keyboardType'
,
keyboardType
,
defaultValue:
TextInputType
.
text
));
properties
.
add
(
DiagnosticsProperty
<
TextStyle
>(
'style'
,
style
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'autofocus'
,
autofocus
,
defaultValue:
false
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'obscureText'
,
obscureText
,
defaultValue:
false
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'autocorrect'
,
autocorrect
,
defaultValue:
fals
e
));
properties
.
add
(
DiagnosticsProperty
<
bool
>(
'autocorrect'
,
autocorrect
,
defaultValue:
tru
e
));
properties
.
add
(
IntProperty
(
'maxLines'
,
maxLines
,
defaultValue:
1
));
properties
.
add
(
IntProperty
(
'maxLength'
,
maxLength
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'maxLengthEnforced'
,
value:
maxLengthEnforced
,
ifTrue:
'max length enforced'
));
properties
.
add
(
DiagnosticsProperty
<
GestureTapCallback
>(
'onTap'
,
onTap
,
defaultValue:
false
));
properties
.
add
(
FlagProperty
(
'maxLengthEnforced'
,
value:
maxLengthEnforced
,
defaultValue:
true
,
ifFalse:
'maxLength not enforced'
));
properties
.
add
(
EnumProperty
<
TextInputAction
>(
'textInputAction'
,
textInputAction
,
defaultValue:
null
));
properties
.
add
(
EnumProperty
<
TextCapitalization
>(
'textCapitalization'
,
textCapitalization
,
defaultValue:
TextCapitalization
.
none
));
properties
.
add
(
EnumProperty
<
TextAlign
>(
'textAlign'
,
textAlign
,
defaultValue:
TextAlign
.
start
));
properties
.
add
(
EnumProperty
<
TextDirection
>(
'textDirection'
,
textDirection
,
defaultValue:
null
));
properties
.
add
(
DoubleProperty
(
'cursorWidth'
,
cursorWidth
,
defaultValue:
2.0
));
properties
.
add
(
DiagnosticsProperty
<
Radius
>(
'cursorRadius'
,
cursorRadius
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
Color
>(
'cursorColor'
,
cursorColor
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
Brightness
>(
'keyboardAppearance'
,
keyboardAppearance
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
EdgeInsetsGeometry
>(
'scrollPadding'
,
scrollPadding
,
defaultValue:
const
EdgeInsets
.
all
(
20.0
)));
properties
.
add
(
FlagProperty
(
'selectionEnabled'
,
value:
selectionEnabled
,
defaultValue:
true
,
ifFalse:
'selection disabled'
));
}
}
...
...
packages/flutter/test/material/text_field_test.dart
View file @
dae7e7b9
...
...
@@ -4197,4 +4197,69 @@ void main() {
expect
(
find
.
byType
(
CupertinoButton
),
findsNWidgets
(
3
));
},
);
testWidgets
(
'default TextField debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
TextField
().
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
()).
toList
();
expect
(
description
,
<
String
>[]);
});
testWidgets
(
'TextField implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
// Not checking controller, inputFormatters, focusNode
const
TextField
(
decoration:
InputDecoration
(
labelText:
'foo'
),
keyboardType:
TextInputType
.
text
,
textInputAction:
TextInputAction
.
done
,
textCapitalization:
TextCapitalization
.
none
,
style:
TextStyle
(
color:
Color
(
0xff00ff00
)),
textAlign:
TextAlign
.
end
,
textDirection:
TextDirection
.
ltr
,
autofocus:
true
,
obscureText:
true
,
autocorrect:
false
,
maxLines:
10
,
maxLength:
100
,
maxLengthEnforced:
false
,
enabled:
false
,
cursorWidth:
1.0
,
cursorRadius:
Radius
.
zero
,
cursorColor:
Color
(
0xff00ff00
),
keyboardAppearance:
Brightness
.
dark
,
scrollPadding:
EdgeInsets
.
zero
,
enableInteractiveSelection:
false
,
).
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
()).
toList
();
expect
(
description
,
<
String
>[
'enabled: false'
,
'decoration: InputDecoration(labelText: "foo")'
,
'style: TextStyle(inherit: true, color: Color(0xff00ff00))'
,
'autofocus: true'
,
'obscureText: true'
,
'autocorrect: false'
,
'maxLines: 10'
,
'maxLength: 100'
,
'maxLength not enforced'
,
'textInputAction: done'
,
'textAlign: end'
,
'textDirection: ltr'
,
'cursorWidth: 1.0'
,
'cursorRadius: Radius.circular(0.0)'
,
'cursorColor: Color(0xff00ff00)'
,
'keyboardAppearance: Brightness.dark'
,
'scrollPadding: EdgeInsets.zero'
,
'selection disabled'
]);
});
}
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