mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05:23:43 +02:00
bugfix: Fix flex overflow, add own padding and alignment option for buttons
Closes: #14
This commit is contained in:
parent
44871bf44e
commit
0f28c7084e
3 changed files with 86 additions and 94 deletions
|
@ -16,6 +16,7 @@ class AuthScreen extends StatefulWidget {
|
||||||
required this.previousBtnTitle,
|
required this.previousBtnTitle,
|
||||||
required this.onFinish,
|
required this.onFinish,
|
||||||
this.customAppBar,
|
this.customAppBar,
|
||||||
|
this.buttonMainAxisAlignment,
|
||||||
this.customBackgroundColor,
|
this.customBackgroundColor,
|
||||||
this.nextButtonBuilder,
|
this.nextButtonBuilder,
|
||||||
this.previousButtonBuilder,
|
this.previousButtonBuilder,
|
||||||
|
@ -38,6 +39,7 @@ class AuthScreen extends StatefulWidget {
|
||||||
final String nextBtnTitle;
|
final String nextBtnTitle;
|
||||||
final String previousBtnTitle;
|
final String previousBtnTitle;
|
||||||
final AppBar? customAppBar;
|
final AppBar? customAppBar;
|
||||||
|
final MainAxisAlignment? buttonMainAxisAlignment;
|
||||||
final Color? customBackgroundColor;
|
final Color? customBackgroundColor;
|
||||||
final Widget Function(Future<void> Function()? onPressed, String label,
|
final Widget Function(Future<void> Function()? onPressed, String label,
|
||||||
int step, bool enabled)? nextButtonBuilder;
|
int step, bool enabled)? nextButtonBuilder;
|
||||||
|
@ -170,7 +172,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
Expanded(
|
Flexible(
|
||||||
flex: widget.formFlex ?? 3,
|
flex: widget.formFlex ?? 3,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
@ -191,33 +193,22 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Column(
|
||||||
padding: EdgeInsets.only(
|
|
||||||
top: 15.0,
|
|
||||||
bottom: 30.0,
|
|
||||||
left: widget.previousButtonBuilder == null &&
|
|
||||||
widget.steps.first != widget.steps[i]
|
|
||||||
? 30.0
|
|
||||||
: 0.0,
|
|
||||||
right: widget.nextButtonBuilder == null &&
|
|
||||||
widget.previousButtonBuilder == null
|
|
||||||
? 30.0
|
|
||||||
: 0.0,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
(widget.previousButtonBuilder != null &&
|
widget.buttonMainAxisAlignment != null
|
||||||
|
? widget.buttonMainAxisAlignment!
|
||||||
|
: (widget.previousButtonBuilder != null &&
|
||||||
widget.previousButtonBuilder?.call(
|
widget.previousButtonBuilder?.call(
|
||||||
onPrevious,
|
onPrevious,
|
||||||
widget.previousBtnTitle,
|
widget.previousBtnTitle,
|
||||||
i,
|
i,
|
||||||
) ==
|
) ==
|
||||||
null)
|
null)
|
||||||
? MainAxisAlignment.spaceAround
|
? MainAxisAlignment.start
|
||||||
: widget.steps.first != widget.steps[i]
|
: widget.steps.first != widget.steps[i]
|
||||||
? MainAxisAlignment.spaceBetween
|
? MainAxisAlignment.center
|
||||||
: MainAxisAlignment.end,
|
: MainAxisAlignment.end,
|
||||||
children: [
|
children: [
|
||||||
if (widget.previousButtonBuilder == null) ...[
|
if (widget.previousButtonBuilder == null) ...[
|
||||||
|
@ -231,8 +222,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
size: 18,
|
size: 18,
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding:
|
padding: const EdgeInsets.only(left: 4.0),
|
||||||
const EdgeInsets.only(left: 4.0),
|
|
||||||
child: Text(widget.previousBtnTitle),
|
child: Text(widget.previousBtnTitle),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -288,7 +278,6 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -17,6 +17,7 @@ class RegistrationOptions {
|
||||||
this.customAppbarBuilder,
|
this.customAppbarBuilder,
|
||||||
this.nextButtonBuilder,
|
this.nextButtonBuilder,
|
||||||
this.previousButtonBuilder,
|
this.previousButtonBuilder,
|
||||||
|
this.buttonMainAxisAlignment,
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
this.titleWidget,
|
this.titleWidget,
|
||||||
this.loginButton,
|
this.loginButton,
|
||||||
|
@ -32,6 +33,7 @@ class RegistrationOptions {
|
||||||
int step, bool enabled)? nextButtonBuilder;
|
int step, bool enabled)? nextButtonBuilder;
|
||||||
final Widget? Function(VoidCallback onPressed, String label, int step)?
|
final Widget? Function(VoidCallback onPressed, String label, int step)?
|
||||||
previousButtonBuilder;
|
previousButtonBuilder;
|
||||||
|
final MainAxisAlignment? buttonMainAxisAlignment;
|
||||||
final Color? backgroundColor;
|
final Color? backgroundColor;
|
||||||
Widget? titleWidget;
|
Widget? titleWidget;
|
||||||
Widget? loginButton;
|
Widget? loginButton;
|
||||||
|
|
|
@ -52,6 +52,7 @@ class RegistrationScreen extends StatelessWidget {
|
||||||
previousBtnTitle: translations.previousStepBtn,
|
previousBtnTitle: translations.previousStepBtn,
|
||||||
nextButtonBuilder: registrationOptions.nextButtonBuilder,
|
nextButtonBuilder: registrationOptions.nextButtonBuilder,
|
||||||
previousButtonBuilder: registrationOptions.previousButtonBuilder,
|
previousButtonBuilder: registrationOptions.previousButtonBuilder,
|
||||||
|
buttonMainAxisAlignment: registrationOptions.buttonMainAxisAlignment,
|
||||||
customBackgroundColor: registrationOptions.backgroundColor,
|
customBackgroundColor: registrationOptions.backgroundColor,
|
||||||
titleWidget: registrationOptions.titleWidget,
|
titleWidget: registrationOptions.titleWidget,
|
||||||
loginButton: registrationOptions.loginButton,
|
loginButton: registrationOptions.loginButton,
|
||||||
|
|
Loading…
Reference in a new issue