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
f372eb37
Commit
f372eb37
authored
Feb 13, 2019
by
Tim Traversy
Committed by
Hans Muller
Feb 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DatePicker noon/midnight overflow fix (#27773)
parent
b4adafac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
1 deletion
+82
-1
date_picker.dart
packages/flutter/lib/src/cupertino/date_picker.dart
+1
-1
date_picker_test.dart
packages/flutter/test/cupertino/date_picker_test.dart
+81
-0
No files found.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
f372eb37
...
...
@@ -448,7 +448,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
date
.
year
,
date
.
month
,
date
.
day
,
selectedHour
+
selectedAmPm
*
12
,
widget
.
use24hFormat
?
selectedHour
:
selectedHour
%
12
+
selectedAmPm
*
12
,
selectedMinute
,
);
}
...
...
packages/flutter/test/cupertino/date_picker_test.dart
View file @
f372eb37
...
...
@@ -560,6 +560,87 @@ void main() {
);
});
group
(
'Picker handles initial noon/midnight times'
,
()
{
testWidgets
(
'midnight'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
width:
400.0
,
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
time
,
onDateTimeChanged:
(
DateTime
newDate
)
{
date
=
newDate
;
},
initialDateTime:
DateTime
(
2019
,
1
,
1
,
0
,
15
),
),
),
),
);
// 0:15 -> 0:16
await
tester
.
drag
(
find
.
text
(
'15'
),
_kRowOffset
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
date
,
DateTime
(
2019
,
1
,
1
,
0
,
16
));
});
testWidgets
(
'noon'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
width:
400.0
,
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
time
,
onDateTimeChanged:
(
DateTime
newDate
)
{
date
=
newDate
;
},
initialDateTime:
DateTime
(
2019
,
1
,
1
,
12
,
15
),
),
),
),
);
// 12:15 -> 12:16
await
tester
.
drag
(
find
.
text
(
'15'
),
_kRowOffset
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
date
,
DateTime
(
2019
,
1
,
1
,
12
,
16
));
});
testWidgets
(
'noon in 24 hour time'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
SizedBox
(
height:
400.0
,
width:
400.0
,
child:
CupertinoDatePicker
(
use24hFormat:
true
,
mode:
CupertinoDatePickerMode
.
time
,
onDateTimeChanged:
(
DateTime
newDate
)
{
date
=
newDate
;
},
initialDateTime:
DateTime
(
2019
,
1
,
1
,
12
,
25
),
),
),
),
);
// 12:25 -> 12:26
await
tester
.
drag
(
find
.
text
(
'25'
),
_kRowOffset
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
date
,
DateTime
(
2019
,
1
,
1
,
12
,
26
));
});
});
testWidgets
(
'picker persists am/pm value when scrolling hours'
,
(
WidgetTester
tester
)
async
{
DateTime
date
;
await
tester
.
pumpWidget
(
...
...
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