build method

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

Implementation

@override
Widget build(BuildContext context, WidgetRef ref) {
  final client = ref.watch(alwaysClientProvider);
  final dmId = client.dmWithUser(member.userId().toString()).text();
  if (dmId != null) {
    return Center(
      child: OutlinedButton.icon(
        icon: const Icon(Atlas.chats_thin),
        onPressed: () async {
          Navigator.pop(context);
          goToChat(context, dmId);
        },
        label: Text(L10n.of(context).message),
      ),
    );
  } else {
    return Center(
      child: OutlinedButton.icon(
        icon: const Icon(Atlas.chats_thin),
        onPressed: () {
          final profile = member.getProfile();
          ref.read(createChatSelectedUsersProvider.notifier).state = [
            profile,
          ];
          Navigator.pop(context);
          context.pushNamed(Routes.createChat.name);
        },
        label: Text(L10n.of(context).startDM),
      ),
    );
  }
}