How to dynamic list on Card in flutter?
2,019
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:
Author by
Shruti Ramnandan Sharma
I'm an Indian developer for building mobile applications with flutter. linkedin-profile
Updated on December 21, 2022Comments
-
Shruti Ramnandan Sharma over 1 year
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.
-
Shruti Ramnandan Sharma almost 4 yearsOh nice, but one more thing that want to say, these cards are also as dynamic list. can you please set the cards in listviewBuilder.
-
Ketan Ramteke almost 4 yearsAre you saying all the data shown in list should be in Card widget?
-
Shruti Ramnandan Sharma almost 4 yearsNo, I mean, this is one card that you have built & that is perfect but, want to no of same cards in listview.
-
Shruti Ramnandan Sharma almost 4 yearsIn simple word, wrap this card in ListView.Builder()
-
Ketan Ramteke almost 4 yearsLike this: im6.ezgif.com/tmp/ezgif-6-afc4d402dd61.gif
-
Shruti Ramnandan Sharma almost 4 yearsSure, But first i'll check.By the way thank you so much
-
Ketan Ramteke almost 4 yearsWelcome. Happy Coding.
-
Ketan Ramteke almost 4 yearsLet us continue this discussion in chat.