• Taha Tesser's avatar
    Fix `DatePicker` uses incorrect overlay color from `DatePickerTheme` and add... · a6187d9a
    Taha Tesser authored
    Fix `DatePicker` uses incorrect overlay color from `DatePickerTheme` and add missing tests (#130584)
    
    fixes [YearPickerState in calendar_date_picker is using dayOverlayColor instead of yearOverlayColor](https://github.com/flutter/flutter/issues/130051)
    
    ### Description
    
    - Fix year selection uses incorrect overlay color from `DatePickerTheme`
    - Update defaults tests to check for overlay color for different modes
    - Add tests to check overlay color is resolved.
    
    ### Code sample
    
    <details> 
    <summary>expand to view the code sample</summary> 
    
    ```dart
    import 'package:flutter/material.dart';
    
    void main() => runApp(const MyApp());
    
    class MyApp extends StatelessWidget {
      const MyApp({super.key});
    
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          theme: ThemeData(
            datePickerTheme: const DatePickerThemeData(
              yearOverlayColor: MaterialStatePropertyAll<Color>(Colors.green),
              dayOverlayColor: MaterialStatePropertyAll<Color>(Colors.amber),
            ),
            useMaterial3: true,
          ),
          home: Directionality(
            textDirection: TextDirection.ltr,
            child: Material(
              child: Center(
                child: DatePickerDialog(
                  initialDate: DateTime(2023, DateTime.january, 25),
                  firstDate: DateTime(2022),
                  lastDate: DateTime(2024, DateTime.december, 31),
                  currentDate: DateTime(2023, DateTime.january, 24),
                ),
              ),
            ),
          ),
        );
      }
    }
    
    ``` 
    	
    </details>
    
    ```dart
              yearOverlayColor: MaterialStatePropertyAll<Color>(Colors.green),
              dayOverlayColor: MaterialStatePropertyAll<Color>(Colors.red),
    ```
    
    ### Before
    ![Screenshot 2023-07-14 at 18 39 51](https://github.com/flutter/flutter/assets/48603081/52ec5096-bad6-4753-9e9a-15b6d5ce767e)
    
    ### After
    ![Screenshot 2023-07-14 at 18 38 32](https://github.com/flutter/flutter/assets/48603081/a51aeca8-a5c2-42b4-8c05-b55f9955e860)
    a6187d9a
Name
Last commit
Last update
.github Loading commit data...
.vscode Loading commit data...
bin Loading commit data...
dev Loading commit data...
examples Loading commit data...
packages Loading commit data...
.ci.yaml Loading commit data...
.cirrus.yml Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CODEOWNERS Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
CONTRIBUTING.md Loading commit data...
LICENSE Loading commit data...
PATENT_GRANT Loading commit data...
README.md Loading commit data...
TESTOWNERS Loading commit data...
analysis_options.yaml Loading commit data...
dartdoc_options.yaml Loading commit data...
flutter_console.bat Loading commit data...