Skip to content

Conversation

@mjohnsullivan
Copy link
Contributor

Chevrons in month date picker change to disabled color when scrolling starts, and back to the default icon color when scrolling ends.

Matt Sullivan and others added 30 commits November 13, 2017 09:19
? null
: '${localizations.previousMonthTooltip} ${localizations.formatMonthYear(_previousMonthDate)}',
onPressed:
_isDisplayingFirstMonth ? null : _handlePreviousMonth,
Copy link
Contributor

Choose a reason for hiding this comment

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

wrapping here doesn't seem to make this more readable... why not leave this on one line?

Copy link
Contributor

Choose a reason for hiding this comment

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

(the onPressed case, i mean)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do


// Initial chevron animation state should be dismissed
// An AlwaysStoppedAnimation is also found and is ignored
find.byType(FadeTransition).evaluate().forEach((Element element) {
Copy link
Contributor

Choose a reason for hiding this comment

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

looking for the fade transition seems a bit brittle... i recommend looking for the chevron icon's render object's parent, or some such.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How about this:

for(Element element in find.byType(IconButton).evaluate()) {
final RenderAnimatedOpacity ft = element.ancestorRenderObjectOfType(
const TypeMatcher());
expect(ft.opacity.value, equals(1.0));
expect(ft.opacity.status, equals(AnimationStatus.dismissed));
}


// Drag and hold the picker to test for the opacity change
final TestGesture gesture = await tester.startGesture(const Offset(100.0, 100.0));
await gesture.moveBy(const Offset(50.0, 100.0), );
Copy link
Contributor

Choose a reason for hiding this comment

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

trailing comma here is weird, did you mean to give another argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Typo on my side

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 PR looks good. The test could be cleaned up a little.

_chevronOpacityController = new AnimationController(
duration: const Duration(milliseconds: 500), vsync: this
);
final curve = new CurvedAnimation(parent: _chevronOpacityController, curve: Curves.easeInOut);
Copy link
Contributor

Choose a reason for hiding this comment

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

A type is needed here, Animation<double>, and maybe curve is the wrong name for the variable since it's not a Curve.

Sorry to nit pick. You could avoid the whole issue by just writing:

_chevronOpacityAnimation = new Tween(begin: 1.0, end: 0.5).animate(
  new CurvedAnimation(
    parent: _chevronOpacityController,
    curve: Curves.easeInOut,
  ),
);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nitpick away as it leads to cleaner code! Will revise to clean up.

itemBuilder: _buildItems,
onPageChanged: _handleMonthPageChanged,
child: new NotificationListener<ScrollStartNotification>(
onNotification: (_) => _handleScrollStartNotification(context),
Copy link
Contributor

Choose a reason for hiding this comment

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

You don't need to pass the context along here, since it's a State property. Rather than creating a closure, you could just make the _handleFoo methods NotificationListenerCallbacks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will move the functions into inline closures as they're short and don't clutter the build() code too much.

opacity: _chevronOpacityAnimation,
child: new IconButton(
icon: new Icon(Icons.chevron_left),
tooltip: _isDisplayingFirstMonth
Copy link
Contributor

Choose a reason for hiding this comment

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

More nit pickery. The way this was formatted helped highlight the fact that tooltip and onPressed values had similar structure. If you're going to do this, then 2-space indent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Auto-formatter strikes; will revert to previous formatting

opacity: _chevronOpacityAnimation,
child: new IconButton(
icon: new Icon(Icons.chevron_right),
tooltip: _isDisplayingLastMonth
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as earlier.

expect(ft.opacity.status, equals(AnimationStatus.dismissed));
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Lots of extra blank lines in this test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

);


for(Element element in find.byType(IconButton).evaluate()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Switching to:

final Finder chevronFinder = find.byType(IconButton);
chevronFinder.precache();

@HansMuller
Copy link
Contributor

NICE. LGTM

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@mjohnsullivan
Copy link
Contributor Author

My copy of the git repo is hopelessly messed up. Will pull a fresh copy and create a new PR

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.