-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Change color of chevrons when scrolling month date picker (#5267) #19195
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| ? null | ||
| : '${localizations.previousMonthTooltip} ${localizations.formatMonthYear(_previousMonthDate)}', | ||
| onPressed: | ||
| _isDisplayingFirstMonth ? null : _handlePreviousMonth, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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), ); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo on my side
HansMuller
left a comment
There was a problem hiding this 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); |
There was a problem hiding this comment.
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,
),
);
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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)); | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can define a finder value once rather than using this block of code over and over.
There was a problem hiding this comment.
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();
|
NICE. LGTM |
|
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 |
|
My copy of the git repo is hopelessly messed up. Will pull a fresh copy and create a new PR |
Chevrons in month date picker change to disabled color when scrolling starts, and back to the default icon color when scrolling ends.