build method

  1. @override
dynamic build(
  1. dynamic context,
  2. dynamic ref
)

Implementation

@override
Widget build(BuildContext context, WidgetRef ref) {
  final lang = L10n.of(context);
  final colorScheme = Theme.of(context).colorScheme;
  final roomId = room.roomIdStr();
  final invited =
      ref.watch(roomInvitedMembersProvider(roomId)).valueOrNull ?? [];
  final joined = ref.watch(membersIdsProvider(roomId)).valueOrNull ?? [];
  if (isInvited(userId, invited)) {
    return InkWell(
      onTap: () => _cancelInvite(context, ref),
      child: Chip(
        label: Text(lang.revoke),
        backgroundColor: colorScheme.error,
      ),
    );
  }
  if (isJoined(userId, joined)) {
    return Chip(
      label: Text(lang.joined),
      backgroundColor: colorScheme.success,
    );
  }
  return InkWell(
    onTap: () => _handleInvite(context),
    child: Chip(
      avatar: const Icon(Atlas.paper_airplane_thin),
      label: Text(lang.invite),
    ),
  );
}