Skip to content

Commit 7453ffd

Browse files
authored
Revert "Fix Date picker overlay colors aren't applied on selected sta… (#159583)
Reverts flutter/flutter#159203 because it depends on flutter/flutter#159072 which was flagged as a perf regression in flutter/flutter#159337. Reverting both PRs to see if the perf regression was really related to this change or was impacted by another change. See flutter/flutter#159337 (comment) for context.
1 parent 0e2a9c0 commit 7453ffd

File tree

5 files changed

+53
-364
lines changed

5 files changed

+53
-364
lines changed

examples/api/test/material/date_picker/date_picker_theme_day_shape.0_test.dart

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,38 +14,41 @@ void main() {
1414
const Color todayForegroundColor = Colors.black;
1515
const BorderSide todayBorder = BorderSide(width: 2);
1616

17-
ShapeDecoration? findDayDecoration(WidgetTester tester, String day) {
18-
return tester.widget<Ink>(
19-
find.ancestor(
20-
of: find.text(day),
21-
matching: find.byType(Ink)
22-
),
23-
).decoration as ShapeDecoration?;
24-
}
25-
2617
await tester.pumpWidget(
2718
const example.DatePickerApp(),
2819
);
2920

3021
await tester.tap(find.text('Open Date Picker'));
3122
await tester.pumpAndSettle();
3223

24+
ShapeDecoration dayShapeDecoration = tester.widget<DecoratedBox>(find.ancestor(
25+
of: find.text('15'),
26+
matching: find.byType(DecoratedBox),
27+
)).decoration as ShapeDecoration;
28+
3329
// Test the current day shape decoration.
34-
ShapeDecoration dayShapeDecoration = findDayDecoration(tester, '15')!;
3530
expect(dayShapeDecoration.color, todayBackgroundColor);
3631
expect(dayShapeDecoration.shape, dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)));
3732

33+
dayShapeDecoration = tester.widget<DecoratedBox>(find.ancestor(
34+
of: find.text('20'),
35+
matching: find.byType(DecoratedBox),
36+
)).decoration as ShapeDecoration;
37+
3838
// Test the selected day shape decoration.
39-
dayShapeDecoration = findDayDecoration(tester, '20')!;
4039
expect(dayShapeDecoration.color, theme.colorScheme.primary);
4140
expect(dayShapeDecoration.shape, dayShape);
4241

4342
// Tap to select current day as the selected day.
4443
await tester.tap(find.text('15'));
4544
await tester.pumpAndSettle();
4645

46+
dayShapeDecoration = tester.widget<DecoratedBox>(find.ancestor(
47+
of: find.text('15'),
48+
matching: find.byType(DecoratedBox),
49+
)).decoration as ShapeDecoration;
50+
4751
// Test the selected day shape decoration.
48-
dayShapeDecoration = findDayDecoration(tester, '15')!;
4952
expect(dayShapeDecoration.color, todayBackgroundColor);
5053
expect(dayShapeDecoration.shape, dayShape.copyWith(side: todayBorder.copyWith(color: todayForegroundColor)));
5154
});

packages/flutter/lib/src/material/calendar_date_picker.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import 'debug.dart';
2020
import 'divider.dart';
2121
import 'icon_button.dart';
2222
import 'icons.dart';
23-
import 'ink_decoration.dart';
2423
import 'ink_well.dart';
2524
import 'material_localizations.dart';
2625
import 'material_state.dart';
@@ -1057,7 +1056,7 @@ class _Day extends StatefulWidget {
10571056
final bool isSelectedDay;
10581057
final bool isToday;
10591058
final ValueChanged<DateTime> onChanged;
1060-
final FocusNode focusNode;
1059+
final FocusNode? focusNode;
10611060

10621061
@override
10631062
State<_Day> createState() => _DayState();
@@ -1112,7 +1111,7 @@ class _DayState extends State<_Day> {
11121111
shape: dayShape,
11131112
);
11141113

1115-
Widget dayWidget = Ink(
1114+
Widget dayWidget = DecoratedBox(
11161115
decoration: decoration,
11171116
child: Center(
11181117
child: Text(localizations.formatDecimal(widget.day.day), style: dayStyle?.apply(color: dayForegroundColor)),

packages/flutter/test/material/calendar_date_picker_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1196,7 +1196,7 @@ void main() {
11961196
await gesture.moveTo(tester.getCenter(find.text('25')));
11971197
await tester.pumpAndSettle();
11981198
inkFeatures = tester.allRenderObjects.firstWhere((RenderObject object) => object.runtimeType.toString() == '_RenderInkFeatures');
1199-
expect(inkFeatures, paints..circle()..circle(radius: 35.0, color: theme.colorScheme.onSurfaceVariant.withOpacity(0.08)));
1199+
expect(inkFeatures, paints..circle(radius: 35.0, color: theme.colorScheme.onSurfaceVariant.withOpacity(0.08)));
12001200
expect(inkFeatures, paintsExactlyCountTimes(#clipPath, 1));
12011201

12021202
final Rect expectedClipRect = Rect.fromCircle(center: const Offset(400.0, 241.0), radius: 35.0);

0 commit comments

Comments
 (0)