Skip to content

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ValentinVignal
Copy link
Contributor

@ValentinVignal ValentinVignal commented Jun 6, 2025

Fixes #156167

Continuation of #156287

Screenshot 2025-06-06 at 10 00 32 AM

Native version:

image

Pre-launch Checklist

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

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: cupertino flutter/packages/flutter/cupertino repository d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos labels Jun 6, 2025
@ValentinVignal ValentinVignal force-pushed the flutter/add-cupertino-linear-activity-indicator branch from a8baca1 to 15ee6a9 Compare June 6, 2025 03:17
@victorsanni victorsanni self-requested a review June 9, 2025 20:36
Copy link
Contributor

@victorsanni victorsanni 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 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(
Copy link
Contributor

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?

Copy link
Contributor Author

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

image

it looks like rounded rect? But again, I half guessing here

Copy link
Contributor

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.

Copy link
Contributor Author

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

image

image

it looks like the background AND the blue line are having a stadium shape, which is like the current implementation

image


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

Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough, I create a straightforward macOS app:

Screenshot 2025-06-14 at 7 53 00 PM

It looks like a stadium shape to me. What do you think?

@ValentinVignal
Copy link
Contributor Author

@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.

@ValentinVignal ValentinVignal force-pushed the flutter/add-cupertino-linear-activity-indicator branch from 15ee6a9 to 022699e Compare June 13, 2025 17:43
/// {@end-tool}
///
/// See also:
///
Copy link
Contributor

Choose a reason for hiding this comment

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

Add the circular progress indicator to the 'See also" section, just before the HIG link.

Copy link
Contributor

Choose a reason for hiding this comment

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

And also add this to the 'See also' section of the circular progress indicator.

required this.progress,
this.height = 4.5,
this.color,
super.key,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be the first argument in the constructor.

/// The color of the progress bar.
///
/// Defaults to [CupertinoColors.activeBlue] if no color is specified. This
/// color represents the portion of the bar that indicates progress.
Copy link
Contributor

Choose a reason for hiding this comment

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

This sentence should be in a paragraph before the default line.

/// The current progress of the linear activity indicator.
///
/// This value must be between zero and one. A value of 0.0 means no progress
/// and 1.0 means that progress is complete. The value will be clamped to be
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it clamped if it asserts? Don't think this line is necessary.


/// The current progress of the linear activity indicator.
///
/// This value must be between zero and one. A value of 0.0 means no progress
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// This value must be between zero and one. A value of 0.0 means no progress
/// This value must be between 0.0 and 1.0. A value of 0.0 means no progress

Be explicit.


/// The height of the line used to draw the linear activity indicator.
///
/// The default height is 4.5 units. Must be positive.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// The default height is 4.5 units. Must be positive.
/// Defaults to 4.5 units. Must be positive.

Removes redundancy.

@ValentinVignal
Copy link
Contributor Author

Thank you for the feedbacks. I improved the documentation in Improve documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos f: cupertino flutter/packages/flutter/cupertino repository framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Cupertino] Support Linear Progress View style
2 participants