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
2703a2bc
Unverified
Commit
2703a2bc
authored
Nov 28, 2022
by
Jonathan Goyvaerts
Committed by
GitHub
Nov 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix current day not being decorated when it was disabled for picking. (#115240)
Fixes flutter/flutter#113277
parent
96d7f9cb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
5 deletions
+29
-5
calendar_date_picker.dart
packages/flutter/lib/src/material/calendar_date_picker.dart
+9
-5
calendar_date_picker_test.dart
...ages/flutter/test/material/calendar_date_picker_test.dart
+20
-0
No files found.
packages/flutter/lib/src/material/calendar_date_picker.dart
View file @
2703a2bc
...
...
@@ -979,16 +979,20 @@ class _DayPickerState extends State<_DayPicker> {
color:
selectedDayBackground
,
shape:
BoxShape
.
circle
,
);
}
else
if
(
isDisabled
)
{
dayColor
=
disabledDayColor
;
}
else
if
(
isToday
)
{
// The current day gets a different text color and a circle stroke
// The current day gets a different text color
(if enabled)
and a circle stroke
// border.
dayColor
=
todayColor
;
if
(
isDisabled
)
{
dayColor
=
disabledDayColor
;
}
else
{
dayColor
=
todayColor
;
}
decoration
=
BoxDecoration
(
border:
Border
.
all
(
color:
to
dayColor
),
border:
Border
.
all
(
color:
dayColor
),
shape:
BoxShape
.
circle
,
);
}
else
if
(
isDisabled
)
{
dayColor
=
disabledDayColor
;
}
Widget
dayWidget
=
Container
(
...
...
packages/flutter/test/material/calendar_date_picker_test.dart
View file @
2703a2bc
...
...
@@ -337,6 +337,26 @@ void main() {
);
});
testWidgets
(
'currentDate is highlighted even if it is disabled'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
calendarDatePicker
(
firstDate:
DateTime
(
2016
,
1
,
3
),
lastDate:
DateTime
(
2016
,
1
,
31
),
currentDate:
DateTime
(
2016
,
1
,
2
),
// not between first and last
initialDate:
DateTime
(
2016
,
1
,
5
),
));
const
Color
disabledColor
=
Color
(
0x61000000
);
// default disabled color
expect
(
Material
.
of
(
tester
.
element
(
find
.
text
(
'2'
))),
// The current day should be painted with a circle outline.
paints
..
circle
(
color:
disabledColor
,
style:
PaintingStyle
.
stroke
,
strokeWidth:
1.0
,
),
);
});
testWidgets
(
'Selecting date does not switch picker to year selection'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
calendarDatePicker
(
initialDate:
DateTime
(
2020
,
DateTime
.
may
,
10
),
...
...
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