mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05: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(
|
return RegistrationScreen(
|
||||||
registrationOptions: RegistrationOptions(
|
registrationOptions: RegistrationOptions(
|
||||||
registrationRepository: ExampleRegistrationRepository(),
|
registrationRepository: ExampleRegistrationRepository(),
|
||||||
registrationSteps: RegistrationOptions.defaultSteps,
|
registrationSteps: RegistrationOptions.getDefaultSteps(),
|
||||||
afterRegistration: () {
|
afterRegistration: () {
|
||||||
debugPrint('Registered!');
|
debugPrint('Registered!');
|
||||||
},
|
},
|
||||||
|
|
|
@ -80,7 +80,7 @@ packages:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "0.0.1"
|
version: "0.1.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
|
@ -20,22 +20,25 @@ class RegistrationOptions {
|
||||||
final RegistrationRepository registrationRepository;
|
final RegistrationRepository registrationRepository;
|
||||||
final AppBar Function(String title)? customAppbarBuilder;
|
final AppBar Function(String title)? customAppbarBuilder;
|
||||||
|
|
||||||
static List<AuthStep> get defaultSteps => [
|
static List<AuthStep> getDefaultSteps({
|
||||||
|
RegistrationTranslations translations = const RegistrationTranslations(),
|
||||||
|
}) =>
|
||||||
|
[
|
||||||
AuthStep(
|
AuthStep(
|
||||||
fields: [
|
fields: [
|
||||||
AuthTextField(
|
AuthTextField(
|
||||||
name: 'email',
|
name: 'email',
|
||||||
title: 'Wat is je e-mailadres?',
|
title: translations.defaultEmailTitle,
|
||||||
hintText: 'iemand@voorbeeld.nl',
|
hintText: translations.defaultEmailHint,
|
||||||
validators: [
|
validators: [
|
||||||
(email) => (email == null || email.isEmpty)
|
(email) => (email == null || email.isEmpty)
|
||||||
? 'Geef uw e-mailadres op'
|
? translations.defaultEmailEmpty
|
||||||
: null,
|
: null,
|
||||||
(email) =>
|
(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!)
|
.hasMatch(email!)
|
||||||
? null
|
? null
|
||||||
: 'Geef een geldig e-mailadres op',
|
: translations.defaultEmailValidatorMessage,
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
@ -44,11 +47,12 @@ class RegistrationOptions {
|
||||||
fields: [
|
fields: [
|
||||||
AuthTextField(
|
AuthTextField(
|
||||||
name: 'password',
|
name: 'password',
|
||||||
title: 'Kies een wachtwoord',
|
title: translations.defaultPasswordTitle,
|
||||||
|
hintText: translations.defaultPasswordHint,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
validators: [
|
validators: [
|
||||||
(value) => (value == null || value.isEmpty)
|
(value) => (value == null || value.isEmpty)
|
||||||
? 'Geef een wachtwoord op'
|
? translations.defaultPasswordValidatorMessage
|
||||||
: null,
|
: null,
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -9,6 +9,13 @@ class RegistrationTranslations {
|
||||||
this.previousStepBtn = 'Vorige stap',
|
this.previousStepBtn = 'Vorige stap',
|
||||||
this.nextStepBtn = 'Volgende stap',
|
this.nextStepBtn = 'Volgende stap',
|
||||||
this.closeBtn = 'Sluiten',
|
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;
|
final String title;
|
||||||
|
@ -16,4 +23,11 @@ class RegistrationTranslations {
|
||||||
final String previousStepBtn;
|
final String previousStepBtn;
|
||||||
final String nextStepBtn;
|
final String nextStepBtn;
|
||||||
final String closeBtn;
|
final String closeBtn;
|
||||||
|
final String defaultEmailTitle;
|
||||||
|
final String defaultEmailHint;
|
||||||
|
final String defaultEmailEmpty;
|
||||||
|
final String defaultEmailValidatorMessage;
|
||||||
|
final String defaultPasswordTitle;
|
||||||
|
final String defaultPasswordHint;
|
||||||
|
final String defaultPasswordValidatorMessage;
|
||||||
}
|
}
|
||||||
|
|
43
pubspec.yaml
43
pubspec.yaml
|
@ -3,9 +3,9 @@
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
name: flutter_registration
|
name: flutter_registration
|
||||||
description: A standard flutter package.
|
description: A Flutter Registration package
|
||||||
version: 0.0.1
|
version: 0.1.0
|
||||||
homepage:
|
repository: https://github.com/Iconica-Development/flutter_registration
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.18.0 <3.0.0'
|
sdk: '>=2.18.0 <3.0.0'
|
||||||
|
@ -16,46 +16,11 @@ dependencies:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_hooks: ^0.18.5+1
|
flutter_hooks: any
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
flutter_lints: ^2.0.0
|
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:
|
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
|
|
||||||
|
|
Loading…
Reference in a new issue