Skip to content

Document SweepGradient startAngle and endAngle #166206

Closed

Description

@makoConstruct

Use case

I'm trying to use SweepGradient

Proposal

As noted previously #23648 SweepGradient's startAngle and endAngle parameters are not well named. Even after reading that issue and experimenting with them, I still don't know exactly how they're supposed to work. With experimentation, I was able to get startAngle and endAngle to do something by setting them to pi/2 and tau-pi/2 (that made it look like the "mirrored" example, but any angle smaller than that seemed to do nothing.

The documentation makes it sound like they're just what you'd expect them to be given their names,

Creates a sweep gradient centered at center that starts at startAngle and ends at endAngle.

startAngle and endAngle should be provided in radians, with zero radians being the horizontal line to the right of the center and with positive angles going clockwise around the center.

but as discussed, there's more to know.

The documentation later says

The behavior before startAngle and after endAngle is described by the tileMode argument. For details, see the TileMode enum.

But startAngle and endAngle are actually not mentioned in the TileMode page.

Activity

  1. added
    in triagePresently being triaged by the triage team
    frameworkflutter/packages/flutter repository. See also f: labels.
    d: api docsIssues with https://api.flutter.dev/
    and removed
    in triagePresently being triaged by the triage team
    on Mar 31, 2025
  2. abhinavs1920 commented on Jul 19, 2025

    @abhinavs1920

    Hey everyone, after digging into this, the core confusion is that startAngle/endAngle act as color stops, not a clipping path for the arc.

    The most effective solution is to combine TileMode.decal with the stops parameter to define the visible portion of the gradient. To position the starting point correctly, like at 12 o'clock, you then just need to add a GradientRotation transform.

    I think adding a simple, practical example of this to the documentation would clear this up for good. I'm happy to put together a PR for the doc update if the maintainers agrees. :)

    @makoConstruct @Piinks @danagbemava-nc

  3. SalehTZ commented on Jul 19, 2025

    @SalehTZ
    Contributor

    Hey there beautiful people, I'm not 100% sure if my fix will be good enough but here it goes.

  4. added 2 commits that reference this issue on Jul 19, 2025
    d789b94
    8c89506
  5. added a commit that references this issue on Aug 16, 2025
    0a2906b
  6. added a commit that references this issue on Aug 19, 2025
    7d86fb3
  7. added 2 commits that reference this issue on Aug 22, 2025
    e9a7372
    af85c6a
  8. github-actions commented on Sep 1, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Sep 1, 2025
  10. added a commit that references this issue on Sep 18, 2025
    b96c473
  11. added a commit that references this issue on Sep 22, 2025
    ce304ba
  12. added a commit that references this issue on Nov 21, 2025
    ac10eec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions