Bucky
Bucky

Reputation: 1206

How to make Row take full height of its children in Flutter?

I'm trying to create a UI for the contact list. But the row is taking the full height of its parent which is not what I want.

Issue Screenshot

Here's my code

Container(

  padding: EdgeInsets.all(5),

  child: Material(
    color: Colors.black,
    elevation: 5,
    borderRadius: BorderRadius.circular(20),
    child: Container(
      padding: EdgeInsets.all(10),

      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          CircleAvatar(
            backgroundImage: AssetImage("assets/images/1700.jpg"),
            radius: 25,
          ),
          SizedBox(width: 10,),
          Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text("Test", style: TextStyle(color: Colors.white,fontSize: 17, fontWeight: FontWeight.bold),maxLines: 1,),
              SizedBox(height: 5,),
              Text("Testing the test. ", style: TextStyle(color: Colors.white,fontSize: 15),maxLines: 1,)

            ],
          ),
        ],
      ),
    ),
  ),
);

I tried giving MainAxisSize min or max values but the results were unchanged. Is there any flutter alternative for wrap_content or match_parent (similar to native android development)

Need Help ;_;

Upvotes: 1

Views: 369

Answers (1)

Yaya
Yaya

Reputation: 4828

i don't get what you really want but what i got is,
you can wrap it in a column , which is easy way to do that

 child: Column (
     children:[
      Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          CircleAvatar(
            backgroundImage: AssetImage("assets/images/1700.jpg"),
            radius: 25,
          ),
          SizedBox(width: 10,),
          Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text("Test", style: TextStyle(color: Colors.white,fontSize: 17, fontWeight: FontWeight.bold),maxLines: 1,),
              SizedBox(height: 5,),
              Text("Testing the test. ", style: TextStyle(color: Colors.white,fontSize: 15),maxLines: 1,)

            ],
          ),
        ],
      ),
    ]
  )

please tell me the result

Upvotes: 1

Related Questions