问题
I am making an ipad in flutter. I have a date picker. But in landscape it is showing pretty big.
Is there any way to resize the date picker dialog
回答1:
Yes, you can resize date picker dialog by Container(), SizedBox() etc. using it in builder, but only if you put it in something like Column(), for example:
return showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime.now(),
lastDate: DateTime.now().add(Duration(days: 356)),
builder: (context, child) {
return Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 50.0),
child: Container(
height: 450,
width: 700,
child: child,
),
),
],
);
},
);
回答2:
With newer flutter version date picker is smaller and no longer takes up most of the screen
https://github.com/flutter/flutter/pull/50546
来源:https://stackoverflow.com/questions/59324174/size-of-the-date-picker-in-flutter