0

Im current using flutter web 1.12.14

Im trying to use a datepicker and its work good, but the dialog is showing in all screen, as this way

enter image description here

Is there any way to limit the height of the dialog?

1 Answer 1

2

To limit the size of the date pickers we can use builder parameter:

      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.date_range),
        onPressed: () async {
          final choice = await showDatePicker(
              context: context,
              firstDate: DateTime(2010),
              lastDate: DateTime(2030),
              initialDate: DateTime.now(),
              builder: (BuildContext context, Widget child) {
                return Center(
                    child: SizedBox(
                  width: 400.0,
                  height: 500.0,
                  child: child,
                ));
              });
          print(choice);
        },
      )

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.