mirror of
https://github.com/Iconica-Development/flutter_registration.git
synced 2025-05-18 21:23:43 +02:00
fix: add default field size
This commit is contained in:
parent
444b11a44f
commit
c91a1c0856
5 changed files with 32 additions and 15 deletions
|
@ -3,6 +3,10 @@ SPDX-FileCopyrightText: 2022 Iconica
|
|||
|
||||
SPDX-License-Identifier: GPL-3.0-or-later
|
||||
-->
|
||||
|
||||
# 2.0.4
|
||||
- feat: added maxFormWidth to AuthScreen
|
||||
|
||||
# 2.0.3
|
||||
- feat: added default registrationOptions
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ class AuthScreen extends StatefulWidget {
|
|||
this.beforeTitleFlex,
|
||||
this.afterTitleFlex,
|
||||
this.isLoading = false,
|
||||
this.maxFormWidth,
|
||||
Key? key,
|
||||
}) : assert(steps.length > 0, 'At least one step is required'),
|
||||
super(key: key);
|
||||
|
@ -92,6 +93,7 @@ class AuthScreen extends StatefulWidget {
|
|||
final int? beforeTitleFlex;
|
||||
final int? afterTitleFlex;
|
||||
final bool isLoading;
|
||||
final double? maxFormWidth;
|
||||
|
||||
@override
|
||||
State<AuthScreen> createState() => _AuthScreenState();
|
||||
|
@ -234,18 +236,24 @@ class _AuthScreenState extends State<AuthScreen> {
|
|||
Expanded(
|
||||
flex: widget.formFlex ?? 3,
|
||||
child: Align(
|
||||
child: Column(
|
||||
children: [
|
||||
for (AuthField field
|
||||
in widget.steps[i].fields) ...[
|
||||
if (field.title != null) ...[
|
||||
field.title!,
|
||||
],
|
||||
field.build(context, () {
|
||||
_validate(i);
|
||||
})
|
||||
]
|
||||
],
|
||||
alignment: Alignment.topCenter,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: widget.maxFormWidth ?? 300,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
for (AuthField field
|
||||
in widget.steps[i].fields) ...[
|
||||
if (field.title != null) ...[
|
||||
field.title!,
|
||||
],
|
||||
field.build(context, () {
|
||||
_validate(i);
|
||||
})
|
||||
]
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -27,6 +27,7 @@ class RegistrationOptions {
|
|||
this.backgroundColor,
|
||||
this.titleWidget,
|
||||
this.loginButton,
|
||||
this.maxFormWidth,
|
||||
}) {
|
||||
if (registrationSteps == null || registrationSteps!.isEmpty) {
|
||||
steps = RegistrationOptions.getDefaultSteps();
|
||||
|
@ -88,6 +89,9 @@ class RegistrationOptions {
|
|||
/// The number of flex units for the buttons.
|
||||
final int? afterTitleFlex;
|
||||
|
||||
/// The maximum width of the form. Defaults to 300.
|
||||
final double? maxFormWidth;
|
||||
|
||||
/// Generates default registration steps.
|
||||
///
|
||||
/// [emailController] controller for email input.
|
||||
|
@ -149,7 +153,7 @@ class RegistrationOptions {
|
|||
border: const OutlineInputBorder(),
|
||||
),
|
||||
textStyle: textStyle,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 60, vertical: 20),
|
||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
validators: [
|
||||
(email) => (email == null || email.isEmpty)
|
||||
? translations.defaultEmailEmpty
|
||||
|
@ -186,7 +190,7 @@ class RegistrationOptions {
|
|||
hintText: translations.defaultPasswordHint,
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 60, vertical: 20),
|
||||
padding: const EdgeInsets.symmetric(vertical: 20),
|
||||
textStyle: textStyle,
|
||||
validators: [
|
||||
(value) => (value == null || value.isEmpty)
|
||||
|
|
|
@ -80,6 +80,7 @@ class RegistrationScreenState extends State<RegistrationScreen> {
|
|||
formFlex: widget.registrationOptions.formFlex,
|
||||
beforeTitleFlex: widget.registrationOptions.beforeTitleFlex,
|
||||
afterTitleFlex: widget.registrationOptions.afterTitleFlex,
|
||||
maxFormWidth: widget.registrationOptions.maxFormWidth,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
name: flutter_registration
|
||||
description: A Flutter Registration package
|
||||
version: 2.0.3
|
||||
version: 2.0.4
|
||||
repository: https://github.com/Iconica-Development/flutter_registration
|
||||
|
||||
publish_to: none
|
||||
|
|
Loading…
Reference in a new issue