Skip to content

Conversation

@LongCatIsLooong
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong commented Aug 25, 2019

Description

Update some colors used by CupertinoActionSheet.

Related Issues

#35541

Tests

I added the following tests:

  • Action sheet dark mode

Screenshots

Light mode

Highlighted Normal
Screenshot_1566776838 Screenshot_1566776842

Dark mode

Note that the text color is still in Orange since we haven't updated the default CupertinoThemeData.primaryColor.

Highlighted Normal
Screenshot_1566776862 Screenshot_1566776868

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.

@fluttergithubbot fluttergithubbot added f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels. labels Aug 25, 2019
@LongCatIsLooong LongCatIsLooong force-pushed the action-sheet+dynamic-color branch from 5e98bcd to 5bfa8e9 Compare August 26, 2019 16:54
@LongCatIsLooong LongCatIsLooong marked this pull request as ready for review August 26, 2019 18:24
Copy link
Contributor

@darrenaustin darrenaustin left a comment

Choose a reason for hiding this comment

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

LGTM

// This decoration is applied to the blurred backdrop to lighten the blurred
// image. Brightening is done to counteract the dark modal barrier that
// appears behind the alert. The overlay blend mode does the brightening.
// The white color doesn't paint any white, it's just the basis for the
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment should be updated to black as well.

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 👍

This is a good example of how to use CupertinoDynamicColor. I guess you'll be opening a bunch of similar PRs like this as you convert the rest of the widgets?

// Translucent, very light gray that is painted on top of the blurred backdrop
// as the action sheet's background color.
const Color _kBackgroundColor = Color(0xD1F8F8F8);
// These should be from System Materials which we don't have yet. They're eye-balled
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe write this comment as a TODO so it's easier to find later? Up to you though obviously!

Color get dividerColor => _dividerPaint.color;
set dividerColor(Color value) {
if (value == _dividerPaint.color)
return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Indent here (and maybe curly braces).

await tester.tap(find.text('Go'));
await tester.pump();

// Draw the overlay.
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 you meant to use a different comment here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh I meant to rewrite the test but completely forgot about it the next day. Thanks for catching this.

// Translucent, very light gray that is painted on top of the blurred backdrop
// as the action sheet's background color.
const Color _kBackgroundColor = Color(0xD1F8F8F8);
// These should be from System Materials which we don't have yet. They're eye-balled
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be using systemBackground from CupertinoSystemColors instead of _kBackgroundColor? Likewise for the other eyeballed colors? The HIG docs say "Use system colors with system materials." Shouldn't we be using the system colors throughout this class?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah sorry I just realized I got the value from the official sketch file. Unfortunately it doesn't seem to be one of the system colors.

@LongCatIsLooong
Copy link
Contributor Author

LongCatIsLooong commented Aug 26, 2019

If it is just going to be replaced, do we need to specify a color at all here?

@darrenaustin unfortunately there's an assert guarding that constructor. The analyzer complained when I tried removing the color parameter.

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

CupertinoSystemColors.fallbackValues.systemBlue.color.value,
);

stateSetter(() { brightness = Brightness.dark; });
Copy link
Contributor

Choose a reason for hiding this comment

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

NICE

// Draw the overlay using the light variant.
expect(find.byType(CupertinoActionSheet), paints..rect(color: const Color(0x66000000)));
expect(
tester.firstWidget<DefaultTextStyle>(find.widgetWithText(DefaultTextStyle, 'action')).style.color.value,
Copy link
Contributor

Choose a reason for hiding this comment

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

It's preferable to avoid .first and .firstWidget when that's possible. Could this lookup be factored into a function that returns action button's text style? Like:

TextStyle actionTextStyle() {
  return tester.widget<DefaultTextStyle>(
    find.descendant(
      of: find.widgetWithText(CupertinoActionSheetAction, 'action'),
      matching: find.byType(DefaultTextStyle),
    )
  ).style;
}

@LongCatIsLooong LongCatIsLooong merged commit e7f6080 into flutter:master Sep 3, 2019
@LongCatIsLooong LongCatIsLooong deleted the action-sheet+dynamic-color branch September 3, 2019 20:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

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.

6 participants