Unverified Commit 5d555eb2 authored by Taha Tesser's avatar Taha Tesser Committed by GitHub

Add M3 date range picker tests and fix header background theme color (#127662)

parent 9376a2ac
......@@ -13,7 +13,6 @@ import 'back_button.dart';
import 'button_style.dart';
import 'calendar_date_picker.dart';
import 'color_scheme.dart';
import 'colors.dart';
import 'date.dart';
import 'date_picker_theme.dart';
import 'debug.dart';
......@@ -1588,6 +1587,7 @@ class _CalendarRangePickerDialog extends StatelessWidget {
final DatePickerThemeData themeData = DatePickerTheme.of(context);
final DatePickerThemeData defaults = DatePickerTheme.defaults(context);
final Color? dialogBackground = themeData.rangePickerBackgroundColor ?? defaults.rangePickerBackgroundColor;
final Color? headerBackground = themeData.rangePickerHeaderBackgroundColor ?? defaults.rangePickerHeaderBackgroundColor;
final Color? headerForeground = themeData.rangePickerHeaderForegroundColor ?? defaults.rangePickerHeaderForegroundColor;
final Color? headerDisabledForeground = headerForeground?.withOpacity(0.38);
final TextStyle? headlineStyle = themeData.rangePickerHeaderHeadlineStyle ?? defaults.rangePickerHeaderHeadlineStyle;
......@@ -1616,7 +1616,7 @@ class _CalendarRangePickerDialog extends StatelessWidget {
actionsIconTheme: iconTheme,
elevation: useMaterial3 ? 0 : null,
scrolledUnderElevation: useMaterial3 ? 0 : null,
backgroundColor: useMaterial3 ? Colors.transparent : null,
backgroundColor: useMaterial3 ? headerBackground : null,
leading: CloseButton(
onPressed: onCancel,
),
......
......@@ -431,6 +431,9 @@ void main() {
expect(material.surfaceTintColor, datePickerTheme.rangePickerSurfaceTintColor);
expect(material.shape, datePickerTheme.rangePickerShape);
final AppBar appBar = tester.widget<AppBar>(find.byType(AppBar));
expect(appBar.backgroundColor, datePickerTheme.rangePickerHeaderBackgroundColor);
final Text selectRange = tester.widget<Text>(find.text('Select range'));
expect(selectRange.style?.color, datePickerTheme.rangePickerHeaderForegroundColor);
expect(selectRange.style?.fontSize, datePickerTheme.rangePickerHeaderHelpStyle?.fontSize);
......
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