5

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 dialogenter image description here

2 Answers2

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,
          ),
        ),
      ],
    );
  },
);
  • 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

https://github.com/flutter/flutter/pull/50546

Adelina
  • 10,915
  • 1
  • 38
  • 46