mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-18 21:23:43 +02:00
Merge pull request #24 from Iconica-Development/bugfix/input-values-clearing
fix: input values clearing on next step
This commit is contained in:
commit
05b143a5bd
5 changed files with 129 additions and 90 deletions
|
@ -4,6 +4,9 @@ SPDX-FileCopyrightText: 2022 Iconica
|
|||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
-->
|
||||
|
||||
# 2.0.2
|
||||
- fix: fixed the issue with values not being saved when calling nextStep.
|
||||
|
||||
# 2.0.1
|
||||
- feat: added circular progress indicator while awaiting registration of user
|
||||
- feat: added alignment option for buttons
|
||||
|
|
|
@ -227,99 +227,115 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: widget
|
||||
.buttonMainAxisAlignment !=
|
||||
null
|
||||
? widget.buttonMainAxisAlignment!
|
||||
: (widget.previousButtonBuilder != null &&
|
||||
widget.previousButtonBuilder?.call(
|
||||
onPrevious,
|
||||
widget.previousBtnTitle,
|
||||
i,
|
||||
) ==
|
||||
null)
|
||||
? MainAxisAlignment.start
|
||||
: widget.steps.first != widget.steps[i]
|
||||
? MainAxisAlignment.center
|
||||
: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (widget.previousButtonBuilder == null) ...[
|
||||
if (widget.steps.first != widget.steps[i])
|
||||
ElevatedButton(
|
||||
onPressed: onPrevious,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.arrow_back,
|
||||
],
|
||||
Expanded(
|
||||
flex: widget.formFlex ?? 3,
|
||||
child: Align(
|
||||
child: Column(
|
||||
children: [
|
||||
for (AuthField field
|
||||
in widget.steps[i].fields) ...[
|
||||
if (field.title != null) ...[
|
||||
field.title!,
|
||||
],
|
||||
field.build(context, () {
|
||||
_validate(i);
|
||||
})
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: widget
|
||||
.buttonMainAxisAlignment !=
|
||||
null
|
||||
? widget.buttonMainAxisAlignment!
|
||||
: (widget.previousButtonBuilder != null &&
|
||||
widget.previousButtonBuilder?.call(
|
||||
onPrevious,
|
||||
widget.previousBtnTitle,
|
||||
i,
|
||||
) ==
|
||||
null)
|
||||
? MainAxisAlignment.start
|
||||
: widget.steps.first != widget.steps[i]
|
||||
? MainAxisAlignment.center
|
||||
: MainAxisAlignment.end,
|
||||
children: [
|
||||
if (widget.previousButtonBuilder == null) ...[
|
||||
if (widget.steps.first != widget.steps[i])
|
||||
ElevatedButton(
|
||||
onPressed: onPrevious,
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.arrow_back,
|
||||
size: 18,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 4.0),
|
||||
child:
|
||||
Text(widget.previousBtnTitle),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
] else if (widget.previousButtonBuilder?.call(
|
||||
onPrevious,
|
||||
widget.previousBtnTitle,
|
||||
i) !=
|
||||
null) ...[
|
||||
widget.previousButtonBuilder!.call(
|
||||
onPrevious, widget.previousBtnTitle, i)!
|
||||
],
|
||||
widget.nextButtonBuilder?.call(
|
||||
!_formValid
|
||||
? null
|
||||
: () async {
|
||||
await onNext(widget.steps[i]);
|
||||
},
|
||||
widget.steps.last == widget.steps[i]
|
||||
? widget.submitBtnTitle
|
||||
: widget.nextBtnTitle,
|
||||
i,
|
||||
_formValid,
|
||||
) ??
|
||||
ElevatedButton(
|
||||
onPressed: !_formValid
|
||||
? null
|
||||
: () async {
|
||||
await onNext(widget.steps[i]);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.steps.last == widget.steps[i]
|
||||
? widget.submitBtnTitle
|
||||
: widget.nextBtnTitle,
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(left: 4.0),
|
||||
child: Icon(
|
||||
Icons.arrow_forward,
|
||||
size: 18,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 4.0),
|
||||
child:
|
||||
Text(widget.previousBtnTitle),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
] else if (widget.previousButtonBuilder?.call(
|
||||
onPrevious,
|
||||
widget.previousBtnTitle,
|
||||
i) !=
|
||||
null) ...[
|
||||
widget.previousButtonBuilder!.call(
|
||||
onPrevious, widget.previousBtnTitle, i)!
|
||||
],
|
||||
widget.nextButtonBuilder?.call(
|
||||
!_formValid
|
||||
? null
|
||||
: () async {
|
||||
await onNext(widget.steps[i]);
|
||||
},
|
||||
widget.steps.last == widget.steps[i]
|
||||
? widget.submitBtnTitle
|
||||
: widget.nextBtnTitle,
|
||||
i,
|
||||
_formValid,
|
||||
) ??
|
||||
ElevatedButton(
|
||||
onPressed: !_formValid
|
||||
? null
|
||||
: () async {
|
||||
await onNext(widget.steps[i]);
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.steps.last ==
|
||||
widget.steps[i]
|
||||
? widget.submitBtnTitle
|
||||
: widget.nextBtnTitle,
|
||||
),
|
||||
const Padding(
|
||||
padding:
|
||||
EdgeInsets.only(left: 4.0),
|
||||
child: Icon(
|
||||
Icons.arrow_forward,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.loginButton != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20.0),
|
||||
child: widget.loginButton!,
|
||||
),
|
||||
if (widget.loginButton != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20.0),
|
||||
child: widget.loginButton!,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
|
|
|
@ -13,6 +13,10 @@ class RegistrationOptions {
|
|||
required this.registrationRepository,
|
||||
required this.registrationSteps,
|
||||
required this.afterRegistration,
|
||||
this.titleFlex,
|
||||
this.formFlex,
|
||||
this.beforeTitleFlex,
|
||||
this.afterTitleFlex,
|
||||
this.registrationTranslations = const RegistrationTranslations.empty(),
|
||||
this.onError,
|
||||
this.customAppbarBuilder,
|
||||
|
@ -62,6 +66,18 @@ class RegistrationOptions {
|
|||
/// A custom widget for displaying a login button.
|
||||
Widget? loginButton;
|
||||
|
||||
/// The number of flex units for the title.
|
||||
final int? titleFlex;
|
||||
|
||||
/// The number of flex units for the form.
|
||||
final int? formFlex;
|
||||
|
||||
/// The number of flex units for the buttons.
|
||||
final int? beforeTitleFlex;
|
||||
|
||||
/// The number of flex units for the buttons.
|
||||
final int? afterTitleFlex;
|
||||
|
||||
/// Generates default registration steps.
|
||||
///
|
||||
/// [emailController] controller for email input.
|
||||
|
|
|
@ -76,6 +76,10 @@ class RegistrationScreenState extends State<RegistrationScreen> {
|
|||
titleWidget: widget.registrationOptions.titleWidget,
|
||||
loginButton: widget.registrationOptions.loginButton,
|
||||
isLoading: _isLoading,
|
||||
titleFlex: widget.registrationOptions.titleFlex,
|
||||
formFlex: widget.registrationOptions.formFlex,
|
||||
beforeTitleFlex: widget.registrationOptions.beforeTitleFlex,
|
||||
afterTitleFlex: widget.registrationOptions.afterTitleFlex,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_registration
|
||||
description: A Flutter Registration package
|
||||
version: 2.0.1
|
||||
version: 2.0.2
|
||||
repository: https://github.com/Iconica-Development/flutter_registration
|
||||
|
||||
publish_to: none
|
||||
|
|
Loading…
Reference in a new issue