Skip to content

resolved the issue of indeterminate CircularProgressIndicator.adaptive on Darwin #140947

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

Merged
merged 38 commits into from
Jan 9, 2024
Merged

Conversation

nikkivirtuoso
Copy link
Contributor

@nikkivirtuoso nikkivirtuoso commented Jan 4, 2024

Fixes #140574

Passes the value from CircularProgressIndicator to the Cupertino version so that functionality is not lost on Apple devices.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

resolved issue of cicularactivityindicator
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link

google-cla bot commented Jan 4, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Jan 4, 2024
@nikkivirtuoso
Copy link
Contributor Author

please review my code

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

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

Code looks good to me, with a small nit. This will need a test however. Probably one that gives a CircularProgressIndicator.adaptive a value, then checks to see if a CupertinoActivityIndicator is rendered with the expected value.

}

return CupertinoActivityIndicator.partiallyRevealed(
key: widget.key, color: tickColor, progress: val);
Copy link
Contributor

Choose a reason for hiding this comment

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

Formatting nit: move each property to a new line since this line is already long:

return CupertinoActivityIndicator.partiallyRevealed(
     key: widget.key,
     color: tickColor,
     progress: val
);

@nikkivirtuoso
Copy link
Contributor Author

@MitchellGoodwin, sir please check now i have made the necessary changes and all test cases have passed

}

return CupertinoActivityIndicator.partiallyRevealed(
key: widget.key,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this has an extra indent that should be removed.

@MitchellGoodwin
Copy link
Contributor

Per our policy on test coverage, this change still needs a test added to it. Could you please add one? It just needs to check if CircularProgressIndicator.adaptive with a value renders a CupertinoActivityIndicator with that same value.

@nikkivirtuoso
Copy link
Contributor Author

yes i will add the test guide me

@nikkivirtuoso
Copy link
Contributor Author

i have tried a code for testing here it is:
`import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
testWidgets('CircularProgressIndicator.adaptive test', (WidgetTester tester) async {
await tester.pumpWidget(
MaterialApp(
home: const Centre(
child: CircularProgressIndicator.adaptive(
value: 0.5,
),
),
),
);

expect(find.byType(CupertinoActivityIndicator), findsOneWidget);


expect(
  find.byType(CupertinoActivityIndicator).evaluate().first.widget.value,
  0.5,
);

});
}`

@MitchellGoodwin
Copy link
Contributor

The test should be added in /packages/flutter/test/material/progress_indicator_test.dart. You can find a basic adaptive test on line 1065. What's important is the variant argument near the end. That will make the test only run on Apple platforms so the adaptive version goes to the Cupertino progress indicator. I believe the rest of your code will work.

@nikkivirtuoso
Copy link
Contributor Author

@MitchellGoodwin, sir i have updated the test case as at first it was unable to extract the value hence i have taken the return type so that it don't get lost and all test cases have been passed, please review my code

@nikkivirtuoso
Copy link
Contributor Author

nikkivirtuoso commented Jan 5, 2024

@MitchellGoodwin Sir, please have a look

tester.widget<CircularProgressIndicator>(
find.byType(CircularProgressIndicator)).value,
0.5,
);
Copy link
Contributor

Choose a reason for hiding this comment

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

This test should be left alone. Instead, it would be better to add a new one. So you can copy the existing test as it was and put it below, then change it to look for the adaptive value logic. This makes it so that if either test fails in the future it will be easier to see what logic is broken.

Also, it would be better to try and get the value of progress of CupertinoActivityIndicator to check that the adaptive logic is working.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sir i got the first part, but i am confused with the last part, you are saying that it should test on the value provided by the user not the default value that i have set to 0.5, am I right ?

Copy link
Contributor

Choose a reason for hiding this comment

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

You should test that if CircularProgressIndicator.adaptive is given a value of something, in this case 0.5, then a CupertinoActivityIndicator is rendered with a progress of 0.5.

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

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

Code looks good to me. Thank you for righting the test. I just have some formatting nits.

Comment on lines 1080 to 1085
},
variant: const TargetPlatformVariant(<TargetPlatform> {
TargetPlatform.iOS,
TargetPlatform.macOS,
}),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: tab these lines to the left.

Co-authored-by: Mitchell Goodwin <58190796+MitchellGoodwin@users.noreply.github.com>
@MitchellGoodwin
Copy link
Contributor

I updated the PR description with a link to the original issue, and put the checklist. I checked off what I could see was done. Check the top three if you've read those resources. If not, I would encourage you to look over them. This PR does not need documentation, so that can be left blank.

@nikkivirtuoso
Copy link
Contributor Author

Yes sir, I have checked the top three resources, and i have read them, now i have understood the significance of trailing spaces, Thankyou Sir.

@nikkivirtuoso
Copy link
Contributor Author

Sir, any suggestions for me its my first PR which is going to merge and i haven't entered the software industry yet i am trying to get a job

@nikkivirtuoso
Copy link
Contributor Author

Sir, please review my code

@MitchellGoodwin
Copy link
Contributor

I have two outstanding nits. Address those and this will be done, I think.

@jmagman
Copy link
Member

jmagman commented Jan 8, 2024

sir please review my code

@nikkivirtuoso thank you so much for your contribution! But please refrain from pinging your PR, @MitchellGoodwin is in the process of reviewing it and has many things to do, in addition to reviewing this. Our contribution guide says:

If nobody has reviewed your code after a week, then reach out on our Chat channels. The #hackers-new channel is a good place to ask for help if you're a new contributor.

So if it's been more than a week, please reach out! Thanks again!

Copy link
Contributor

@MitchellGoodwin MitchellGoodwin left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you for responding to all my feedback. The next step is to get a second approval. I'll ask around to see if I can get someone to take a look.

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

Choose a reason for hiding this comment

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

LGTM with some nits. Thanks a lot for the contribution:)!

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.

Thanks for fixing this bug! LGTM with some small style changes below.

@@ -705,7 +705,18 @@ class _CircularProgressIndicatorState extends State<CircularProgressIndicator> w

Widget _buildCupertinoIndicator(BuildContext context) {
final Color? tickColor = widget.backgroundColor;
return CupertinoActivityIndicator(key: widget.key, color: tickColor);
final double? val = widget.value;
Copy link
Contributor

Choose a reason for hiding this comment

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

val should be value per the styleguide: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#avoid-abbreviations

Or just use the full widget.value directly.

home: const Scaffold(
body: Material(
child: CircularProgressIndicator.adaptive(
value:0.5,
Copy link
Contributor

Choose a reason for hiding this comment

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

Space after the colon here.

Comment on lines 1104 to 1105
final double actualProgress =tester.widget<CupertinoActivityIndicator>(
find.byType(CupertinoActivityIndicator)).progress;
Copy link
Contributor

Choose a reason for hiding this comment

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

      final double actualProgress = tester.widget<CupertinoActivityIndicator>(
        find.byType(CupertinoActivityIndicator),
      ).progress;

@nikkivirtuoso
Copy link
Contributor Author

sir please review my code

@nikkivirtuoso thank you so much for your contribution! But please refrain from pinging your PR, @MitchellGoodwin is in the process of reviewing it and has many things to do, in addition to reviewing this. Our contribution guide says:

If nobody has reviewed your code after a week, then reach out on our Chat channels. The #hackers-new channel is a good place to ask for help if you're a new contributor.

So if it's been more than a week, please reach out! Thanks again!

Thank you for the guidance! I appreciate your consideration and will refrain from further pings. I'll patiently wait for the review and, if needed, will follow up after a week. Thanks for your time and support!

@MitchellGoodwin MitchellGoodwin added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 9, 2024
@auto-submit auto-submit bot merged commit 83cf44e into flutter:master Jan 9, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 10, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jan 10, 2024
flutter/flutter@126302d...b840a60

2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3269fd84460d to b361a60ae224 (1 revision) (flutter/flutter#141271)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from a5d446da5495 to 3269fd84460d (1 revision) (flutter/flutter#141264)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 3ccf66bed335 to a5d446da5495 (2 revisions) (flutter/flutter#141252)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from e57e418c02ae to 3ccf66bed335 (1 revision) (flutter/flutter#141241)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 7e6f3d847e01 to e57e418c02ae (1 revision) (flutter/flutter#141240)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 1cf2e0a603c7 to 7e6f3d847e01 (1 revision) (flutter/flutter#141237)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 32bbf8be8d2c to 1cf2e0a603c7 (1 revision) (flutter/flutter#141232)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 5b9d2132b7cd to 32bbf8be8d2c (1 revision) (flutter/flutter#141229)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 941f268fc8bb to 5b9d2132b7cd (1 revision) (flutter/flutter#141228)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 542fea9edae4 to 941f268fc8bb (3 revisions) (flutter/flutter#141224)
2024-01-10 Michal-MK@users.noreply.github.com `NestedScrollView`'s outer scrollable jumping with `BouncingScrollPhysics` due to `double` precision errors (flutter/flutter#138319)
2024-01-10 engine-flutter-autoroll@skia.org Roll Flutter Engine from 8c1501f3956d to 542fea9edae4 (1 revision) (flutter/flutter#141217)
2024-01-10 polinach@google.com Fix or except leaks. (flutter/flutter#141081)
2024-01-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from 693af0c699c5 to 8c1501f3956d (1 revision) (flutter/flutter#141215)
2024-01-09 cbobbe@zulip.com TextStyle: In copyWith, stop ignoring debugLabel when receiver has none (flutter/flutter#141141)
2024-01-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from a35e3b026e1d to 693af0c699c5 (5 revisions) (flutter/flutter#141209)
2024-01-09 stuartmorgan@google.com Replace deprecated `exists` in podhelper.rb (flutter/flutter#141169)
2024-01-09 kevmoo@users.noreply.github.com Correctly handle null case in ProcessText.queryTextActions (flutter/flutter#141205)
2024-01-09 polinach@google.com Add environment variable to leak tracking bots. (flutter/flutter#141137)
2024-01-09 goderbauer@google.com Reapply "Dynamic view sizing" (#140165) (flutter/flutter#140918)
2024-01-09 89970141+SharbelOkzan@users.noreply.github.com Introduce new Form validation method  (flutter/flutter#135578)
2024-01-09 tessertaha@gmail.com Update `RouteObserver` example and fix an error thrown (flutter/flutter#141166)
2024-01-09 polinach@google.com Upgrade leak_tracker. (flutter/flutter#141153)
2024-01-09 chillers@google.com [ci.yaml] Do not run packaging test on presubmit (flutter/flutter#141192)
2024-01-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from 036b39fa47fa to a35e3b026e1d (6 revisions) (flutter/flutter#141191)
2024-01-09 15619084+vashworth@users.noreply.github.com Run tests on iOS 16 or iOS 17 (flutter/flutter#141178)
2024-01-09 polinach@google.com Remove conditions that depend on order. (flutter/flutter#141183)
2024-01-09 engine-flutter-autoroll@skia.org Roll Flutter Engine from b3c8597df0e2 to 036b39fa47fa (1 revision) (flutter/flutter#141179)
2024-01-09 148634283+nikkivirtuoso@users.noreply.github.com resolved the issue of indeterminate CircularProgressIndicator.adaptive on Darwin  (flutter/flutter#140947)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CircularProgressIndicator.adaptive is always indeterminate on Darwin
5 participants