mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-19 05:23:43 +02:00
feat: add title widget and login button builder
This commit is contained in:
parent
f1663afa1b
commit
7012942ce5
4 changed files with 67 additions and 47 deletions
|
@ -19,6 +19,8 @@ class AuthScreen extends StatefulWidget {
|
||||||
this.customBackgroundColor,
|
this.customBackgroundColor,
|
||||||
this.nextButtonBuilder,
|
this.nextButtonBuilder,
|
||||||
this.previousButtonBuilder,
|
this.previousButtonBuilder,
|
||||||
|
this.titleWidget,
|
||||||
|
this.loginButton,
|
||||||
super.key,
|
super.key,
|
||||||
}) : assert(steps.length > 0, 'At least one step is required');
|
}) : assert(steps.length > 0, 'At least one step is required');
|
||||||
|
|
||||||
|
@ -35,6 +37,8 @@ class AuthScreen extends StatefulWidget {
|
||||||
final Color? customBackgroundColor;
|
final Color? customBackgroundColor;
|
||||||
final Widget Function(Future<void> Function(), String)? nextButtonBuilder;
|
final Widget Function(Future<void> Function(), String)? nextButtonBuilder;
|
||||||
final Widget? Function(VoidCallback, String)? previousButtonBuilder;
|
final Widget? Function(VoidCallback, String)? previousButtonBuilder;
|
||||||
|
final Widget? titleWidget;
|
||||||
|
final Widget? loginButton;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<AuthScreen> createState() => _AuthScreenState();
|
State<AuthScreen> createState() => _AuthScreenState();
|
||||||
|
@ -114,10 +118,12 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (AuthStep step in widget.steps)
|
for (AuthStep step in widget.steps)
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
|
// Text(widget.title),
|
||||||
|
if (widget.titleWidget != null) widget.titleWidget!,
|
||||||
|
const SizedBox(height: 40),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Center(
|
|
||||||
child: ListView(
|
child: ListView(
|
||||||
physics: const ClampingScrollPhysics(),
|
physics: const ClampingScrollPhysics(),
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
|
@ -141,11 +147,11 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const Spacer(),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 15.0,
|
top: 15.0,
|
||||||
bottom: 30.0,
|
// bottom: 30.0,
|
||||||
left: 30.0,
|
left: 30.0,
|
||||||
right: 30.0,
|
right: 30.0,
|
||||||
),
|
),
|
||||||
|
@ -209,7 +215,12 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
|
if (widget.loginButton != null)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: widget.loginButton!,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -18,6 +18,8 @@ class RegistrationOptions {
|
||||||
this.nextButtonBuilder,
|
this.nextButtonBuilder,
|
||||||
this.previousButtonBuilder,
|
this.previousButtonBuilder,
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
|
this.titleWidget,
|
||||||
|
this.loginButton,
|
||||||
});
|
});
|
||||||
|
|
||||||
final RegistrationTranslations registrationTranslations;
|
final RegistrationTranslations registrationTranslations;
|
||||||
|
@ -31,6 +33,8 @@ class RegistrationOptions {
|
||||||
final Widget? Function(VoidCallback onPressed, String label)?
|
final Widget? Function(VoidCallback onPressed, String label)?
|
||||||
previousButtonBuilder;
|
previousButtonBuilder;
|
||||||
final Color? backgroundColor;
|
final Color? backgroundColor;
|
||||||
|
Widget? titleWidget;
|
||||||
|
Widget? loginButton;
|
||||||
|
|
||||||
static List<AuthStep> getDefaultSteps({
|
static List<AuthStep> getDefaultSteps({
|
||||||
TextEditingController? emailController,
|
TextEditingController? emailController,
|
||||||
|
|
|
@ -57,7 +57,9 @@ class AuthTextField extends AuthField {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TextFormField(
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: TextFormField(
|
||||||
style: textStyle,
|
style: textStyle,
|
||||||
decoration: textFieldDecoration ??
|
decoration: textFieldDecoration ??
|
||||||
InputDecoration(
|
InputDecoration(
|
||||||
|
@ -81,6 +83,7 @@ class AuthTextField extends AuthField {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ class RegistrationScreen extends StatelessWidget {
|
||||||
nextButtonBuilder: registrationOptions.nextButtonBuilder,
|
nextButtonBuilder: registrationOptions.nextButtonBuilder,
|
||||||
previousButtonBuilder: registrationOptions.previousButtonBuilder,
|
previousButtonBuilder: registrationOptions.previousButtonBuilder,
|
||||||
customBackgroundColor: registrationOptions.backgroundColor,
|
customBackgroundColor: registrationOptions.backgroundColor,
|
||||||
|
titleWidget: registrationOptions.titleWidget,
|
||||||
|
loginButton: registrationOptions.loginButton,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue