I’m trying to make a menu for a reastaurant like this one : –
I’m using Flutter and this is my code:
return Column(
mainAxisSize: MainAxisSize.min,
children: [
ListTile(
title: Row(
children: [
Expanded(child: Text( text, style: style, )),
const SizedBox( width: 15 ),
Text( '$ $price', style: style,),
],
),
),
Divider( color: Colors.white.withOpacity( 0.5 ),),
],
);
But this is the result that I’m getting : –
Please, any help will be welcome.
And thanks in advance.
3
Answers
@Ramji, @Dhruvil Patel, I try your code and it work fine, but it was making an overflow when the text was long, so I made some changes in your example and I got what I was looking for. Thanks a lot for you help. Here is what I dit.
I solved your issue like this:
Output of your issue : –
The result that you want to achieve can be done just by using the row widget, you don’t have to wrap it up with ListTile. I am writing the code snippet of Row widget for you. You can copy paste it and it will work. Additionally I see that you are generating it in the column widget. If you have a dynamic array then I suggest that you use ListView Divider instead. It will have a divider to add between your rows as well. You can find more about it on flutter official documentation.
Just replace your column’s children with this row and you will be able to see it.