Home > Net >  How to resize image in dart flutter padding?
How to resize image in dart flutter padding?

Time:02-19

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.

enter image description here

CodePudding user response:

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

  • Related