How to make Row take full height of its children in Flutter?
251
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
Author by
Bucky
Updated on December 25, 2022Comments
-
Bucky over 1 year
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.
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 forwrap_content
ormatch_parent
(similar to native android development)Need Help ;_;
-
F Perroch over 3 yearsYou can wrap it in a Column to do that :)
-
Bucky over 3 years@FPerroch Demn that was easy. Thank you so much.
-