onPressed method

(dynamic Function()?) onPressed(
  1. ParticipantType? userType,
  2. WidgetRef ref,
  3. String uid,
  4. ParticipantType type
)

Implementation

Function()? onPressed(
  ParticipantType? userType,
  WidgetRef ref,
  String uid,
  ParticipantType type,
) {
  if (userType == type) return null;
  return () {
    // Launch sign up form if it exists and the button for going is pressed
    if (type == ParticipantType.going &&
        signUpForm != null &&
        signUpForm!.isNotEmpty) {
      launchUrl(Uri.parse(signUpForm!), mode: LaunchMode.externalApplication);
    }
    ref
        .read(participantProvider(eventID).notifier)
        .addUserToParticipants(uid, type);
  };
}