Conversation
jwr1
left a comment
There was a problem hiding this comment.
Sorry for taking so long to review; I've been busy this semester. Anyway, it looks pretty good!
| ); | ||
| onSelect(pickedDate); | ||
| }, | ||
| child: Text(date != null ? dateOnlyFormat(date) : 'Unset'), |
There was a problem hiding this comment.
A localized string is needed here.
Actually, if both _startDate and _endDate are initialized to Date.now(), is date here even ever equal to null?
| "eventMode_invite": "Invite", | ||
| "eventOnline": "Online Event", | ||
| "eventAddEnd": "Add end date", | ||
| "eventError_start": "The start date/time is required to be after the current date/time.", |
There was a problem hiding this comment.
| "eventError_start": "The start date/time is required to be after the current date/time.", | |
| "eventError_start": "The start date/time must be in the future.", |
For clarity.
| "eventOnline": "Online Event", | ||
| "eventAddEnd": "Add end date", | ||
| "eventError_start": "The start date/time is required to be after the current date/time.", | ||
| "eventError_end": "The end date/time is required to be before the start date/time.", |
There was a problem hiding this comment.
| "eventError_end": "The end date/time is required to be before the start date/time.", | |
| "eventError_end": "The end date/time must be after the start.", |
| case ServerSoftware.mbin: | ||
| throw UnimplementedError('Polls are unsupported on mbin'); | ||
|
|
||
| case ServerSoftware.lemmy: | ||
| throw UnimplementedError('Polls are unsupported on lemmy'); |
There was a problem hiding this comment.
| case ServerSoftware.mbin: | |
| throw UnimplementedError('Polls are unsupported on mbin'); | |
| case ServerSoftware.lemmy: | |
| throw UnimplementedError('Polls are unsupported on lemmy'); | |
| case ServerSoftware.mbin: | |
| throw UnimplementedError('Events are unsupported on mbin'); | |
| case ServerSoftware.lemmy: | |
| throw UnimplementedError('Events are unsupported on lemmy'); |
| var pickedDate = await showDatePicker( | ||
| context: context, | ||
| firstDate: DateTime.now(), | ||
| lastDate: DateTime.now().add(const Duration(days: 365 * 10)), | ||
| ); |
There was a problem hiding this comment.
If we pass in initialDate, then when editing the date, it will be preselected with whatever the previous value was. That should make editing the date more than once easier.
| final pickedTime = await showTimePicker( | ||
| context: context, | ||
| initialTime: const TimeOfDay(hour: 0, minute: 0), | ||
| ); |
There was a problem hiding this comment.
Same for initialTime and having it preselected to the current value.
| @@ -61,12 +62,12 @@ String dateDiffFormat(DateTime input) { | |||
| } | |||
|
|
|||
| final hours = difference.inHours; | |||
| if (hours > 0) { | |||
| if (hours.abs() > 0) { | |||
| return '${hours}h'; | |||
| } | |||
|
|
|||
| final minutes = difference.inMinutes; | |||
| if (minutes > 0) { | |||
| if (minutes.abs() > 0) { | |||
| return '${minutes}m'; | |||
| } | |||
|
|
|||
There was a problem hiding this comment.
What are the abs() here for? Are we expecting end to ever be before start?
Adds support for viewing and creating events.
There are several constraints for creating an event and parts of the UI are highlighted when these constraints aren't met.
Viewing a event.
Creating an event.
With end date before start date.