Skip to content

Conversation

@TahaTesser
Copy link
Member

partial fix #126826 (date range picker is another PR)
fixes #126597

Description

  1. This PR adds a bunch of M3 date picker tests
  2. Fixes divider taking more space than it should
  3. Added dividerColor theme value to allow users to customise divider color just for the date pickers from date picker theme
code sample
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: DatePickerThemeData(
          headerBackgroundColor: Colors.amber,
        ),
        useMaterial3: true,
      ),
      home: Scaffold(
        body: Builder(builder: (BuildContext context) {
          return Center(
            child: ElevatedButton(
              onPressed: () async {
                showDatePicker(
                  context: context,
                  initialDate: DateTime(2016, DateTime.january, 15),
                  firstDate: DateTime(2001),
                  lastDate: DateTime(2031, DateTime.december, 31),
                );
              },
              child: const Text('Show Date Picker'),
            ),
          );
        }),
      ),
    );
  }
}

Before

Screenshot 2023-05-19 at 17 32 19

After

Screenshot 2023-05-19 at 17 51 15

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 19, 2023
@HansMuller HansMuller self-requested a review May 19, 2023 21:37
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good fix but it's causing some testing failures.

@TahaTesser TahaTesser force-pushed the m3_date_picker_test_and_divider_fix branch 3 times, most recently from 66375ed to 5a5afd3 Compare May 22, 2023 15:44
@TahaTesser
Copy link
Member Author

@HansMuller
Thanks! The failing tests weren't related to the actual tests but rather a discrepancy in the HTML renderer
I just patched the tests similar to those running into the same HTML problem.

@TahaTesser TahaTesser requested a review from HansMuller May 22, 2023 17:00
@HansMuller
Copy link
Contributor

Thanks for patching up the tests, will take a look.

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TahaTesser TahaTesser force-pushed the m3_date_picker_test_and_divider_fix branch from 5a5afd3 to 9a3f3e3 Compare May 22, 2023 22:38
@TahaTesser TahaTesser added the autosubmit Merge PR when tree becomes green via auto submit App label May 23, 2023
@auto-submit auto-submit bot merged commit fe32675 into flutter:master May 23, 2023
@TahaTesser TahaTesser deleted the m3_date_picker_test_and_divider_fix branch May 23, 2023 07:30
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 23, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request May 23, 2023
flutter/flutter@3437189...f86c529

2023-05-23 [email protected] Roll Flutter Engine from 431ed51c6415 to 168b0bf3f70d (1 revision) (flutter/flutter#127382)
2023-05-23 [email protected] Roll Flutter Engine from cc79ae858591 to 431ed51c6415 (1 revision) (flutter/flutter#127381)
2023-05-23 [email protected] Roll Flutter Engine from 311438399a45 to cc79ae858591 (1 revision) (flutter/flutter#127377)
2023-05-23 [email protected] Roll Flutter Engine from c284cd10e7ab to 311438399a45 (1 revision) (flutter/flutter#127376)
2023-05-23 [email protected] Roll Flutter Engine from 8d6602b030be to c284cd10e7ab (2 revisions) (flutter/flutter#127372)
2023-05-23 [email protected] Add M3 date picker tests and fix divider (flutter/flutter#127197)
2023-05-23 [email protected] Roll Flutter Engine from 2586cbeeae37 to 8d6602b030be (2 revisions) (flutter/flutter#127370)
2023-05-23 [email protected] Manual roll Flutter Engine from a342a9186e69 to 2586cbeeae37 (14 revisions) (flutter/flutter#127369)
2023-05-23 [email protected] [Android] Adds `namespace` to module build file templates (flutter/flutter#126963)
2023-05-23 [email protected] Revert Engine to a342a9186e69 (flutter/flutter#127368)
2023-05-23 [email protected] Roll Flutter Engine from 2a325eed77d0 to 41e8d52a006a (2 revisions) (flutter/flutter#127365)
2023-05-23 [email protected] Roll Flutter Engine from a342a9186e69 to 2a325eed77d0 (7 revisions) (flutter/flutter#127364)
2023-05-23 [email protected] Remove null-safety argument from DartPad doc samples (flutter/flutter#127345)
2023-05-22 [email protected] Support keeping a bottom sheet with a DraggableScrollableSheet from closing on drag/fling to min extent (flutter/flutter#127339)
2023-05-22 [email protected] Fix wasm-opt location when using local_web_sdk (flutter/flutter#127355)
2023-05-22 [email protected] Roll Flutter Engine from 1ed9fc0caf55 to a342a9186e69 (3 revisions) (flutter/flutter#127352)
2023-05-22 [email protected] Show warning when attempting to flutter run on an ios device with developer mode turned off (flutter/flutter#125710)
2023-05-22 [email protected] Suggest that people move to "beta" when they upgrade on "master" (flutter/flutter#127146)
2023-05-22 [email protected] add test for setting JAVA_HOME and PATH when invoking `sdkmanager --licenses` (flutter/flutter#127344)
2023-05-22 [email protected] Roll Flutter Engine from e04c14786d5a to 1ed9fc0caf55 (1 revision) (flutter/flutter#127343)
2023-05-22 [email protected] fix: Search anchor box location when used on nested navigator (flutter/flutter#127198)
2023-05-22 [email protected] [flutter_tools] delete entitlements files after copying to macos build dir (flutter/flutter#126875)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
partial fix flutter#126826 (date range picker is another PR)
fixes flutter#126597

### Description

1. This PR adds a bunch of M3 date picker tests
2. Fixes divider taking more space than it should
3. Added dividerColor  theme value to allow users to customise divider color just for the date pickers from date picker theme 

<details> 
<summary>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: DatePickerThemeData(
          headerBackgroundColor: Colors.amber,
        ),
        useMaterial3: true,
      ),
      home: Scaffold(
        body: Builder(builder: (BuildContext context) {
          return Center(
            child: ElevatedButton(
              onPressed: () async {
                showDatePicker(
                  context: context,
                  initialDate: DateTime(2016, DateTime.january, 15),
                  firstDate: DateTime(2001),
                  lastDate: DateTime(2031, DateTime.december, 31),
                );
              },
              child: const Text('Show Date Picker'),
            ),
          );
        }),
      ),
    );
  }
}
``` 
	
</details>

### Before
![Screenshot 2023-05-19 at 17 32 19](https://github.com/flutter/flutter/assets/48603081/4463de1a-fb94-4930-a6ab-8245331a8134)

### After
![Screenshot 2023-05-19 at 17 51 15](https://github.com/flutter/flutter/assets/48603081/296276f0-cf13-4a59-8542-a46da774153b)
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tests for Material 3 Date pickers (Material3) DatePicker Divider cannot be removed or styled, it does not fit with a custom header background

2 participants