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
503ae8cb
Unverified
Commit
503ae8cb
authored
Oct 30, 2018
by
jslavitz
Committed by
GitHub
Oct 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds Text Direction functionality to the TextField (#23609)
* added textDirection to TextField
parent
419be223
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
0 deletions
+51
-0
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+5
-0
text_form_field.dart
packages/flutter/lib/src/material/text_form_field.dart
+2
-0
editable_text.dart
packages/flutter/lib/src/widgets/editable_text.dart
+2
-0
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+42
-0
No files found.
packages/flutter/lib/src/material/text_field.dart
View file @
503ae8cb
...
...
@@ -106,6 +106,7 @@ class TextField extends StatefulWidget {
this
.
textCapitalization
=
TextCapitalization
.
none
,
this
.
style
,
this
.
textAlign
=
TextAlign
.
start
,
this
.
textDirection
,
this
.
autofocus
=
false
,
this
.
obscureText
=
false
,
this
.
autocorrect
=
true
,
...
...
@@ -176,6 +177,9 @@ class TextField extends StatefulWidget {
/// {@macro flutter.widgets.editableText.textAlign}
final
TextAlign
textAlign
;
/// {@macro flutter.widgets.editableText.textDirection}
final
TextDirection
textDirection
;
/// {@macro flutter.widgets.editableText.autofocus}
final
bool
autofocus
;
...
...
@@ -508,6 +512,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
textCapitalization:
widget
.
textCapitalization
,
style:
style
,
textAlign:
widget
.
textAlign
,
textDirection:
widget
.
textDirection
,
autofocus:
widget
.
autofocus
,
obscureText:
widget
.
obscureText
,
autocorrect:
widget
.
autocorrect
,
...
...
packages/flutter/lib/src/material/text_form_field.dart
View file @
503ae8cb
...
...
@@ -58,6 +58,7 @@ class TextFormField extends FormField<String> {
TextCapitalization
textCapitalization
=
TextCapitalization
.
none
,
TextInputAction
textInputAction
,
TextStyle
style
,
TextDirection
textDirection
,
TextAlign
textAlign
=
TextAlign
.
start
,
bool
autofocus
=
false
,
bool
obscureText
=
false
,
...
...
@@ -105,6 +106,7 @@ class TextFormField extends FormField<String> {
textInputAction:
textInputAction
,
style:
style
,
textAlign:
textAlign
,
textDirection:
textDirection
,
textCapitalization:
textCapitalization
,
autofocus:
autofocus
,
obscureText:
obscureText
,
...
...
packages/flutter/lib/src/widgets/editable_text.dart
View file @
503ae8cb
...
...
@@ -269,6 +269,7 @@ class EditableText extends StatefulWidget {
/// {@endtemplate}
final
TextAlign
textAlign
;
/// {@template flutter.widgets.editableText.textDirection}
/// The directionality of the text.
///
/// This decides how [textAlign] values like [TextAlign.start] and
...
...
@@ -282,6 +283,7 @@ class EditableText extends StatefulWidget {
/// its left.
///
/// Defaults to the ambient [Directionality], if any.
/// {@endtemplate}
final
TextDirection
textDirection
;
/// {@template flutter.widgets.editableText.textCapitalization}
...
...
packages/flutter/test/material/text_field_test.dart
View file @
503ae8cb
...
...
@@ -2928,6 +2928,48 @@ void main() {
expect
(
focusNode
.
hasFocus
,
isFalse
);
});
testWidgets
(
'TextField displays text with text direction'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
TextField
(
textDirection:
TextDirection
.
rtl
,
),
),
),
);
RenderEditable
editable
=
findRenderEditable
(
tester
);
await
tester
.
enterText
(
find
.
byType
(
TextField
),
'0123456789101112'
);
await
tester
.
pumpAndSettle
();
Offset
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
10
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
701.0
));
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
TextField
(
textDirection:
TextDirection
.
ltr
,
),
),
),
);
editable
=
findRenderEditable
(
tester
);
await
tester
.
enterText
(
find
.
byType
(
TextField
),
'0123456789101112'
);
await
tester
.
pumpAndSettle
();
topLeft
=
editable
.
localToGlobal
(
editable
.
getLocalRectForCaret
(
const
TextPosition
(
offset:
10
)).
topLeft
,
);
expect
(
topLeft
.
dx
,
equals
(
160.0
));
});
testWidgets
(
'TextField semantics'
,
(
WidgetTester
tester
)
async
{
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
final
TextEditingController
controller
=
TextEditingController
();
...
...
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