mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05:23:43 +02:00
feat: small fixes
This commit is contained in:
parent
0472ebc4c5
commit
9ebb917fb8
8 changed files with 99 additions and 75 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -34,3 +34,4 @@ migrate_working_dir/
|
||||||
build/
|
build/
|
||||||
.flutter-plugins
|
.flutter-plugins
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
.metadata
|
|
@ -17,6 +17,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
- feat: added validation to disable next button
|
- feat: added validation to disable next button
|
||||||
- feat(auth-screen): add flexible spacing between fields
|
- feat(auth-screen): add flexible spacing between fields
|
||||||
- fix(keyboard-focus): add unfocus for onPrevious
|
- fix(keyboard-focus): add unfocus for onPrevious
|
||||||
|
- fix: add empty and required constructors for the RegistrationTranslations
|
||||||
|
|
||||||
# 1.2.0
|
# 1.2.0
|
||||||
|
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
# SPDX-FileCopyrightText: 2022 Iconica
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
|
|
||||||
image: cirrusci/flutter
|
|
||||||
|
|
||||||
pipelines:
|
|
||||||
pull-requests:
|
|
||||||
feature/*:
|
|
||||||
- step:
|
|
||||||
caches:
|
|
||||||
- gradle
|
|
||||||
- gradlewrapper
|
|
||||||
- flutter
|
|
||||||
name: Run analyzer & test
|
|
||||||
script:
|
|
||||||
- flutter pub get
|
|
||||||
- flutter format -o none --set-exit-if-changed .
|
|
||||||
- flutter analyze
|
|
||||||
|
|
||||||
develop:
|
|
||||||
- step:
|
|
||||||
caches:
|
|
||||||
- gradle
|
|
||||||
- gradlewrapper
|
|
||||||
- flutter
|
|
||||||
name: Run analyzer & test
|
|
||||||
script:
|
|
||||||
- flutter pub get
|
|
||||||
- flutter format -o none --set-exit-if-changed .
|
|
||||||
- flutter analyze
|
|
||||||
|
|
||||||
hotfix/*:
|
|
||||||
- step:
|
|
||||||
caches:
|
|
||||||
- gradle
|
|
||||||
- gradlewrapper
|
|
||||||
- flutter
|
|
||||||
name: Run analyzer & test
|
|
||||||
script:
|
|
||||||
- flutter pub get
|
|
||||||
- flutter format -o none --set-exit-if-changed .
|
|
||||||
- flutter analyze
|
|
||||||
|
|
||||||
definitions:
|
|
||||||
caches:
|
|
||||||
gradlewrapper: ~/.gradle/wrapper
|
|
||||||
flutter: ~/.pub-cache
|
|
|
@ -1,7 +1,7 @@
|
||||||
// SPDX-FileCopyrightText: 2022 Iconica
|
// SPDX-FileCopyrightText: 2022 Iconica
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
/// Flutter registration component that provides a registration screen with multiple registration steps.
|
||||||
library flutter_registration;
|
library flutter_registration;
|
||||||
|
|
||||||
export 'src/config/registration_options.dart';
|
export 'src/config/registration_options.dart';
|
||||||
|
|
|
@ -159,14 +159,12 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Spacer(
|
||||||
flex: widget.beforeTitleFlex ?? 3,
|
flex: widget.beforeTitleFlex ?? 3,
|
||||||
child: Container(),
|
|
||||||
),
|
),
|
||||||
widget.titleWidget!,
|
widget.titleWidget!,
|
||||||
Expanded(
|
Spacer(
|
||||||
flex: widget.afterTitleFlex ?? 2,
|
flex: widget.afterTitleFlex ?? 2,
|
||||||
child: Container(),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -12,7 +12,7 @@ class RegistrationOptions {
|
||||||
required this.registrationRepository,
|
required this.registrationRepository,
|
||||||
required this.registrationSteps,
|
required this.registrationSteps,
|
||||||
required this.afterRegistration,
|
required this.afterRegistration,
|
||||||
this.registrationTranslations = const RegistrationTranslations(),
|
this.registrationTranslations = const RegistrationTranslations.empty(),
|
||||||
this.onError,
|
this.onError,
|
||||||
this.customAppbarBuilder,
|
this.customAppbarBuilder,
|
||||||
this.nextButtonBuilder,
|
this.nextButtonBuilder,
|
||||||
|
@ -43,7 +43,8 @@ class RegistrationOptions {
|
||||||
TextEditingController? pass2Controller,
|
TextEditingController? pass2Controller,
|
||||||
bool pass2Hidden = true,
|
bool pass2Hidden = true,
|
||||||
Function(bool mainPass, bool value)? passHideOnChange,
|
Function(bool mainPass, bool value)? passHideOnChange,
|
||||||
RegistrationTranslations translations = const RegistrationTranslations(),
|
RegistrationTranslations translations =
|
||||||
|
const RegistrationTranslations.empty(),
|
||||||
Function(String title)? titleBuilder,
|
Function(String title)? titleBuilder,
|
||||||
Function(String label)? labelBuilder,
|
Function(String label)? labelBuilder,
|
||||||
TextStyle? textStyle,
|
TextStyle? textStyle,
|
||||||
|
|
|
@ -2,28 +2,49 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
|
/// Holds all the translations for the standard elements on the registration screen.
|
||||||
class RegistrationTranslations {
|
class RegistrationTranslations {
|
||||||
const RegistrationTranslations({
|
const RegistrationTranslations({
|
||||||
this.title = 'Register',
|
required this.title,
|
||||||
this.registerBtn = 'Register',
|
required this.registerBtn,
|
||||||
this.previousStepBtn = 'Previous',
|
required this.previousStepBtn,
|
||||||
this.nextStepBtn = 'Next',
|
required this.nextStepBtn,
|
||||||
this.closeBtn = 'Close',
|
required this.closeBtn,
|
||||||
this.defaultEmailTitle = 'What is your email?',
|
required this.defaultEmailTitle,
|
||||||
this.defaultEmailLabel = '',
|
required this.defaultEmailLabel,
|
||||||
this.defaultEmailHint = 'john.doe@domain.com',
|
required this.defaultEmailHint,
|
||||||
this.defaultEmailEmpty = 'Enter your email',
|
required this.defaultEmailEmpty,
|
||||||
this.defaultEmailValidatorMessage = 'Enter a valid email address',
|
required this.defaultEmailValidatorMessage,
|
||||||
this.defaultPassword1Title = 'Enter a password',
|
required this.defaultPassword1Title,
|
||||||
this.defaultPassword1Label = '',
|
required this.defaultPassword1Label,
|
||||||
this.defaultPassword1Hint = '',
|
required this.defaultPassword1Hint,
|
||||||
this.defaultPassword1ValidatorMessage = 'Enter a valid password',
|
required this.defaultPassword1ValidatorMessage,
|
||||||
this.defaultPassword2Title = 'Re-enter password',
|
required this.defaultPassword2Title,
|
||||||
this.defaultPassword2Label = '',
|
required this.defaultPassword2Label,
|
||||||
this.defaultPassword2Hint = '',
|
required this.defaultPassword2Hint,
|
||||||
this.defaultPassword2ValidatorMessage = 'Passwords have to be equal',
|
required this.defaultPassword2ValidatorMessage,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const RegistrationTranslations.empty()
|
||||||
|
: title = 'Register',
|
||||||
|
registerBtn = 'Register',
|
||||||
|
previousStepBtn = 'Previous',
|
||||||
|
nextStepBtn = 'Next',
|
||||||
|
closeBtn = 'Close',
|
||||||
|
defaultEmailTitle = 'What is your email?',
|
||||||
|
defaultEmailLabel = '',
|
||||||
|
defaultEmailHint = 'john.doe@domain.com',
|
||||||
|
defaultEmailEmpty = 'Enter your email',
|
||||||
|
defaultEmailValidatorMessage = 'Enter a valid email address',
|
||||||
|
defaultPassword1Title = 'Enter a password',
|
||||||
|
defaultPassword1Label = '',
|
||||||
|
defaultPassword1Hint = '',
|
||||||
|
defaultPassword1ValidatorMessage = 'Enter a valid password',
|
||||||
|
defaultPassword2Title = 'Re-enter password',
|
||||||
|
defaultPassword2Label = '',
|
||||||
|
defaultPassword2Hint = '',
|
||||||
|
defaultPassword2ValidatorMessage = 'Passwords have to be equal';
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final String registerBtn;
|
final String registerBtn;
|
||||||
final String previousStepBtn;
|
final String previousStepBtn;
|
||||||
|
@ -42,4 +63,54 @@ class RegistrationTranslations {
|
||||||
final String defaultPassword2Label;
|
final String defaultPassword2Label;
|
||||||
final String defaultPassword2Hint;
|
final String defaultPassword2Hint;
|
||||||
final String defaultPassword2ValidatorMessage;
|
final String defaultPassword2ValidatorMessage;
|
||||||
|
|
||||||
|
// create a copywith
|
||||||
|
RegistrationTranslations copyWith({
|
||||||
|
String? title,
|
||||||
|
String? registerBtn,
|
||||||
|
String? previousStepBtn,
|
||||||
|
String? nextStepBtn,
|
||||||
|
String? closeBtn,
|
||||||
|
String? defaultEmailTitle,
|
||||||
|
String? defaultEmailLabel,
|
||||||
|
String? defaultEmailHint,
|
||||||
|
String? defaultEmailEmpty,
|
||||||
|
String? defaultEmailValidatorMessage,
|
||||||
|
String? defaultPassword1Title,
|
||||||
|
String? defaultPassword1Label,
|
||||||
|
String? defaultPassword1Hint,
|
||||||
|
String? defaultPassword1ValidatorMessage,
|
||||||
|
String? defaultPassword2Title,
|
||||||
|
String? defaultPassword2Label,
|
||||||
|
String? defaultPassword2Hint,
|
||||||
|
String? defaultPassword2ValidatorMessage,
|
||||||
|
}) {
|
||||||
|
return RegistrationTranslations(
|
||||||
|
title: title ?? this.title,
|
||||||
|
registerBtn: registerBtn ?? this.registerBtn,
|
||||||
|
previousStepBtn: previousStepBtn ?? this.previousStepBtn,
|
||||||
|
nextStepBtn: nextStepBtn ?? this.nextStepBtn,
|
||||||
|
closeBtn: closeBtn ?? this.closeBtn,
|
||||||
|
defaultEmailTitle: defaultEmailTitle ?? this.defaultEmailTitle,
|
||||||
|
defaultEmailLabel: defaultEmailLabel ?? this.defaultEmailLabel,
|
||||||
|
defaultEmailHint: defaultEmailHint ?? this.defaultEmailHint,
|
||||||
|
defaultEmailEmpty: defaultEmailEmpty ?? this.defaultEmailEmpty,
|
||||||
|
defaultEmailValidatorMessage:
|
||||||
|
defaultEmailValidatorMessage ?? this.defaultEmailValidatorMessage,
|
||||||
|
defaultPassword1Title:
|
||||||
|
defaultPassword1Title ?? this.defaultPassword1Title,
|
||||||
|
defaultPassword1Label:
|
||||||
|
defaultPassword1Label ?? this.defaultPassword1Label,
|
||||||
|
defaultPassword1Hint: defaultPassword1Hint ?? this.defaultPassword1Hint,
|
||||||
|
defaultPassword1ValidatorMessage: defaultPassword1ValidatorMessage ??
|
||||||
|
this.defaultPassword1ValidatorMessage,
|
||||||
|
defaultPassword2Title:
|
||||||
|
defaultPassword2Title ?? this.defaultPassword2Title,
|
||||||
|
defaultPassword2Label:
|
||||||
|
defaultPassword2Label ?? this.defaultPassword2Label,
|
||||||
|
defaultPassword2Hint: defaultPassword2Hint ?? this.defaultPassword2Hint,
|
||||||
|
defaultPassword2ValidatorMessage: defaultPassword2ValidatorMessage ??
|
||||||
|
this.defaultPassword2ValidatorMessage,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ class AuthBoolField extends AuthField {
|
||||||
required this.widgetType,
|
required this.widgetType,
|
||||||
super.title,
|
super.title,
|
||||||
super.validators = const [],
|
super.validators = const [],
|
||||||
super.value = '',
|
super.value = false,
|
||||||
this.leftWidget,
|
this.leftWidget,
|
||||||
this.rightWidget,
|
this.rightWidget,
|
||||||
this.onChange,
|
this.onChange,
|
||||||
|
|
Loading…
Reference in a new issue