Search code examples
flutterflutter-layoutflutter-layoutbuilder

MainAxisSize.SpaceEvenly not giving equal space in the widget


This is the Code

body: Center(
          child: Column(
            children: [
              Row(
                children: [
                  CircleAvatar(
                    backgroundImage: NetworkImage(
                        'https://raw.githubusercontent.com/flutter/website/master/examples/layout/sizing/images/pic1.jpg'),
                    radius: 50,
                  ),
                  SizedBox(
                    width: 30,
                  ),
                  Container(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                      children: [
                        Text('Post'),
                        Text('Followers'),
                        Text('Following')
                      ],
                    ),
                  )
                ],
              ),
            ],
          ),
        ),

enter image description here


Solution

  • Try below code hope its helpful to you,used ListTile widget also refer ListTile here, refer my answer here for same design

     ListTile(
          leading: CircleAvatar(
            backgroundImage: NetworkImage(
              'https://raw.githubusercontent.com/flutter/website/master/examples/layout/sizing/images/pic1.jpg',
            ),
            radius: 50,
          ),
          title: Container(
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: [
                Text('Post'),
                Text('Followers'),
                Text('Following'),
              ],
            ),
          ),
        ),
    

    Your result screen like-> image