Reputation: 4555
How to show dynamic list on card widget like below image?
This dynamic list, want to show :
The piece of code:
Card(
elevation: 5,
child: Padding(
padding: const EdgeInsets.only(top:8.0, left: 8,right:8),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
......
Flexible(
child: ListView.builder(
shrinkWrap: true,
itemCount: sample.length,
itemBuilder: (context, index){
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//data
......
Divider(color: Colors.black,),
],
);
}
),
)
],
),
)
)
but showing blank with exception.
Upvotes: 2
Views: 3160
Reputation: 10665
Code is a bit long so here is the GitHub repository:
https://github.com/TheKetan2/stackoverflow_answers/blob/master/lib/card_list_example.dart
Output:
Upvotes: 2
Reputation: 3232
With your example shows, I think the only problem is crossAxisAlignment
.
Please have a test with CrossAxisAlignment.stretch
.
Or please post your whole code or exception to find the exact cause.
Upvotes: 0