mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-18 21:23:43 +02:00
fix: translate defaultsteps and emailregex fix
This commit is contained in:
parent
cd09b2cc56
commit
4ff212ad91
5 changed files with 33 additions and 50 deletions
|
@ -22,7 +22,7 @@ class FlutterRegistrationDemo extends StatelessWidget {
|
|||
return RegistrationScreen(
|
||||
registrationOptions: RegistrationOptions(
|
||||
registrationRepository: ExampleRegistrationRepository(),
|
||||
registrationSteps: RegistrationOptions.defaultSteps,
|
||||
registrationSteps: RegistrationOptions.getDefaultSteps(),
|
||||
afterRegistration: () {
|
||||
debugPrint('Registered!');
|
||||
},
|
||||
|
|
|
@ -80,7 +80,7 @@ packages:
|
|||
path: ".."
|
||||
relative: true
|
||||
source: path
|
||||
version: "0.0.1"
|
||||
version: "0.1.0"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
|
|
@ -20,22 +20,25 @@ class RegistrationOptions {
|
|||
final RegistrationRepository registrationRepository;
|
||||
final AppBar Function(String title)? customAppbarBuilder;
|
||||
|
||||
static List<AuthStep> get defaultSteps => [
|
||||
static List<AuthStep> getDefaultSteps({
|
||||
RegistrationTranslations translations = const RegistrationTranslations(),
|
||||
}) =>
|
||||
[
|
||||
AuthStep(
|
||||
fields: [
|
||||
AuthTextField(
|
||||
name: 'email',
|
||||
title: 'Wat is je e-mailadres?',
|
||||
hintText: 'iemand@voorbeeld.nl',
|
||||
title: translations.defaultEmailTitle,
|
||||
hintText: translations.defaultEmailHint,
|
||||
validators: [
|
||||
(email) => (email == null || email.isEmpty)
|
||||
? 'Geef uw e-mailadres op'
|
||||
? translations.defaultEmailEmpty
|
||||
: null,
|
||||
(email) =>
|
||||
RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+")
|
||||
RegExp(r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""")
|
||||
.hasMatch(email!)
|
||||
? null
|
||||
: 'Geef een geldig e-mailadres op',
|
||||
: translations.defaultEmailValidatorMessage,
|
||||
],
|
||||
)
|
||||
],
|
||||
|
@ -44,11 +47,12 @@ class RegistrationOptions {
|
|||
fields: [
|
||||
AuthTextField(
|
||||
name: 'password',
|
||||
title: 'Kies een wachtwoord',
|
||||
title: translations.defaultPasswordTitle,
|
||||
hintText: translations.defaultPasswordHint,
|
||||
obscureText: true,
|
||||
validators: [
|
||||
(value) => (value == null || value.isEmpty)
|
||||
? 'Geef een wachtwoord op'
|
||||
? translations.defaultPasswordValidatorMessage
|
||||
: null,
|
||||
],
|
||||
),
|
||||
|
|
|
@ -9,6 +9,13 @@ class RegistrationTranslations {
|
|||
this.previousStepBtn = 'Vorige stap',
|
||||
this.nextStepBtn = 'Volgende stap',
|
||||
this.closeBtn = 'Sluiten',
|
||||
this.defaultEmailTitle = 'Wat is je e-mailadres?',
|
||||
this.defaultEmailHint = 'iemand@voorbeeld.nl',
|
||||
this.defaultEmailEmpty = 'Geef uw e-mailadres op',
|
||||
this.defaultEmailValidatorMessage = 'Geef een geldig e-mailadres op',
|
||||
this.defaultPasswordTitle = 'Kies een wachtwoord',
|
||||
this.defaultPasswordHint = '',
|
||||
this.defaultPasswordValidatorMessage = 'Geef een wachtwoord op',
|
||||
});
|
||||
|
||||
final String title;
|
||||
|
@ -16,4 +23,11 @@ class RegistrationTranslations {
|
|||
final String previousStepBtn;
|
||||
final String nextStepBtn;
|
||||
final String closeBtn;
|
||||
final String defaultEmailTitle;
|
||||
final String defaultEmailHint;
|
||||
final String defaultEmailEmpty;
|
||||
final String defaultEmailValidatorMessage;
|
||||
final String defaultPasswordTitle;
|
||||
final String defaultPasswordHint;
|
||||
final String defaultPasswordValidatorMessage;
|
||||
}
|
||||
|
|
45
pubspec.yaml
45
pubspec.yaml
|
@ -3,9 +3,9 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
name: flutter_registration
|
||||
description: A standard flutter package.
|
||||
version: 0.0.1
|
||||
homepage:
|
||||
description: A Flutter Registration package
|
||||
version: 0.1.0
|
||||
repository: https://github.com/Iconica-Development/flutter_registration
|
||||
|
||||
environment:
|
||||
sdk: '>=2.18.0 <3.0.0'
|
||||
|
@ -16,46 +16,11 @@ dependencies:
|
|||
sdk: flutter
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
flutter_hooks: ^0.18.5+1
|
||||
flutter_hooks: any
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
flutter_lints: ^2.0.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://dart.dev/tools/pub/pubspec
|
||||
|
||||
# The following section is specific to Flutter packages.
|
||||
flutter:
|
||||
|
||||
# To add assets to your package, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
# - images/a_dot_ham.jpeg
|
||||
#
|
||||
# For details regarding assets in packages, see
|
||||
# https://flutter.dev/assets-and-images/#from-packages
|
||||
#
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
# https://flutter.dev/assets-and-images/#resolution-aware
|
||||
|
||||
# To add custom fonts to your package, add a fonts section here,
|
||||
# in this "flutter" section. Each entry in this list should have a
|
||||
# "family" key with the font family name, and a "fonts" key with a
|
||||
# list giving the asset and other descriptors for the font. For
|
||||
# example:
|
||||
# fonts:
|
||||
# - family: Schyler
|
||||
# fonts:
|
||||
# - asset: fonts/Schyler-Regular.ttf
|
||||
# - asset: fonts/Schyler-Italic.ttf
|
||||
# style: italic
|
||||
# - family: Trajan Pro
|
||||
# fonts:
|
||||
# - asset: fonts/TrajanPro.ttf
|
||||
# - asset: fonts/TrajanPro_Bold.ttf
|
||||
# weight: 700
|
||||
#
|
||||
# For details regarding fonts in packages, see
|
||||
# https://flutter.dev/custom-fonts/#from-packages
|
||||
flutter:
|
Loading…
Reference in a new issue