Skip to content

CircleAvatar doesn't clip child #4964

Closed

Description

@dragostis

If we want to use CircleAvatar to represent user accounts with profile pictures, we need to have a way to clip images passed to CircleAvatar as a child. Right now, it does no clipping so you would need to passed a clipped image inside.

Activity

  1. HansMuller commented on Jul 19, 2016

    @HansMuller
    Contributor

    Clipping the child isn't efficient and currently we don't antialias the circular clip. I think that a better option would be to give CircleAvatar a backgroundImage attribute which would just be passed along to the BoxDecoration that's already being created. The backgroundImage will be rendered correctly vis the backgroundColor and the child and it will be rendered efficiently.

    The docs for CircleAvatar should mention that if an arbitrary widget child is specified, rather than a Text(singleInitialCharacter), you'll want to wrap it with ClipOval if it's possible that it will overflow.

  2. dragostis commented on Jul 19, 2016

    @dragostis
    ContributorAuthor

    That makes sense, but are profile pictures already circles on Android for example? If not, ClipOval might be necessary for all profile pictures, so it might be a good idea to have an easy way to just use them without worrying about making them circles.

  3. abarth commented on Jul 19, 2016

    @abarth
    Contributor

    A backgroundImage with shape of BoxCircle will be a circle. It's just a more efficient way to clip the image.

  4. added a commit that references this issue on May 14, 2018
  5. github-actions commented on Sep 6, 2021

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

  6. locked as resolved and limited conversation to collaborators on Sep 6, 2021
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

    c: new featureNothing broken; request for a new capabilityp: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions