rwbr / flutter_neat_and_clean_calendar

Simple and clean flutter calendar with ability to slide up/down to show weekly/monthly calendar. Forked from [flutter_clean_calender](https://pub.dev/packages/flutter_clean_calendar)
MIT License
106 stars 55 forks source link

feat(event): add metadata attribute #45

Closed jnelle closed 2 years ago

jnelle commented 2 years ago

Signed-off-by: jnelle jimmy@nelle.sh

jnelle commented 2 years ago

Hi, I've added a metadata attribute that gives the possibility to add more data for an event

jnelle commented 2 years ago

I thought it's good especially if you want save some informations about a specific event. For example, I'm using it to save some user ids and the event id

extension MyScheduleConversion on Appointment {
  NeatCleanCalendarEvent convertToCalendarEvent(
          {required String name,
          required String trainerId,
          required String trainerName}) =>
      NeatCleanCalendarEvent(
        name,
        startTime: startTime!.toLocal(),
        endTime: endTime!.toLocal(),
        location: '${location!.street}, ${location!.city}',
        description: '$description mit $trainerName',
        color: ColorName.secondaryColor,
        metadata: <String, dynamic>{
          'id': id,
          'trainer_id': trainerId,
          'is_appointment': true,
          'invitor_id': invitorId,
        },
      );
}
rwbr commented 2 years ago

That's fine. I see your point. Makes sense. Thank's for contributing.

jjvillavicencio commented 1 year ago

I thought it's good especially if you want save some informations about a specific event. For example, I'm using it to save some user ids and the event id

extension MyScheduleConversion on Appointment {
  NeatCleanCalendarEvent convertToCalendarEvent(
          {required String name,
          required String trainerId,
          required String trainerName}) =>
      NeatCleanCalendarEvent(
        name,
        startTime: startTime!.toLocal(),
        endTime: endTime!.toLocal(),
        location: '${location!.street}, ${location!.city}',
        description: '$description mit $trainerName',
        color: ColorName.secondaryColor,
        metadata: <String, dynamic>{
          'id': id,
          'trainer_id': trainerId,
          'is_appointment': true,
          'invitor_id': invitorId,
        },
      );
}

Hi, metadata field don't preserves when the event starts and ends on different day, because in this case the _updateEventsMap method create a new class without metadata field

BuddhaCodes commented 6 months ago

Any solution for the it?

jnelle commented 6 months ago

@rwbr I‘ll check it later