Skip to content

Commit

Permalink
Removed platform-specific logic from the example app.
Browse files Browse the repository at this point in the history
Now that we have multi-day all-day events on both platforms (see builttoroam#450), handling the platforms differently is no longer necessary.
  • Loading branch information
IVLIVS-III authored Nov 2, 2022
1 parent 05c3821 commit 21f4807
Showing 1 changed file with 31 additions and 34 deletions.
65 changes: 31 additions & 34 deletions example/lib/presentation/pages/calendar_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -332,41 +332,38 @@ class _CalendarEventPageState extends State<CalendarEventPage> {
},
),
),
// Only add the 'To' Date for non-allDay events on all
// platforms except Android (which allows multiple-day allDay events)
if (_event?.allDay == false || Platform.isAndroid)
Padding(
padding: const EdgeInsets.all(10.0),
child: DateTimePicker(
labelText: 'To',
selectedDate: _endDate,
selectedTime: _endTime,
enableTime: _event?.allDay == false,
selectDate: (DateTime date) {
setState(
() {
var currentLocation =
timeZoneDatabase.locations[_timezone];
if (currentLocation != null) {
_endDate =
TZDateTime.from(date, currentLocation);
_event?.end = _combineDateWithTime(
_endDate, _endTime);
}
},
);
},
selectTime: (TimeOfDay time) {
setState(
() {
_endTime = time;
_event?.end =
_combineDateWithTime(_endDate, _endTime);
},
);
},
),
Padding(
padding: const EdgeInsets.all(10.0),
child: DateTimePicker(
labelText: 'To',
selectedDate: _endDate,
selectedTime: _endTime,
enableTime: _event?.allDay == false,
selectDate: (DateTime date) {
setState(
() {
var currentLocation =
timeZoneDatabase.locations[_timezone];
if (currentLocation != null) {
_endDate =
TZDateTime.from(date, currentLocation);
_event?.end = _combineDateWithTime(
_endDate, _endTime);
}
},
);
},
selectTime: (TimeOfDay time) {
setState(
() {
_endTime = time;
_event?.end =
_combineDateWithTime(_endDate, _endTime);
},
);
},
),
),
if (_event?.allDay == false && Platform.isAndroid)
Padding(
padding: const EdgeInsets.all(10.0),
Expand Down

0 comments on commit 21f4807

Please sign in to comment.