mirror of
https://github.com/Iconica-Development/flutter_login_widget.git
synced 2025-05-19 13:43:44 +02:00
fix: change forgotpassword form layout
This commit is contained in:
parent
a25977fe58
commit
9e283f8be4
5 changed files with 105 additions and 96 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
## 6.0.0
|
||||||
|
|
||||||
|
* Changed ForgotPasswordform to use the same layout as the EmailPasswordLoginForm.
|
||||||
|
|
||||||
## 5.2.0
|
## 5.2.0
|
||||||
|
|
||||||
* Added spacer options for the ForogotPasswordForm.
|
* Added spacer options for the ForogotPasswordForm.
|
||||||
|
|
|
@ -68,7 +68,7 @@ packages:
|
||||||
path: ".."
|
path: ".."
|
||||||
relative: true
|
relative: true
|
||||||
source: path
|
source: path
|
||||||
version: "5.1.4"
|
version: "6.0.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
|
@ -102,7 +102,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
if (options.title != null) ...[
|
if (options.title != null) ...[
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: _wrapWithDefaultStyle(
|
child: wrapWithDefaultStyle(
|
||||||
options.title,
|
options.title,
|
||||||
theme.textTheme.headlineSmall,
|
theme.textTheme.headlineSmall,
|
||||||
),
|
),
|
||||||
|
@ -114,7 +114,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
if (options.subtitle != null) ...[
|
if (options.subtitle != null) ...[
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: _wrapWithDefaultStyle(
|
child: wrapWithDefaultStyle(
|
||||||
options.subtitle,
|
options.subtitle,
|
||||||
theme.textTheme.titleSmall,
|
theme.textTheme.titleSmall,
|
||||||
),
|
),
|
||||||
|
@ -245,12 +245,12 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Widget? _wrapWithDefaultStyle(Widget? widget, TextStyle? style) {
|
Widget? wrapWithDefaultStyle(Widget? widget, TextStyle? style) {
|
||||||
if (style == null || widget == null) {
|
if (style == null || widget == null) {
|
||||||
return widget;
|
return widget;
|
||||||
} else {
|
} else {
|
||||||
return DefaultTextStyle(style: style, child: widget);
|
return DefaultTextStyle(style: style, child: widget);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,17 +66,16 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var options = widget.options;
|
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
return Form(
|
var options = widget.options;
|
||||||
key: _formKey,
|
|
||||||
child: ConstrainedBox(
|
return CustomScrollView(
|
||||||
constraints: const BoxConstraints(
|
physics: const ScrollPhysics(),
|
||||||
maxWidth: 300,
|
slivers: [
|
||||||
),
|
SliverFillRemaining(
|
||||||
|
hasScrollBody: false,
|
||||||
|
fillOverscroll: true,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
children: [
|
||||||
if (options.forgotPasswordSpacerOptions.spacerBeforeTitle !=
|
if (options.forgotPasswordSpacerOptions.spacerBeforeTitle !=
|
||||||
null) ...[
|
null) ...[
|
||||||
|
@ -84,32 +83,43 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
||||||
flex: options.forgotPasswordSpacerOptions.spacerBeforeTitle!,
|
flex: options.forgotPasswordSpacerOptions.spacerBeforeTitle!,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
_wrapWithDefaultStyle(
|
Align(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
child: wrapWithDefaultStyle(
|
||||||
widget.title,
|
widget.title,
|
||||||
theme.textTheme.displaySmall,
|
theme.textTheme.displaySmall,
|
||||||
) ??
|
),
|
||||||
const SizedBox.shrink(),
|
),
|
||||||
if (options.forgotPasswordSpacerOptions.spacerAfterTitle !=
|
if (options.forgotPasswordSpacerOptions.spacerAfterTitle !=
|
||||||
null) ...[
|
null) ...[
|
||||||
Spacer(
|
Spacer(
|
||||||
flex: options.forgotPasswordSpacerOptions.spacerAfterTitle!,
|
flex: options.forgotPasswordSpacerOptions.spacerAfterTitle!,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
_wrapWithDefaultStyle(
|
Align(
|
||||||
|
alignment: Alignment.topCenter,
|
||||||
|
child: wrapWithDefaultStyle(
|
||||||
widget.description,
|
widget.description,
|
||||||
theme.textTheme.bodyMedium,
|
theme.textTheme.bodyMedium,
|
||||||
) ??
|
),
|
||||||
const SizedBox.shrink(),
|
),
|
||||||
if (options.forgotPasswordSpacerOptions.spacerAfterDescription !=
|
if (options.forgotPasswordSpacerOptions.spacerAfterDescription !=
|
||||||
null) ...[
|
null) ...[
|
||||||
Spacer(
|
Spacer(
|
||||||
flex:
|
flex: options
|
||||||
options.forgotPasswordSpacerOptions.spacerAfterDescription!,
|
.forgotPasswordSpacerOptions.spacerAfterDescription!,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: options.forgotPasswordSpacerOptions.formFlexValue,
|
flex: options.forgotPasswordSpacerOptions.formFlexValue,
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxWidth: options.maxFormWidth ?? 300,
|
||||||
|
),
|
||||||
|
child: Form(
|
||||||
|
key: _formKey,
|
||||||
child: Align(
|
child: Align(
|
||||||
|
alignment: Alignment.center,
|
||||||
child: options.emailInputContainerBuilder(
|
child: options.emailInputContainerBuilder(
|
||||||
TextFormField(
|
TextFormField(
|
||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
|
@ -124,6 +134,8 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
if (options.forgotPasswordSpacerOptions.spacerBeforeButton !=
|
if (options.forgotPasswordSpacerOptions.spacerBeforeButton !=
|
||||||
null) ...[
|
null) ...[
|
||||||
Spacer(
|
Spacer(
|
||||||
|
@ -158,14 +170,7 @@ class _ForgotPasswordFormState extends State<ForgotPasswordForm> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget? _wrapWithDefaultStyle(Widget? widget, TextStyle? style) {
|
|
||||||
if (style == null || widget == null) {
|
|
||||||
return widget;
|
|
||||||
} else {
|
|
||||||
return DefaultTextStyle(style: style, child: widget);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_login
|
name: flutter_login
|
||||||
description: Flutter Login Component
|
description: Flutter Login Component
|
||||||
version: 5.2.0
|
version: 6.0.0
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.1 <3.0.0"
|
sdk: ">=2.18.1 <3.0.0"
|
||||||
|
|
Loading…
Reference in a new issue