dylanwuzh / flutter-cupertino-date-picker

Flutter cupertino style date picker.
Apache License 2.0
363 stars 416 forks source link

How to remove 'Cancel' button completely from title bar? #99

Open cihanfiliz opened 4 years ago

GProDev commented 4 years ago

This is an important issue. An option to show/hide Done and Cancel button is necessary.

GProDev commented 4 years ago

Actually you can set your own widgets for the Cancel and Done buttons. For that use properties cancel and confirm of the DatePickerWidget. Tout make the Cancel and Done buttons disappear, just pass an empty widgets for these properties.

cihanfiliz commented 4 years ago

Thanks for comments. When I insert my own widget instead of the cancel button, the cancel text does not disappear and still take a place at the same position i think. Have you tried that? Does the cancel text disappear?

GProDev commented 4 years ago

@cihanfiliz Sorry for my late answer, I have been held by other projects. Here is how to make Cancel and Done buttons desappear : `

  DatePickerWidget(
    pickerTheme: DateTimePickerTheme(
      cancel: SizedBox(height: 1),
      confirm: SizedBox(height: 1),
    ),
    dateFormat: 'dd-MM-yyyy',
    initialDateTime: _time,
    onChange: (time, values) {
      _time = time;
    },
  ),`