flutter_registration/lib/src/config/registration_options.dart

55 lines
1.7 KiB
Dart
Raw Normal View History

2022-09-28 09:23:41 +02:00
import 'package:flutter/material.dart';
import 'package:flutter_registration/flutter_registration.dart';
class RegistrationOptions {
RegistrationOptions({
required this.registrationRepository,
required this.registrationSteps,
required this.afterRegistration,
this.registrationTranslations = const RegistrationTranslations(),
2022-09-28 09:23:41 +02:00
this.customAppbarBuilder,
});
final RegistrationTranslations registrationTranslations;
final List<AuthStep> registrationSteps;
final VoidCallback afterRegistration;
final RegistrationRepository registrationRepository;
2022-09-28 09:23:41 +02:00
final AppBar Function(String title)? customAppbarBuilder;
static List<AuthStep> get defaultSteps => [
AuthStep(
fields: [
AuthTextField(
name: 'email',
title: 'Wat is je e-mailadres?',
2022-09-26 15:09:01 +02:00
hintText: 'iemand@voorbeeld.nl',
validators: [
(email) => (email == null || email.isEmpty)
? 'Geef uw e-mailadres op'
: null,
(email) =>
RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
.hasMatch(email!)
? null
: 'Geef een geldig e-mailadres op',
],
)
],
),
AuthStep(
fields: [
AuthTextField(
name: 'password',
title: 'Kies een wachtwoord',
obscureText: true,
validators: [
(value) => (value == null || value.isEmpty)
? 'Geef een wachtwoord op'
: null,
],
),
],
),
];
}