Unverified Commit 2703a2bc authored by Jonathan Goyvaerts's avatar Jonathan Goyvaerts Committed by GitHub

Fix current day not being decorated when it was disabled for picking. (#115240)

Fixes flutter/flutter#113277
parent 96d7f9cb
......@@ -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: todayColor),
border: Border.all(color: dayColor),
shape: BoxShape.circle,
);
} else if (isDisabled) {
dayColor = disabledDayColor;
}
Widget dayWidget = Container(
......
......@@ -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),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment