Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to resize image in dart flutter padding?

I’m trying to make the upper part of a bank application. At the top is the person’s photo and name-surname.

Code:

import 'package:flutter/material.dart';


class bankaArayuzUygulamasi extends StatelessWidget {
  const bankaArayuzUygulamasi({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
          padding: EdgeInsets.all(0),
          child: Container(
            height: 200,
            width: double.infinity,
            decoration: BoxDecoration(
              color: Colors.blue,
            ),  

            child: Row(
              crossAxisAlignment: CrossAxisAlignment.center,

              children: [
                Padding(
                  padding: EdgeInsets.only(left: 20, right: 20),
                  
                  child: CircleAvatar(
                    backgroundImage: NetworkImage("https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200"),
                    radius: 45,
                    
                  ),
                ),

                Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    
                    Text("Ahmet Yılmaz", style: TextStyle(fontSize: 25)),
                    Text("das")
                  ],
                )
              ],
            ),
          ),
        ),
      ],
    );
  }
}

I want to change the size of CircleAvatar in padding. How can I do it? The image inside the CircleAvatar looks a bit small. That’s why I want to enlarge.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

wrap the CircleAvatar with SizedBox like this :

      Padding(
                    padding: EdgeInsets.only(left: 20, right: 20),
                    child: SizedBox(
                      width: 170,
                      height: 170,
                      child: CircleAvatar(
                        backgroundImage: NetworkImage("https://www.gravatar.com/avatar/205e460b479e2e5b48aec07710c08d50?s=200"),
                        radius: 45,

                      ),
                    ),
                  )

The result:

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading