-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Improve some scrollbar error messages #143279
Conversation
@Piinks It looks like the existing unit tests don't assert on the error hints. Should I add tests just for this case? Or should I get a test exception? |
Fly-by comment: I would add a test for this because I think if we would have had a test we would have realized that it is missing spaces earlier (e.g. at the latest during code review of the change that introduced the error). |
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.
+1 to Michael's comment. I feel like this error message has changed a lot over the years, so a test is a great idea. There is already a test that verifies it throws the error, it just does not check the whole message:
testWidgets('Interactive scrollbars should have a valid scroll controller', (WidgetTester tester) async { |
ErrorHint( | ||
'If a ScrollController has not been provided, the ' | ||
'PrimaryScrollController is used by default on mobile platforms ' | ||
'for ScrollViews with an Axis.vertical scroll direction.', |
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.
I updated this phrasing to match the corresponding hint in the "multiple scroll positions" assertion.
), | ||
if (tryPrimary) ...<ErrorHint>[ |
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 previous error hint was one long line. I split this into multiple hints to split it into multiple lines. Please let me know if I should revert this split.
else | ||
ErrorHint( | ||
'The provided ScrollController cannot be shared by multiple ' | ||
'ScrollView widgets.' |
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.
I changed this hint as well
Thanks all for the feedback! This should be ready for review now. Let me know if I goofed anything, I'm a massive framework newbie 😅 |
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 is a really nice clean up. The error message had gotten so complex as we added more test cases over time. Thank you! LGTM
Adds some missing spaces, rewords some errors, and splits some errors into more lines.
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.