-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Add CupertinoLinearActivityIndicator
#170108
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
Add CupertinoLinearActivityIndicator
#170108
Conversation
a8baca1 to
15ee6a9
Compare
victorsanni
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.
Thanks for this PR. Can you attach images comparing to native as well as a description of the native APIs for similar behaviors? For a design review.
| @override | ||
| void paint(Canvas canvas, Size size) { | ||
| // Draw the background of the progress bar. | ||
| canvas.drawRRect( |
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'm wondering if the native version is a rounded rect or a rounded superellipse (squircle). Can you attach images to the PR description comparing the native version?
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've tried to look at https://developer.apple.com/design/human-interface-guidelines/progress-indicators
and from the photo
it looks like rounded rect? But again, I half guessing here
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 native photo attached has less-rounded corners on the edges than the flutter photo attached. But the actual blue line has the same rounding (I think) in both.
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.
It's true on the picture it looks like the container has less rounded corners.
However, if I look at https://developer.apple.com/design/human-interface-guidelines/progress-indicators
it looks like the background AND the blue line are having a stadium shape, which is like the current implementation
Having said that, what would you prefer me to do?
I can replace the current native image attached to the PR description with the ones from https://developer.apple.com/design/human-interface-guidelines/progress-indicators
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.
Can you attach images from a running native iOS app? The goal is to match live widgets, not HIG website photos.
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.
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.
Sounds good. If the native app is stadium-shaped then it should be stadium-shaped.
|
@victorsanni I have attached the picture from the issue in the description. I might need a bit of assistance to provide what you need from me, as I'm not very familiar with Cupertino and Apple specs/environment. For context, I saw the issue #156167 and noticed that the PR to fix it #156287 was closed due to a lack of tests. So, I've added those tests. I'm not saying I'm unwilling to apply your suggestion; I just need you to be extra explicit because I might not fully understand everything. |
15ee6a9 to
022699e
Compare
|
Thank you for the feedbacks. I improved the documentation in Improve documentation |
victorsanni
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.
LGTM pending reviews from others.
victorsanni
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.
Hi @ValentinVignal,
Looking through this again I realized there is already a Material widget with similar behavior: LinearProgressIndicator. Is there an opportunity here to share logic already in that widget?
|
@victorsanni, looking at
What do you think? |
|
Imo, we could move the majority of
I personally like option 2 a bit better. Important to point out that this PR uses "progress" where Material uses "value". We don't want that API drift. For the painter, moving that down sounds like a good idea to me as well, but it looks like it needs to have generic, or possibly empty curve defaults. |
Why can't |
That's valid too, they just would both override to the same value it looks like. But overriding getValueColor twice would be less code than making a new class so that's probably better. |
|
Right now |
And |
|
Hi! @ValentinVignal Are you able to address the comments above so we can work together to get this landed? This is a great addition and I'm looking forward to it! |
|
@dkwingsmt yes I'd be happy to resume it. However, @victorsanni asked a question to @MitchellGoodwin here. Or it was a bit unclear to me everyone agreed on the solution |
|
Hey @ValentinVignal, feel free to go ahead with implementing option 2 in #170108 (comment). Basically we want to share as much code as possible between material and cupertino. |
8c7c1a0 to
10d8be4
Compare
|
@victorsanni @MitchellGoodwin I did my best, and I created
|
| /// If null, this progress indicator is indeterminate, which means the | ||
| /// indicator displays a predetermined animation that does not indicate how | ||
| /// much actual progress is being made. | ||
| final double? value; |
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 part is not true for Cupertino
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.
Sorry to belabor this, but can you explain why this is not true for cupertino again?
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.
value is never null for CupertinoActivityIndicator.
For the animated/indeterminate version, value = 1. This value is used to calculate the number of "ticks" to display:
Here is a video, which I think makes it clearer:
Screen.Recording.2025-08-23.at.1.53.27.PM.mov
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.
IMO I think this is fine as long as the cupertino indicators call out that they are never null.
6495ef5 to
3da3163
Compare
|
Is it ready for another round of review? (from triage) |
|
@dkwingsmt yes it is read to get another round of review :) @victorsanni also had an open question here : #170108 (comment) |
Roll Flutter from 8f94cb0d8f01 to 9ff2767f3cb6 (56 revisions) flutter/flutter@8f94cb0...9ff2767 2025-09-20 [email protected] Roll Fuchsia Linux SDK from 0_jKqLGnkILvQ5C8a... to CcCe3HpQtBYhTZscb... (flutter/flutter#175698) 2025-09-20 [email protected] Roll Dart SDK from e6e9248aee4f to 9e943fe076c8 (1 revision) (flutter/flutter#175697) 2025-09-20 [email protected] Add `menuController` to `DropdownMenu` (flutter/flutter#175039) 2025-09-20 [email protected] Roll Skia from 1dae085e2f31 to a38a531dec1d (3 revisions) (flutter/flutter#175694) 2025-09-20 [email protected] [a11y] TimePicker clock is unnecessarily announced (flutter/flutter#175570) 2025-09-20 [email protected] Roll Dart SDK from 78e68d1a7dbf to e6e9248aee4f (4 revisions) (flutter/flutter#175690) 2025-09-19 [email protected] Roll Skia from b56003bf2c20 to 1dae085e2f31 (1 revision) (flutter/flutter#175674) 2025-09-19 [email protected] Update `CODEOWNERS` (for dev-tooling) (flutter/flutter#175201) 2025-09-19 [email protected] [a11y-app] Add label to TextFormField in AutoCompleteUseCase. (flutter/flutter#175576) 2025-09-19 [email protected] Fix RadioGroup single selection check. (flutter/flutter#175654) 2025-09-19 [email protected] Roll Packages from f2a65fd to 3d5c419 (2 revisions) (flutter/flutter#175668) 2025-09-19 [email protected] Roll Skia from c74d2bdbd93c to b56003bf2c20 (2 revisions) (flutter/flutter#175665) 2025-09-19 [email protected] Add `CupertinoLinearActivityIndicator` (flutter/flutter#170108) 2025-09-19 [email protected] [ Widget Preview ] Don't update filtered preview set when selecting non-source files (flutter/flutter#175596) 2025-09-19 [email protected] Roll Dart SDK from 2c79803c97db to 78e68d1a7dbf (3 revisions) (flutter/flutter#175646) 2025-09-19 [email protected] Delete unused web_unicode library (flutter/flutter#174896) 2025-09-19 [email protected] Roll Skia from 684f3a831216 to c74d2bdbd93c (2 revisions) (flutter/flutter#175644) 2025-09-19 [email protected] Roll Skia from 462bdece17bf to 684f3a831216 (3 revisions) (flutter/flutter#175641) 2025-09-19 [email protected] Roll Skia from a2c38aa9df80 to 462bdece17bf (11 revisions) (flutter/flutter#175629) 2025-09-18 [email protected] fix(tool): Use merge-base for content hash in detached HEAD (flutter/flutter#175554) 2025-09-18 [email protected] [web] Unskip Cupertino datepicker golden tests in Skwasm (flutter/flutter#174666) 2025-09-18 [email protected] Update rules to include extension rules (flutter/flutter#175618) 2025-09-18 [email protected] [engine] Cleanup Fuchsia FDIO library dependencies (flutter/flutter#174847) 2025-09-18 [email protected] Make sure that a CloseButton doesn't crash in 0x0 environment (flutter/flutter#172902) 2025-09-18 [email protected] [ Tool ] Serve DevTools from DDS, remove ResidentDevToolsHandler (flutter/flutter#174580) 2025-09-18 [email protected] [engine][fuchsia] Update to Fuchsia API level 28 and roll latest GN SDK (flutter/flutter#175425) 2025-09-18 [email protected] Added a 36 device for Firebase Lab Testing (flutter/flutter#175613) 2025-09-18 [email protected] Roll Dart SDK from 09a101793af4 to 2c79803c97db (2 revisions) (flutter/flutter#175608) 2025-09-18 [email protected] Engine Support for Dynamic View Resizing (flutter/flutter#173610) 2025-09-18 [email protected] Roll Packages from fdee698 to f2a65fd (3 revisions) (flutter/flutter#175594) 2025-09-18 [email protected] Connect the FlutterEngine to the FlutterSceneDelegate (flutter/flutter#174910) 2025-09-18 [email protected] Roll Dart SDK from de5dd0f1530f to 09a101793af4 (2 revisions) (flutter/flutter#175583) 2025-09-18 [email protected] Roll Skia from 7b9fe91446ee to a2c38aa9df80 (1 revision) (flutter/flutter#175579) 2025-09-18 [email protected] Roll Skia from ab1b10547461 to 7b9fe91446ee (4 revisions) (flutter/flutter#175569) 2025-09-18 [email protected] [a11y-app] Fix form field label and error message (flutter/flutter#174831) 2025-09-18 [email protected] Fix InputDecoration does not apply errorStyle to error (flutter/flutter#174787) 2025-09-18 [email protected] Migrate to `WidgetPropertyResolver` (flutter/flutter#175397) 2025-09-18 [email protected] Migrate to WidgetState (flutter/flutter#175396) 2025-09-18 [email protected] Roll Skia from 79ec8dfcd9d4 to ab1b10547461 (17 revisions) (flutter/flutter#175561) 2025-09-18 [email protected] Removes NOTICES from licenses input (flutter/flutter#174967) 2025-09-18 [email protected] Roll Dart SDK from 116f7fe72839 to de5dd0f1530f (2 revisions) (flutter/flutter#175557) 2025-09-17 [email protected] [reland][web] Refactor renderers to use the same frontend code #174588 (flutter/flutter#175392) 2025-09-17 [email protected] feat: Enable WidgetStateColor to be used in ChipThemeData.deleteIconColor (flutter/flutter#171646) 2025-09-17 [email protected] Filter out unexpected process logs on iOS with better regex matching. (flutter/flutter#175452) 2025-09-17 [email protected] CupertinoContextMenu child respects available screen width (flutter/flutter#175300) 2025-09-17 [email protected] Correct documentation in PredictiveBackFullscreenPageTransitionsBuilder (flutter/flutter#174362) ...
Fixes flutter#156167 Continuation of flutter#156287 <img width="712" alt="Screenshot 2025-06-06 at 10 00 32 AM" src="https://github.com/user-attachments/assets/d878287f-8236-4acf-80a5-6ecb6d2a09ec" /> Native version:  --- Following team discussions, we've decided to adopt the stadium shape: flutter#170108 (comment) flutter#170108 (comment) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Fixes flutter#156167 Continuation of flutter#156287 <img width="712" alt="Screenshot 2025-06-06 at 10 00 32 AM" src="https://github.com/user-attachments/assets/d878287f-8236-4acf-80a5-6ecb6d2a09ec" /> Native version:  --- Following team discussions, we've decided to adopt the stadium shape: flutter#170108 (comment) flutter#170108 (comment) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Fixes flutter#156167 Continuation of flutter#156287 <img width="712" alt="Screenshot 2025-06-06 at 10 00 32 AM" src="https://github.com/user-attachments/assets/d878287f-8236-4acf-80a5-6ecb6d2a09ec" /> Native version:  --- Following team discussions, we've decided to adopt the stadium shape: flutter#170108 (comment) flutter#170108 (comment) ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md





Fixes #156167
Continuation of #156287
Native version:
Following team discussions, we've decided to adopt the stadium shape:
#170108 (comment)
#170108 (comment)
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.