Skip to content

Conversation

@LongCatIsLooong
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong commented Oct 30, 2019

Description

light dark
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 45 27 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 53
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 45 44 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 57
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 45 53 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 02
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 00 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 07
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 02 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 10
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 04 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 11
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 14 52 47 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 14 53 43
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 17 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 26
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 14 53 04 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 14 53 55
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 28 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 41
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 32 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 44
Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 46 44 Simulator Screen Shot - iPhone 11 - 2019-10-30 at 11 47 52

Can't directly use CupertinoDynamicColor in CupertinoPickers because the relevant PR is reverted and has to re-land first.

Related Issues

#35541
Fixes #39685

Tests

I added the following tests:

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read Handling breaking changes). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

@LongCatIsLooong LongCatIsLooong changed the title [WIP adding tests] Update cupertino demos in gallery Update cupertino demos in gallery Oct 30, 2019
@xster
Copy link
Member

xster commented Oct 31, 2019

Is the black on blue contrast for the cupertino button going to get any better with CupertinoDynamicColor (or is it already using it?).

The contrast looks a bit low unless the blue is going to look a bit brighter with dynamic colors.

@LongCatIsLooong
Copy link
Contributor Author

@xster thank you for checking! Almost all Cupertino widgets are already using dynamic colors, including CupertinoButton. The RGB values of those colors seem correct, but CupertinoThemeData.primaryContrastingColor's default value (white in light mode and black in dark mode, same as the system primary background color) is kinda made up so the primary contrasting color on primary color combination doesn't look as good. The combo is only used by pre ios 13 segmented controls and CupertinoButton.filled buttons. I guess I can make the segmented control's default inactive background color transparent, and change the primary contrasting color to always be white?

Copy link
Contributor

@justinmc justinmc left a comment

Choose a reason for hiding this comment

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

LGTM

The screenshots look really good. Thanks for doing all the tedious work here!

scrollController: scrollController,
itemExtent: _kPickerItemHeight,
backgroundColor: CupertinoColors.white,
backgroundColor: CupertinoDynamicColor.resolve(CupertinoColors.systemBackground, context),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be

CupertinoColors.systemBackground.resolveFrom(context)

Here and elsewhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Currently the nullOk parameter of CupertinoDynamicColor.resolveFrom defaults to false. I think I should change it to true?

);
}

Widget _buildBottomPicker(Widget picker) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be more Fluttery (might be more efficient too) if we defined a _BottomPicker widget instead of using this function. Doing so would also eliminate the need for the Builder.

Likewise for the other _buildFoo() functions.

Note also: since the demo was already factored this way; it would be OK to make the change in a follow-on PR.

@override
void initState() {
super.initState();
controller.addListener(() { setState(() {}); });
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we want to require developers to set up the segmented control this way. The convention for this kind of thing is to for the onValueChanged() callback set update the enclosing widget's state and call setState(). Conventionally, the controller parameter is optional. If the controller is specified then the caller must manage its lifetime.

@LongCatIsLooong
Copy link
Contributor Author

systemBlue over white yields a contrast ratio of 4.01.

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

@LongCatIsLooong LongCatIsLooong merged commit bbb2a0f into flutter:master Nov 5, 2019
@LongCatIsLooong LongCatIsLooong deleted the update-gallery branch November 5, 2019 00:31
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. customer: gallery Relating to flutter/gallery repository. Please transfer non-framework issues there. d: examples Sample code and demos f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CupertinoDatePicker text color and background color are white in ios 13 dark mode

6 participants