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
1b35cc2c
Unverified
Commit
1b35cc2c
authored
Jul 14, 2018
by
Jonah Williams
Committed by
GitHub
Jul 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support keyboardAppearance field for iOS (#19244)
parent
2f0b4158
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
6 deletions
+39
-6
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+10
-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
+15
-4
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+9
-0
text_input_test.dart
packages/flutter/test/services/text_input_test.dart
+3
-2
No files found.
packages/flutter/lib/src/material/text_field.dart
View file @
1b35cc2c
...
...
@@ -115,6 +115,7 @@ class TextField extends StatefulWidget {
this
.
onSubmitted
,
this
.
inputFormatters
,
this
.
enabled
,
this
.
keyboardAppearance
,
})
:
assert
(
keyboardType
!=
null
),
assert
(
textInputAction
!=
null
),
assert
(
textAlign
!=
null
),
...
...
@@ -278,6 +279,13 @@ class TextField extends StatefulWidget {
/// [Decoration.enabled] property.
final
bool
enabled
;
/// The appearance of the keyboard.
///
/// This setting is only honored on iOS devices.
///
/// If unset, defaults to the brightness of [ThemeData.primaryColorBrightness].
final
Brightness
keyboardAppearance
;
@override
_TextFieldState
createState
()
=>
new
_TextFieldState
();
...
...
@@ -468,6 +476,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
assert
(
debugCheckHasMaterial
(
context
));
final
ThemeData
themeData
=
Theme
.
of
(
context
);
final
TextStyle
style
=
widget
.
style
??
themeData
.
textTheme
.
subhead
;
final
Brightness
keyboardAppearance
=
widget
.
keyboardAppearance
??
themeData
.
primaryColorBrightness
;
final
TextEditingController
controller
=
_effectiveController
;
final
FocusNode
focusNode
=
_effectiveFocusNode
;
final
List
<
TextInputFormatter
>
formatters
=
widget
.
inputFormatters
??
<
TextInputFormatter
>[];
...
...
@@ -497,6 +506,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
onSelectionChanged:
_handleSelectionChanged
,
inputFormatters:
formatters
,
rendererIgnoresPointer:
true
,
keyboardAppearance:
keyboardAppearance
,
),
);
...
...
packages/flutter/lib/src/material/text_form_field.dart
View file @
1b35cc2c
...
...
@@ -69,6 +69,7 @@ class TextFormField extends FormField<String> {
FormFieldValidator
<
String
>
validator
,
List
<
TextInputFormatter
>
inputFormatters
,
bool
enabled
,
Brightness
keyboardAppearance
,
})
:
assert
(
initialValue
==
null
||
controller
==
null
),
assert
(
keyboardType
!=
null
),
assert
(
textAlign
!=
null
),
...
...
@@ -106,6 +107,7 @@ class TextFormField extends FormField<String> {
onSubmitted:
onFieldSubmitted
,
inputFormatters:
inputFormatters
,
enabled:
enabled
,
keyboardAppearance:
keyboardAppearance
,
);
},
);
...
...
packages/flutter/lib/src/services/text_input.dart
View file @
1b35cc2c
...
...
@@ -10,6 +10,7 @@ import 'package:flutter/foundation.dart';
import
'message_codec.dart'
;
import
'system_channels.dart'
;
import
'system_chrome.dart'
;
import
'text_editing.dart'
;
export
'dart:ui'
show
TextAffinity
;
...
...
@@ -104,7 +105,7 @@ class TextInputType {
String
get
_name
=>
'TextInputType.
${_names[index]}
'
;
/// Returns a representation of this object as a JSON object.
Map
<
String
,
dynamic
>
toJ
SON
()
{
Map
<
String
,
dynamic
>
toJ
son
()
{
return
<
String
,
dynamic
>{
'name'
:
_name
,
'signed'
:
signed
,
...
...
@@ -341,9 +342,11 @@ class TextInputConfiguration {
this
.
autocorrect
=
true
,
this
.
actionLabel
,
this
.
inputAction
=
TextInputAction
.
done
,
this
.
keyboardAppearance
=
Brightness
.
light
,
})
:
assert
(
inputType
!=
null
),
assert
(
obscureText
!=
null
),
assert
(
autocorrect
!=
null
),
assert
(
keyboardAppearance
!=
null
),
assert
(
inputAction
!=
null
);
/// The type of information for which to optimize the text input control.
...
...
@@ -365,14 +368,22 @@ class TextInputConfiguration {
/// What kind of action to request for the action button on the IME.
final
TextInputAction
inputAction
;
/// The appearance of the keyboard.
///
/// This setting is only honored on iOS devices.
///
/// Defaults to [Brightness.light].
final
Brightness
keyboardAppearance
;
/// Returns a representation of this object as a JSON object.
Map
<
String
,
dynamic
>
toJ
SON
()
{
Map
<
String
,
dynamic
>
toJ
son
()
{
return
<
String
,
dynamic
>{
'inputType'
:
inputType
.
toJ
SON
(),
'inputType'
:
inputType
.
toJ
son
(),
'obscureText'
:
obscureText
,
'autocorrect'
:
autocorrect
,
'actionLabel'
:
actionLabel
,
'inputAction'
:
inputAction
.
toString
(),
'keyboardAppearance'
:
keyboardAppearance
.
toString
(),
};
}
}
...
...
@@ -675,7 +686,7 @@ class TextInput {
_clientHandler
.
_currentConnection
=
connection
;
SystemChannels
.
textInput
.
invokeMethod
(
'TextInput.setClient'
,
<
dynamic
>[
connection
.
_id
,
configuration
.
toJ
SON
()
],
<
dynamic
>[
connection
.
_id
,
configuration
.
toJ
son
()
],
);
return
connection
;
}
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
1b35cc2c
...
...
@@ -210,6 +210,7 @@ class EditableText extends StatefulWidget {
this
.
rendererIgnoresPointer
=
false
,
this
.
cursorWidth
=
1.0
,
this
.
cursorRadius
,
this
.
keyboardAppearance
=
Brightness
.
light
,
})
:
assert
(
controller
!=
null
),
assert
(
focusNode
!=
null
),
assert
(
obscureText
!=
null
),
...
...
@@ -365,6 +366,13 @@ class EditableText extends StatefulWidget {
/// By default, the cursor has a Radius of zero.
final
Radius
cursorRadius
;
/// The appearance of the keyboard.
///
/// This setting is only honored on iOS devices.
///
/// Defaults to [Brightness.light].
final
Brightness
keyboardAppearance
;
@override
EditableTextState
createState
()
=>
new
EditableTextState
();
...
...
@@ -557,6 +565,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
inputType:
widget
.
keyboardType
,
obscureText:
widget
.
obscureText
,
autocorrect:
widget
.
autocorrect
,
keyboardAppearance:
widget
.
keyboardAppearance
,
inputAction:
widget
.
keyboardType
==
TextInputType
.
multiline
?
TextInputAction
.
newline
:
widget
.
textInputAction
,
...
...
packages/flutter/test/services/text_input_test.dart
View file @
1b35cc2c
...
...
@@ -13,6 +13,7 @@ void main() {
expect
(
configuration
.
obscureText
,
false
);
expect
(
configuration
.
autocorrect
,
true
);
expect
(
configuration
.
actionLabel
,
null
);
expect
(
configuration
.
keyboardAppearance
,
Brightness
.
light
);
});
test
(
'text serializes to JSON'
,
()
async
{
...
...
@@ -22,7 +23,7 @@ void main() {
autocorrect:
false
,
actionLabel:
'xyzzy'
,
);
final
Map
<
String
,
dynamic
>
json
=
configuration
.
toJ
SON
();
final
Map
<
String
,
dynamic
>
json
=
configuration
.
toJ
son
();
expect
(
json
[
'inputType'
],
<
String
,
dynamic
>{
'name'
:
'TextInputType.text'
,
'signed'
:
null
,
'decimal'
:
null
});
...
...
@@ -38,7 +39,7 @@ void main() {
autocorrect:
false
,
actionLabel:
'xyzzy'
,
);
final
Map
<
String
,
dynamic
>
json
=
configuration
.
toJ
SON
();
final
Map
<
String
,
dynamic
>
json
=
configuration
.
toJ
son
();
expect
(
json
[
'inputType'
],
<
String
,
dynamic
>{
'name'
:
'TextInputType.number'
,
'signed'
:
false
,
'decimal'
:
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