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
84ddffb3
Unverified
Commit
84ddffb3
authored
Jan 07, 2021
by
David LJ
Committed by
GitHub
Jan 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(cupertinoDatePicker): do not display previous day when minimumDate is midnight (#72933)
parent
925ff2dc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
1 deletion
+24
-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
+23
-0
No files found.
packages/flutter/lib/src/cupertino/date_picker.dart
View file @
84ddffb3
...
...
@@ -705,7 +705,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
final
DateTime
now
=
DateTime
.
now
();
if
(
widget
.
minimumDate
?.
is
After
(
rangeEnd
)
==
tru
e
)
if
(
widget
.
minimumDate
?.
is
Before
(
rangeEnd
)
==
fals
e
)
return
null
;
if
(
widget
.
maximumDate
?.
isAfter
(
rangeStart
)
==
false
)
return
null
;
...
...
packages/flutter/test/cupertino/date_picker_test.dart
View file @
84ddffb3
...
...
@@ -933,6 +933,29 @@ void main() {
expect
(
date
.
day
,
minDate
.
day
);
});
testWidgets
(
'date picker does not display previous day of minimumDate if it is set at midnight'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/72932
final
DateTime
minDate
=
DateTime
(
2019
,
12
,
31
);
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Center
(
child:
SizedBox
(
height:
400.0
,
width:
400.0
,
child:
CupertinoDatePicker
(
mode:
CupertinoDatePickerMode
.
dateAndTime
,
minimumDate:
minDate
,
onDateTimeChanged:
(
DateTime
newDate
)
{
},
initialDateTime:
minDate
.
add
(
const
Duration
(
days:
1
)),
),
),
),
),
);
expect
(
find
.
text
(
'Mon Dec 30'
),
findsNothing
);
});
group
(
'Picker handles initial noon/midnight times'
,
()
{
testWidgets
(
'midnight'
,
(
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