mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05:23:43 +02:00
fix: input values clearing on next step
This commit is contained in:
parent
7890c17587
commit
a44a419bc4
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
|
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
|
# 2.0.1
|
||||||
- feat: added circular progress indicator while awaiting registration of user
|
- feat: added circular progress indicator while awaiting registration of user
|
||||||
- feat: added alignment option for buttons
|
- feat: added alignment option for buttons
|
||||||
|
|
|
@ -227,99 +227,115 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
],
|
||||||
children: [
|
Expanded(
|
||||||
Row(
|
flex: widget.formFlex ?? 3,
|
||||||
mainAxisAlignment: widget
|
child: Align(
|
||||||
.buttonMainAxisAlignment !=
|
child: Column(
|
||||||
null
|
children: [
|
||||||
? widget.buttonMainAxisAlignment!
|
for (AuthField field
|
||||||
: (widget.previousButtonBuilder != null &&
|
in widget.steps[i].fields) ...[
|
||||||
widget.previousButtonBuilder?.call(
|
if (field.title != null) ...[
|
||||||
onPrevious,
|
field.title!,
|
||||||
widget.previousBtnTitle,
|
],
|
||||||
i,
|
field.build(context, () {
|
||||||
) ==
|
_validate(i);
|
||||||
null)
|
})
|
||||||
? MainAxisAlignment.start
|
]
|
||||||
: widget.steps.first != widget.steps[i]
|
],
|
||||||
? MainAxisAlignment.center
|
),
|
||||||
: MainAxisAlignment.end,
|
),
|
||||||
children: [
|
),
|
||||||
if (widget.previousButtonBuilder == null) ...[
|
Column(
|
||||||
if (widget.steps.first != widget.steps[i])
|
children: [
|
||||||
ElevatedButton(
|
Row(
|
||||||
onPressed: onPrevious,
|
mainAxisAlignment: widget
|
||||||
child: Row(
|
.buttonMainAxisAlignment !=
|
||||||
children: [
|
null
|
||||||
const Icon(
|
? widget.buttonMainAxisAlignment!
|
||||||
Icons.arrow_back,
|
: (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,
|
size: 18,
|
||||||
),
|
),
|
||||||
Padding(
|
),
|
||||||
padding: const EdgeInsets.only(
|
],
|
||||||
left: 4.0),
|
|
||||||
child:
|
|
||||||
Text(widget.previousBtnTitle),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
] else if (widget.previousButtonBuilder?.call(
|
),
|
||||||
onPrevious,
|
],
|
||||||
widget.previousBtnTitle,
|
),
|
||||||
i) !=
|
if (widget.loginButton != null)
|
||||||
null) ...[
|
Padding(
|
||||||
widget.previousButtonBuilder!.call(
|
padding: const EdgeInsets.only(top: 20.0),
|
||||||
onPrevious, widget.previousBtnTitle, i)!
|
child: widget.loginButton!,
|
||||||
],
|
|
||||||
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!,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -13,6 +13,10 @@ class RegistrationOptions {
|
||||||
required this.registrationRepository,
|
required this.registrationRepository,
|
||||||
required this.registrationSteps,
|
required this.registrationSteps,
|
||||||
required this.afterRegistration,
|
required this.afterRegistration,
|
||||||
|
this.titleFlex,
|
||||||
|
this.formFlex,
|
||||||
|
this.beforeTitleFlex,
|
||||||
|
this.afterTitleFlex,
|
||||||
this.registrationTranslations = const RegistrationTranslations.empty(),
|
this.registrationTranslations = const RegistrationTranslations.empty(),
|
||||||
this.onError,
|
this.onError,
|
||||||
this.customAppbarBuilder,
|
this.customAppbarBuilder,
|
||||||
|
@ -62,6 +66,18 @@ class RegistrationOptions {
|
||||||
/// A custom widget for displaying a login button.
|
/// A custom widget for displaying a login button.
|
||||||
Widget? loginButton;
|
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.
|
/// Generates default registration steps.
|
||||||
///
|
///
|
||||||
/// [emailController] controller for email input.
|
/// [emailController] controller for email input.
|
||||||
|
|
|
@ -76,6 +76,10 @@ class RegistrationScreenState extends State<RegistrationScreen> {
|
||||||
titleWidget: widget.registrationOptions.titleWidget,
|
titleWidget: widget.registrationOptions.titleWidget,
|
||||||
loginButton: widget.registrationOptions.loginButton,
|
loginButton: widget.registrationOptions.loginButton,
|
||||||
isLoading: _isLoading,
|
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
|
name: flutter_registration
|
||||||
description: A Flutter Registration package
|
description: A Flutter Registration package
|
||||||
version: 2.0.1
|
version: 2.0.2
|
||||||
repository: https://github.com/Iconica-Development/flutter_registration
|
repository: https://github.com/Iconica-Development/flutter_registration
|
||||||
|
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
Loading…
Reference in a new issue