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
68fb0089
Unverified
Commit
68fb0089
authored
Jul 16, 2021
by
Bryan Oltman
Committed by
GitHub
Jul 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add textDirection property to CupertinoTextField and CupertinoTextFormFieldRow (#86482)
parent
5af58e22
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
0 deletions
+71
-0
text_field.dart
packages/flutter/lib/src/cupertino/text_field.dart
+7
-0
text_form_field_row.dart
packages/flutter/lib/src/cupertino/text_form_field_row.dart
+2
-0
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+28
-0
text_form_field_row_test.dart
...ages/flutter/test/cupertino/text_form_field_row_test.dart
+34
-0
No files found.
packages/flutter/lib/src/cupertino/text_field.dart
View file @
68fb0089
...
...
@@ -251,6 +251,7 @@ class CupertinoTextField extends StatefulWidget {
this
.
strutStyle
,
this
.
textAlign
=
TextAlign
.
start
,
this
.
textAlignVertical
,
this
.
textDirection
,
this
.
readOnly
=
false
,
ToolbarOptions
?
toolbarOptions
,
this
.
showCursor
,
...
...
@@ -404,6 +405,7 @@ class CupertinoTextField extends StatefulWidget {
this
.
strutStyle
,
this
.
textAlign
=
TextAlign
.
start
,
this
.
textAlignVertical
,
this
.
textDirection
,
this
.
readOnly
=
false
,
ToolbarOptions
?
toolbarOptions
,
this
.
showCursor
,
...
...
@@ -608,6 +610,9 @@ class CupertinoTextField extends StatefulWidget {
/// {@macro flutter.material.InputDecorator.textAlignVertical}
final
TextAlignVertical
?
textAlignVertical
;
/// {@macro flutter.widgets.editableText.textDirection}
final
TextDirection
?
textDirection
;
/// {@macro flutter.widgets.editableText.readOnly}
final
bool
readOnly
;
...
...
@@ -819,6 +824,7 @@ class CupertinoTextField extends StatefulWidget {
properties
.
add
(
DiagnosticsProperty
<
ScrollPhysics
>(
'scrollPhysics'
,
scrollPhysics
,
defaultValue:
null
));
properties
.
add
(
EnumProperty
<
TextAlign
>(
'textAlign'
,
textAlign
,
defaultValue:
TextAlign
.
start
));
properties
.
add
(
DiagnosticsProperty
<
TextAlignVertical
>(
'textAlignVertical'
,
textAlignVertical
,
defaultValue:
null
));
properties
.
add
(
EnumProperty
<
TextDirection
>(
'textDirection'
,
textDirection
,
defaultValue:
null
));
}
}
...
...
@@ -1176,6 +1182,7 @@ class _CupertinoTextFieldState extends State<CupertinoTextField> with Restoratio
style:
textStyle
,
strutStyle:
widget
.
strutStyle
,
textAlign:
widget
.
textAlign
,
textDirection:
widget
.
textDirection
,
autofocus:
widget
.
autofocus
,
obscuringCharacter:
widget
.
obscuringCharacter
,
obscureText:
widget
.
obscureText
,
...
...
packages/flutter/lib/src/cupertino/text_form_field_row.dart
View file @
68fb0089
...
...
@@ -144,6 +144,7 @@ class CupertinoTextFormFieldRow extends FormField<String> {
TextInputAction
?
textInputAction
,
TextStyle
?
style
,
StrutStyle
?
strutStyle
,
TextDirection
?
textDirection
,
TextAlign
textAlign
=
TextAlign
.
start
,
TextAlignVertical
?
textAlignVertical
,
bool
autofocus
=
false
,
...
...
@@ -238,6 +239,7 @@ class CupertinoTextFormFieldRow extends FormField<String> {
textAlign:
textAlign
,
textAlignVertical:
textAlignVertical
,
textCapitalization:
textCapitalization
,
textDirection:
textDirection
,
autofocus:
autofocus
,
toolbarOptions:
toolbarOptions
,
readOnly:
readOnly
,
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
68fb0089
...
...
@@ -4779,4 +4779,32 @@ void main() {
expect
(
disabledColor
,
isSameColorAs
(
const
Color
(
0xFFFAFAFA
)));
},
);
testWidgets
(
'textDirection is passed to EditableText'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
CupertinoApp
(
home:
Center
(
child:
CupertinoTextField
(
textDirection:
TextDirection
.
ltr
,
),
),
),
);
final
EditableText
ltrWidget
=
tester
.
widget
(
find
.
byType
(
EditableText
));
expect
(
ltrWidget
.
textDirection
,
TextDirection
.
ltr
);
await
tester
.
pumpWidget
(
const
CupertinoApp
(
home:
Center
(
child:
CupertinoTextField
(
textDirection:
TextDirection
.
rtl
,
),
),
),
);
final
EditableText
rtlWidget
=
tester
.
widget
(
find
.
byType
(
EditableText
));
expect
(
rtlWidget
.
textDirection
,
TextDirection
.
rtl
);
});
}
packages/flutter/test/cupertino/text_form_field_row_test.dart
View file @
68fb0089
...
...
@@ -458,4 +458,38 @@ void main() {
final
Text
errorText
=
tester
.
widget
(
errorTextFinder
);
expect
(
errorText
.
data
,
'Enter Value'
);
});
testWidgets
(
'Passes textDirection to underlying CupertinoTextField'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Center
(
child:
CupertinoTextFormFieldRow
(
textDirection:
TextDirection
.
ltr
,
),
),
),
);
final
Finder
ltrTextFieldFinder
=
find
.
byType
(
CupertinoTextField
);
expect
(
ltrTextFieldFinder
,
findsOneWidget
);
final
CupertinoTextField
ltrTextFieldWidget
=
tester
.
widget
(
ltrTextFieldFinder
);
expect
(
ltrTextFieldWidget
.
textDirection
,
TextDirection
.
ltr
);
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Center
(
child:
CupertinoTextFormFieldRow
(
textDirection:
TextDirection
.
rtl
,
),
),
),
);
final
Finder
rtlTextFieldFinder
=
find
.
byType
(
CupertinoTextField
);
expect
(
rtlTextFieldFinder
,
findsOneWidget
);
final
CupertinoTextField
rtlTextFieldWidget
=
tester
.
widget
(
rtlTextFieldFinder
);
expect
(
rtlTextFieldWidget
.
textDirection
,
TextDirection
.
rtl
);
});
}
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