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
fafeb6c6
Unverified
Commit
fafeb6c6
authored
Aug 11, 2020
by
Rami
Committed by
GitHub
Aug 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure cupertino time picker positions hours and minutes correctly for RTL (#63405)
parent
e8c94210
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
4 deletions
+30
-4
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+5
-4
date_picker_test.dart
packages/flutter/test/cupertino/date_picker_test.dart
+25
-0
No files found.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
fafeb6c6
...
...
@@ -948,10 +948,11 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
_getEstimatedColumnWidth
(
_PickerColumnType
.
hour
),
_getEstimatedColumnWidth
(
_PickerColumnType
.
minute
),
];
final
List
<
_ColumnBuilder
>
pickerBuilders
=
<
_ColumnBuilder
>[
_buildHourPicker
,
_buildMinutePicker
,
];
// Swap the hours and minutes if RTL to ensure they are in the correct position.
final
List
<
_ColumnBuilder
>
pickerBuilders
=
Directionality
.
of
(
context
)
==
TextDirection
.
rtl
?
<
_ColumnBuilder
>[
_buildMinutePicker
,
_buildHourPicker
]
:
<
_ColumnBuilder
>[
_buildHourPicker
,
_buildMinutePicker
];
// Adds am/pm column if the picker is not using 24h format.
if
(!
widget
.
use24hFormat
)
{
...
...
packages/flutter/test/cupertino/date_picker_test.dart
View file @
fafeb6c6
...
...
@@ -1215,6 +1215,31 @@ void main() {
matchesGoldenFile
(
'date_picker_test.datetime.drag.png'
),
);
});
testWidgets
(
'DatePicker displays hours and minutes correctly in RTL'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Directionality
(
textDirection:
TextDirection
.
rtl
,
child:
Center
(
child:
SizedBox
(
width:
500
,
height:
400
,
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
initialDateTime:
DateTime
(
2019
,
1
,
1
,
4
),
onDateTimeChanged:
(
_
)
{},
),
),
),
),
),
);
final
double
hourLeft
=
tester
.
getTopLeft
(
find
.
text
(
'4'
)).
dx
;
final
double
minuteLeft
=
tester
.
getTopLeft
(
find
.
text
(
'00'
)).
dx
;
expect
(
hourLeft
,
lessThan
(
minuteLeft
));
});
});
testWidgets
(
'TimerPicker golden tests'
,
(
WidgetTester
tester
)
async
{
...
...
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