-1
Hello! I’m wanting to use this control to replace the Dropdown, but I realized that its width command 'does not work', maybe by the context external to it, I didn’t get it right. Because I want to actually make dynamic with double value that I have already prepared, but even putting in the fixed value there 200.0 does not obey:
Flutter code:
SizedBox(
height: 34.0,
child: GridView(
padding: EdgeInsets.symmetric(vertical: 4.0),
scrollDirection: Axis.horizontal,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 1,
mainAxisSpacing: 8.0,
childAspectRatio: 0.5),
children: todostimes.times.map((s) {
return GestureDetector(
onTap: () {
setState(() {
_timeSelecionado = s;
});
},
child: Align(
alignment: Alignment.topCenter,
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
border: Border.all(
color: s == _timeSelecionado
? Colors.deepPurple
: Colors.grey[400],
width: 2.0)
),
width: 200.0, //valor fixo
//convertDouble(s['TimeNome'].toString()) ,
padding: EdgeInsets.all(2.0),
child: Text(s['TimeNome'],
style: new TextStyle(
fontSize: 15.0,
)
),
),
));
}).toList(),
),
)
Github): https://github.com/danielgmrs/flutter_estudos/blob/master/disparar.dart
Provide complete executable code so we can test/run your problem. Facilitates analysis.
– Julio Henrique Bitencourt
Complete code: https://github.com/danielgmrs/flutter_estudos/blob/master/disparar.dart
– Daniel Mota