List fu = [
'Packing & Unpacking',
'Cleaning',
'Painting',
'Heavy Lifting',
'Shopping',
'Watching Netflix',
'sadfdsfe eaf',
'ewfsfeagga,' 'gegea',
'gaegaewgv ewaggaa aweegaage',
'safa asdfesadfv esfsdf',
'sadfdsfe eaf',
'ewfsfeagga,' 'gegea',
'awfgraga wsg sfage aegea',
'gaegaewgv ewaggaa aweegaage',
'asdfehtrbfawefa garevaa aewf a'
];
Widget build(BuildContext context) {
return Container(
height: 120,
margin: EdgeInsets.symmetric(horizontal: 3.5.w, vertical: 0.8.h),
child: StaggeredGridView.countBuilder(
crossAxisCount: 2,
staggeredTileBuilder: (index) => const StaggeredTile.fit(1),
shrinkWrap: true,
controller: _controller,
scrollDirection: Axis.horizontal,
// crossAxisSpacing: 0,
mainAxisSpacing: 8,
itemBuilder: (ctx, index) {
return Container(
padding: const EdgeInsets.all(15),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15)),
child: Text(
fu[index],
maxLines: 1,
),
);
},
itemCount: fu.length,
),
);
}
StaggeredTile.fit(1) didn't work when staggeredGridiew is horizontal.
I also tried using Wrap but I didn't get expected outcome.
Wrap( direction: Axis.vertical, children: fu .map((title) => Container( decoration: BoxDecoration( color: ConstColors.kWhite, borderRadius: BorderRadius.circular(15)), margin: EdgeInsets.all(8), padding: const EdgeInsets.all(8), child: Row( children: [ Text(title), ], ), )) .toList(), )
The result has extra space between containers. It would be great id there was a way to get horizontal container back to back



