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
45a70efa
Unverified
Commit
45a70efa
authored
Jan 17, 2019
by
Michael Goderbauer
Committed by
GitHub
Jan 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Respect EditableText.keyboardAppearance (#26721)
parent
60e9c585
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
110 additions
and
2 deletions
+110
-2
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+4
-2
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+1
-0
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+48
-0
editable_text_test.dart
packages/flutter/test/widgets/editable_text_test.dart
+57
-0
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
45a70efa
...
...
@@ -605,7 +605,9 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
if
(
widget
.
maxLength
!=
null
&&
widget
.
maxLengthEnforced
)
{
formatters
.
add
(
LengthLimitingTextInputFormatter
(
widget
.
maxLength
));
}
final
TextStyle
textStyle
=
widget
.
style
??
CupertinoTheme
.
of
(
context
).
textTheme
.
textStyle
;
final
CupertinoThemeData
themeData
=
CupertinoTheme
.
of
(
context
);
final
TextStyle
textStyle
=
widget
.
style
??
themeData
.
textTheme
.
textStyle
;
final
Brightness
keyboardAppearance
=
widget
.
keyboardAppearance
??
themeData
.
brightness
;
final
Widget
paddedEditable
=
Padding
(
padding:
widget
.
padding
,
...
...
@@ -635,7 +637,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with AutomaticK
cursorColor:
widget
.
cursorColor
,
backgroundCursorColor:
CupertinoColors
.
inactiveGray
,
scrollPadding:
widget
.
scrollPadding
,
keyboardAppearance:
widget
.
keyboardAppearance
,
keyboardAppearance:
keyboardAppearance
,
),
),
);
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
45a70efa
...
...
@@ -798,6 +798,7 @@ class EditableTextState extends State<EditableText> with AutomaticKeepAliveClien
:
TextInputAction
.
done
),
textCapitalization:
widget
.
textCapitalization
,
keyboardAppearance:
widget
.
keyboardAppearance
,
)
)..
setEditingState
(
localValue
);
}
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
45a70efa
...
...
@@ -1168,4 +1168,52 @@ void main() {
);
},
);
testWidgets
(
'text field respects keyboardAppearance from theme'
,
(
WidgetTester
tester
)
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
await
tester
.
pumpWidget
(
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
dark
,
),
home:
Center
(
child:
CupertinoTextField
(),
),
),
);
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
final
MethodCall
setClient
=
log
.
first
;
expect
(
setClient
.
method
,
'TextInput.setClient'
);
expect
(
setClient
.
arguments
.
last
[
'keyboardAppearance'
],
'Brightness.dark'
);
});
testWidgets
(
'text field can override keyboardAppearance from theme'
,
(
WidgetTester
tester
)
async
{
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
await
tester
.
pumpWidget
(
const
CupertinoApp
(
theme:
CupertinoThemeData
(
brightness:
Brightness
.
dark
,
),
home:
Center
(
child:
CupertinoTextField
(
keyboardAppearance:
Brightness
.
light
,
),
),
),
);
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
final
MethodCall
setClient
=
log
.
first
;
expect
(
setClient
.
method
,
'TextInput.setClient'
);
expect
(
setClient
.
arguments
.
last
[
'keyboardAppearance'
],
'Brightness.light'
);
});
}
packages/flutter/test/widgets/editable_text_test.dart
View file @
45a70efa
...
...
@@ -1979,6 +1979,63 @@ testWidgets(
));
expect
(
called
,
2
);
});
testWidgets
(
'default keyboardAppearance is resepcted'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/22212.
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
final
TextEditingController
controller
=
TextEditingController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
EditableText
(
controller:
controller
,
focusNode:
FocusNode
(),
style:
Typography
(
platform:
TargetPlatform
.
android
).
black
.
subhead
,
cursorColor:
Colors
.
blue
,
backgroundCursorColor:
Colors
.
grey
,
),
),
);
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
final
MethodCall
setClient
=
log
.
first
;
expect
(
setClient
.
method
,
'TextInput.setClient'
);
expect
(
setClient
.
arguments
.
last
[
'keyboardAppearance'
],
'Brightness.light'
);
});
testWidgets
(
'custom keyboardAppearance is resepcted'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/22212.
final
List
<
MethodCall
>
log
=
<
MethodCall
>[];
SystemChannels
.
textInput
.
setMockMethodCallHandler
((
MethodCall
methodCall
)
async
{
log
.
add
(
methodCall
);
});
final
TextEditingController
controller
=
TextEditingController
();
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
EditableText
(
controller:
controller
,
focusNode:
FocusNode
(),
style:
Typography
(
platform:
TargetPlatform
.
android
).
black
.
subhead
,
cursorColor:
Colors
.
blue
,
backgroundCursorColor:
Colors
.
grey
,
keyboardAppearance:
Brightness
.
dark
,
),
),
);
await
tester
.
showKeyboard
(
find
.
byType
(
EditableText
));
final
MethodCall
setClient
=
log
.
first
;
expect
(
setClient
.
method
,
'TextInput.setClient'
);
expect
(
setClient
.
arguments
.
last
[
'keyboardAppearance'
],
'Brightness.dark'
);
});
}
class
MockTextSelectionControls
extends
Mock
implements
TextSelectionControls
{}
...
...
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