selectedActionButtonsUI method

dynamic selectedActionButtonsUI()

Implementation

Widget selectedActionButtonsUI() {
  final newsReferences = selectedNewsPost?.newsReferencesModel;
  if (newsReferences == null) return const SizedBox();
  final calEventId = newsReferences.id;
  return Positioned(
    bottom: 10,
    left: 10,
    child: Row(
      children: [
        if (newsReferences.type == NewsReferencesType.calendarEvent &&
            calEventId != null)
          ref.watch(calendarEventProvider(calEventId)).when(
                data: (calendarEvent) {
                  return SizedBox(
                    width: 300,
                    child: EventItem(
                      event: calendarEvent,
                      isShowRsvp: false,
                      onTapEventItem: (event) async {
                        await ref
                            .read(newsStateProvider.notifier)
                            .selectEventToShare(context);
                      },
                    ),
                  );
                },
                loading: () => const SizedBox(
                  width: 300,
                  child: EventItemSkeleton(),
                ),
                error: (e, s) {
                  _log.severe('Failed to load cal event', e, s);
                  return Center(
                    child: Text(L10n.of(context).failedToLoadEvent(e)),
                  );
                },
              ),
      ],
    ),
  );
}