I am trying to combine the CupertinoRadioChoice with a staggered view with text in the images although it trows an error as soon as I try to scroll the gridview.
class _StartMainPage extends State<MyApp> {
@override
Widget build(BuildContext context) {
var deviceSize = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
//leading: Icon(Icons.menu),
// title: Text('Page title'),
backgroundColor: Color(0xFFFE5E5E5),
actions: <Widget>[
Expanded(
child: CupertinoRadioChoice(
// selectedColor: Color(0xFFFE5E5E5),
notSelectedColor: Color(0xFFFE5E5E5),
choices: {
'Tudo': 'Tudo',
'Apiário': 'Apiário',
'Melaria': 'Melaria',
'UPPs': 'UPPs'
},
onChange: (selectedGender) {},
initialKeyValue: 'Tudo'),
),
],
),
body: LayoutBuilder(builder: (context, constraints) {
return SingleChildScrollView(
child: ConstrainedBox(
constraints: constraints.copyWith(
minHeight: constraints.maxHeight,
maxHeight: double.infinity,
),
child: Column(mainAxisSize: MainAxisSize.min, children: [
SizedBox(
height: 50,
),
Container(
height: 500,
child: StaggeredGridView.countBuilder(
crossAxisCount: 4,
itemBuilder: (BuildContext context, int index) {
return Container(
color: Colors.green,
child: Center(
child: CircleAvatar(
backgroundColor: Colors.white,
child: Text('$index'),
),
),
);
},
staggeredTileBuilder: (int index) {
return StaggeredTile.count(2, index.isEven ? 2 : 1);
},
mainAxisSpacing: 4.0,
crossAxisSpacing: 4.0,
),
),
]),
),
);
}));
}
}
I tried with a normal gridview and it sort of works although I wanted to have different height in the tiles.
Thanks for any help
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…