Size of the Date Picker in Flutter

白昼怎懂夜的黑 提交于 2020-05-13 08:52:45

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!