Я много пробовал, но не могу изменить высоту AlertDialog, когда использую Slider. Я видел здесь, на форуме, предложение использовать ConstrainedBox. Не сработало. Есть ли лучший способ показать слайдер?
@override
Widget build(BuildContext context) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: 100.0),
child: AlertDialog(
title: Text('Selecione a velocidade'),
content: Container(
child: Slider(
value: _fontSize,
label: _fontSize.round().toString(),
min: 20,
max: 200,
divisions: 18,
onChanged: (value) {
setState(() {
_fontSize = value;
});
},
),
),
actions: <Widget>[
FlatButton(
onPressed: () {
print('cancelar');
// Use the second argument of Navigator.pop(...) to pass
// back a result to the page that opened the dialog
Navigator.pop(context, _fontSize);
},
child: Text('Cancelar'),
),
FlatButton(
onPressed: () {
print('salvar');
// Use the second argument of Navigator.pop(...) to pass
// back a result to the page that opened the dialog
Navigator.pop(context, _fontSize);
},
child: Text('Salvar'),
),
FlatButton(
onPressed: () {
print('aplicar');
// Use the second argument of Navigator.pop(...) to pass
// back a result to the page that opened the dialog
Navigator.pop(context, _fontSize);
},
child: Text('Aplicar'),
),
],
),
);
}
Я приложил изображение, показывающее, как выглядит AlertDialog.
