I want to create a news widget in the form of a grid with a maximum of 3 elements vertically. You need to make it so that if there are two elements, they stretch equally (something like expanded), and if there is one element, then it fills the remaining space completely (only in width). I will be very happy if you help)
I tried to use a regular gridview.builder, but realized that it was hopeless. I also tried to come up with something with a wrap with a list.builder, but also unsuccessfully
You can try to use the awesome package flutter_staggered_grid_view
Or normally, Use the
Wrap
widget along with a combination ofExpanded
andAlign
widgetsExample of
NewsItemWidget
YourSingleItemWidget
andYourMultiItemWidget
represent the widgets for a single news item and multiple news items, respectively.