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
a66ea0a6
Unverified
Commit
a66ea0a6
authored
Jul 20, 2018
by
Jonah Williams
Committed by
GitHub
Jul 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add textCapitalization property (#19367)
parent
eb69f594
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
1 deletion
+76
-1
text_form_field_demo.dart
...utter_gallery/lib/demo/material/text_form_field_demo.dart
+1
-0
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+15
-0
text_form_field.dart
packages/flutter/lib/src/material/text_form_field.dart
+2
-0
text_input.dart
packages/flutter/lib/src/services/text_input.dart
+42
-1
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+15
-0
text_input_test.dart
packages/flutter/test/services/text_input_test.dart
+1
-0
No files found.
examples/flutter_gallery/lib/demo/material/text_form_field_demo.dart
View file @
a66ea0a6
...
...
@@ -180,6 +180,7 @@ class TextFormFieldDemoState extends State<TextFormFieldDemo> {
children:
<
Widget
>[
const
SizedBox
(
height:
24.0
),
new
TextFormField
(
textCapitalization:
TextCapitalization
.
words
,
decoration:
const
InputDecoration
(
border:
const
UnderlineInputBorder
(),
filled:
true
,
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
a66ea0a6
...
...
@@ -103,6 +103,7 @@ class TextField extends StatefulWidget {
this
.
decoration
=
const
InputDecoration
(),
TextInputType
keyboardType
=
TextInputType
.
text
,
this
.
textInputAction
=
TextInputAction
.
done
,
this
.
textCapitalization
=
TextCapitalization
.
none
,
this
.
style
,
this
.
textAlign
=
TextAlign
.
start
,
this
.
autofocus
=
false
,
...
...
@@ -160,6 +161,19 @@ class TextField extends StatefulWidget {
/// Defaults to [TextInputAction.done]. Must not be null.
final
TextInputAction
textInputAction
;
/// Configures how the platform keyboard will select an uppercase or
/// lowercase keyboard.
///
/// Only supports text keyboards, other keyboard types will ignore this
/// configuration. Capitalization is locale-aware.
///
/// Defaults to [TextCapitalization.none]. Must not be null.
///
/// See also:
///
/// * [TextCapitalization], for a description of each capitalization behavior.
final
TextCapitalization
textCapitalization
;
/// The style to use for the text being edited.
///
/// This text style is also used as the base style for the [decoration].
...
...
@@ -509,6 +523,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
focusNode:
focusNode
,
keyboardType:
widget
.
keyboardType
,
textInputAction:
widget
.
textInputAction
,
textCapitalization:
widget
.
textCapitalization
,
style:
style
,
textAlign:
widget
.
textAlign
,
autofocus:
widget
.
autofocus
,
...
...
packages/flutter/lib/src/material/text_form_field.dart
View file @
a66ea0a6
...
...
@@ -55,6 +55,7 @@ class TextFormField extends FormField<String> {
FocusNode
focusNode
,
InputDecoration
decoration
=
const
InputDecoration
(),
TextInputType
keyboardType
=
TextInputType
.
text
,
TextCapitalization
textCapitalization
=
TextCapitalization
.
none
,
TextInputAction
textInputAction
=
TextInputAction
.
done
,
TextStyle
style
,
TextAlign
textAlign
=
TextAlign
.
start
,
...
...
@@ -101,6 +102,7 @@ class TextFormField extends FormField<String> {
textInputAction:
textInputAction
,
style:
style
,
textAlign:
textAlign
,
textCapitalization:
textCapitalization
,
autofocus:
autofocus
,
obscureText:
obscureText
,
autocorrect:
autocorrect
,
...
...
packages/flutter/lib/src/services/text_input.dart
View file @
a66ea0a6
...
...
@@ -314,6 +314,34 @@ enum TextInputAction {
newline
,
}
/// Configures how the platform keyboard will select an uppercase or
/// lowercase keyboard.
///
/// Only supports text keyboards, other keyboard types will ignore this
/// configuration. Capitalization is locale-aware.
enum
TextCapitalization
{
/// Defaults to an uppercase keyboard for the first letter of each word.
///
/// Corresponds to `InputType.TYPE_TEXT_FLAG_CAP_WORDS` on Android, and
/// `UITextAutocapitalizationTypeWords` on iOS.
words
,
/// Defaults to an uppercase keyboard for the first letter of each sentence.
///
/// Corresponds to `InputType.TYPE_TEXT_FLAG_CAP_SENTENCES` on Android, and
/// `UITextAutocapitalizationTypeSentences` on iOS.
sentences
,
/// Defaults to an uppercase keyboard for each character.
///
/// Corresponds to `InputType.TYPE_TEXT_FLAG_CAP_CHARACTERS` on Android, and
/// `UITextAutocapitalizationTypeAllCharacters` on iOS.
characters
,
/// Defaults to a lowercase keyboard.
none
,
}
/// Controls the visual appearance of the text input control.
///
/// Many [TextInputAction]s are common between Android and iOS. However, if an
...
...
@@ -343,11 +371,13 @@ class TextInputConfiguration {
this
.
actionLabel
,
this
.
inputAction
=
TextInputAction
.
done
,
this
.
keyboardAppearance
=
Brightness
.
light
,
this
.
textCapitalization
=
TextCapitalization
.
none
,
})
:
assert
(
inputType
!=
null
),
assert
(
obscureText
!=
null
),
assert
(
autocorrect
!=
null
),
assert
(
keyboardAppearance
!=
null
),
assert
(
inputAction
!=
null
);
assert
(
inputAction
!=
null
),
assert
(
textCapitalization
!=
null
);
/// The type of information for which to optimize the text input control.
final
TextInputType
inputType
;
...
...
@@ -368,6 +398,16 @@ class TextInputConfiguration {
/// What kind of action to request for the action button on the IME.
final
TextInputAction
inputAction
;
/// Specifies how platforms may automatically capitialize text entered by the
/// user.
///
/// Defaults to [TextCapitalization.none].
///
/// See also:
///
/// * [TextCapitalization], for a description of each capitalization behavior.
final
TextCapitalization
textCapitalization
;
/// The appearance of the keyboard.
///
/// This setting is only honored on iOS devices.
...
...
@@ -383,6 +423,7 @@ class TextInputConfiguration {
'autocorrect'
:
autocorrect
,
'actionLabel'
:
actionLabel
,
'inputAction'
:
inputAction
.
toString
(),
'textCapitalization'
:
textCapitalization
.
toString
(),
'keyboardAppearance'
:
keyboardAppearance
.
toString
(),
};
}
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
a66ea0a6
...
...
@@ -202,6 +202,7 @@ class EditableText extends StatefulWidget {
this
.
selectionControls
,
TextInputType
keyboardType
,
this
.
textInputAction
=
TextInputAction
.
done
,
this
.
textCapitalization
=
TextCapitalization
.
none
,
this
.
onChanged
,
this
.
onEditingComplete
,
this
.
onSubmitted
,
...
...
@@ -269,6 +270,19 @@ class EditableText extends StatefulWidget {
/// Defaults to the ambient [Directionality], if any.
final
TextDirection
textDirection
;
/// Configures how the platform keyboard will select an uppercase or
/// lowercase keyboard.
///
/// Only supports text keyboards, other keyboard types will ignore this
/// configuration. Capitalization is locale-aware.
///
/// Defaults to [TextCapitalization.none]. Must not be null.
///
/// See also:
///
/// * [TextCapitalization], for a description of each capitalization behavior.
final
TextCapitalization
textCapitalization
;
/// Used to select a font when the same Unicode character can
/// be rendered differently, depending on the locale.
///
...
...
@@ -569,6 +583,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
inputAction:
widget
.
keyboardType
==
TextInputType
.
multiline
?
TextInputAction
.
newline
:
widget
.
textInputAction
,
textCapitalization:
widget
.
textCapitalization
,
)
)..
setEditingState
(
localValue
);
}
...
...
packages/flutter/test/services/text_input_test.dart
View file @
a66ea0a6
...
...
@@ -13,6 +13,7 @@ void main() {
expect
(
configuration
.
obscureText
,
false
);
expect
(
configuration
.
autocorrect
,
true
);
expect
(
configuration
.
actionLabel
,
null
);
expect
(
configuration
.
textCapitalization
,
TextCapitalization
.
none
);
expect
(
configuration
.
keyboardAppearance
,
Brightness
.
light
);
});
...
...
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