mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05:23:43 +02:00
feat(auth-screen): add flexible spacing between fields
This commit is contained in:
parent
277b38f39e
commit
855e12f6ae
1 changed files with 32 additions and 10 deletions
|
@ -21,6 +21,10 @@ class AuthScreen extends StatefulWidget {
|
||||||
this.previousButtonBuilder,
|
this.previousButtonBuilder,
|
||||||
this.titleWidget,
|
this.titleWidget,
|
||||||
this.loginButton,
|
this.loginButton,
|
||||||
|
this.titleFlex,
|
||||||
|
this.formFlex,
|
||||||
|
this.beforeTitleFlex,
|
||||||
|
this.afterTitleFlex,
|
||||||
super.key,
|
super.key,
|
||||||
}) : assert(steps.length > 0, 'At least one step is required');
|
}) : assert(steps.length > 0, 'At least one step is required');
|
||||||
|
|
||||||
|
@ -41,6 +45,10 @@ class AuthScreen extends StatefulWidget {
|
||||||
previousButtonBuilder;
|
previousButtonBuilder;
|
||||||
final Widget? titleWidget;
|
final Widget? titleWidget;
|
||||||
final Widget? loginButton;
|
final Widget? loginButton;
|
||||||
|
final int? titleFlex;
|
||||||
|
final int? formFlex;
|
||||||
|
final int? beforeTitleFlex;
|
||||||
|
final int? afterTitleFlex;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AuthScreen> createState() => _AuthScreenState();
|
State<AuthScreen> createState() => _AuthScreenState();
|
||||||
|
@ -140,19 +148,33 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (var i = 0; i < widget.steps.length; i++)
|
for (var i = 0; i < widget.steps.length; i++)
|
||||||
Column(
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
if (widget.titleWidget != null) widget.titleWidget!,
|
if (widget.titleWidget != null) ...[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView(
|
flex: widget.titleFlex ?? 1,
|
||||||
physics: const ClampingScrollPhysics(),
|
child: Column(
|
||||||
shrinkWrap: true,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
padding: const EdgeInsets.symmetric(
|
mainAxisSize: MainAxisSize.min,
|
||||||
vertical: 8.0,
|
children: [
|
||||||
horizontal: 30.0,
|
Expanded(
|
||||||
|
flex: widget.beforeTitleFlex ?? 3,
|
||||||
|
child: Container(),
|
||||||
|
),
|
||||||
|
widget.titleWidget!,
|
||||||
|
Expanded(
|
||||||
|
flex: widget.afterTitleFlex ?? 2,
|
||||||
|
child: Container(),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Expanded(
|
||||||
|
flex: widget.formFlex ?? 3,
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 40),
|
|
||||||
for (AuthField field in widget.steps[i].fields)
|
for (AuthField field in widget.steps[i].fields)
|
||||||
Align(
|
Align(
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -166,7 +188,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue