koukibadr / Bottom-Picker

https://pub.dev/packages/bottom_picker
MIT License
34 stars 22 forks source link

LateInitializationError occurs when the submit button is pressed without changing the date in the date range selection. #59

Closed ahmtydn closed 1 year ago

ahmtydn commented 1 year ago

void _datePicker(BuildContext context) { BottomPicker.range( title: 'Select Date', titleStyle: const TextStyle( fontWeight: FontWeight.bold, fontSize: 15, color: Colors.black, ), buttonSingleColor: Colors.black, dismissable: true, initialFirstDate: _startDate, initialSecondDate: _endDate, onSubmitPressed: (startDate, endDate) { print(startDate); print(endDate); }, ).show(context); }

` LateInitializationError: Field 'selectedFirstDateTime' has not been initialized.

When the exception was thrown, this was the stack:

0 _BottomPickerState.selectedFirstDateTime (package:bottom_picker/bottom_picker.dart)

1 _BottomPickerState.build. (package:bottom_picker/bottom_picker.dart:565:29)

2 BottomPickerButton.build. (package:bottom_picker/widgets/bottom_picker_button.dart:32:17)

`

koukibadr commented 1 year ago

@ahmtydn a new version is published fixing this bug https://pub.dev/packages/bottom_picker