Search code examples
androidflutterflutter-layoutflutter-dependenciesflutter-packages

How to reduce the radius of the avatar generated using auro_avatar flutter package?


I have used auro_avatar 0.1.1 for generating avatar from User FullName but I am not able to reduce the size of the circle avatar. I want to put this on AppBar.

new InitialNameAvatar(
    'Rahul Kumar',
    circleAvatar: true,
    borderColor: Colors.grey,
    borderSize: 1.0,
    backgroundColor: Colors.blue,
    foregroundColor: Colors.white,
    padding: 2.0,
    textSize: 5.0,
),

It is not working even when I reduced padding. Please Help


Solution

  • hey you can wrap InitialNameAvatar by Container widget, then you can add width and height. I tried this and it works.

      Container(
                width: 35.0,
                height: 35.0,
                child: InitialNameAvatar(
                  name,
                  circleAvatar: true,
                  borderSize: 2.0,
                  backgroundColor: Colors.blue,
                  foregroundColor: Colors.white,
                  padding: 5.0,
                  textSize: 15.0,
                ),
              ),