I am making an ipad in flutter. I have a date picker. But in landscape it is showing pretty big.
Asked
Active
Viewed 8,458 times
5
-
I think this can be helpful https://stackoverflow.com/questions/50321182/how-to-customize-a-date-picker – Ruben Martirosyan Dec 13 '19 at 14:51
-
It only modifies the theme. I was hoping to change the size as well – Debanjan Chakraborty Dec 16 '19 at 05:19
-
But it's using ThemData which contains size controls: width and height. As shown here: https://api.flutter.dev/flutter/material/ThemeData-class.html. At the moment I can't test that, but I think It may help. – Ruben Martirosyan Dec 16 '19 at 06:32
-
https://api.flutter.dev/flutter/material/ThemeData/ThemeData.html . There is no height factor or any size factor. I think you mistook the container's height width as the size factors – Debanjan Chakraborty Dec 16 '19 at 06:38
-
Oh, yeah, sorry, that was container's height/width – Ruben Martirosyan Dec 16 '19 at 07:40
2 Answers
13
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,
),
),
],
);
},
);

Dmitry Shiryhalov
- 301
- 2
- 4
-
Interesting. So I tried this exact same approach initially, but without the Column(). Ugh, that's a trick I guess I'll learn to keep in mind. Those only work when in a parent that uses them? That's pretty confusing until you realize it. – Eradicatore Mar 16 '20 at 18:05
0
With newer flutter version date picker is smaller and no longer takes up most of the screen

Adelina
- 10,915
- 1
- 38
- 46