mirror of
https://github.com/Iconica-Development/flutter_login_widget.git
synced 2025-05-19 13:43:44 +02:00
Merge pull request #26 from Iconica-Development/feat/login-flexible
feat: add title spacer on login screen
This commit is contained in:
commit
0c0c83f571
4 changed files with 131 additions and 131 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
## 5.1.3
|
||||||
|
* Added title spacer
|
||||||
|
|
||||||
## 5.1.2
|
## 5.1.2
|
||||||
* Removed bottom padding from password text field
|
* Removed bottom padding from password text field
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ class LoginSpacerOptions {
|
||||||
this.spacerAfterForm,
|
this.spacerAfterForm,
|
||||||
this.spacerAfterButton,
|
this.spacerAfterButton,
|
||||||
this.formFlexValue = 1,
|
this.formFlexValue = 1,
|
||||||
|
this.titleSpacer = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Flex value for the spacer before the title.
|
/// Flex value for the spacer before the title.
|
||||||
|
@ -33,4 +34,6 @@ class LoginSpacerOptions {
|
||||||
/// Flex value for the form. Defaults to 1. Use this when also using the
|
/// Flex value for the form. Defaults to 1. Use this when also using the
|
||||||
/// other spacer options.
|
/// other spacer options.
|
||||||
final int formFlexValue;
|
final int formFlexValue;
|
||||||
|
|
||||||
|
final int titleSpacer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,22 +74,21 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
var options = widget.options;
|
var options = widget.options;
|
||||||
return CustomScrollView(
|
return CustomScrollView(
|
||||||
physics: MediaQuery.of(context).viewInsets.bottom == 0
|
physics: const ScrollPhysics(),
|
||||||
? const NeverScrollableScrollPhysics()
|
|
||||||
: null,
|
|
||||||
slivers: [
|
slivers: [
|
||||||
SliverFillRemaining(
|
SliverFillRemaining(
|
||||||
fillOverscroll: true,
|
|
||||||
hasScrollBody: false,
|
hasScrollBody: false,
|
||||||
|
fillOverscroll: true,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
flex: options.spacers.titleSpacer,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
if (options.spacers.spacerBeforeTitle != null) ...[
|
if (options.spacers.spacerBeforeTitle != null) ...[
|
||||||
Spacer(flex: options.spacers.spacerBeforeTitle!),
|
Spacer(flex: options.spacers.spacerBeforeTitle!),
|
||||||
],
|
],
|
||||||
if (options.title != null) ...[
|
if (options.title != null) ...[
|
||||||
const SizedBox(
|
|
||||||
height: 60,
|
|
||||||
),
|
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: _wrapWithDefaultStyle(
|
child: _wrapWithDefaultStyle(
|
||||||
|
@ -102,9 +101,6 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
Spacer(flex: options.spacers.spacerAfterTitle!),
|
Spacer(flex: options.spacers.spacerAfterTitle!),
|
||||||
],
|
],
|
||||||
if (options.subtitle != null) ...[
|
if (options.subtitle != null) ...[
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Align(
|
Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: _wrapWithDefaultStyle(
|
child: _wrapWithDefaultStyle(
|
||||||
|
@ -125,6 +121,9 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
if (options.spacers.spacerAfterImage != null) ...[
|
if (options.spacers.spacerAfterImage != null) ...[
|
||||||
Spacer(flex: options.spacers.spacerAfterImage!),
|
Spacer(flex: options.spacers.spacerAfterImage!),
|
||||||
],
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: options.spacers.formFlexValue,
|
flex: options.spacers.formFlexValue,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
|
@ -133,15 +132,13 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
),
|
),
|
||||||
child: Form(
|
child: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: Align(
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
options.emailInputContainerBuilder(
|
options.emailInputContainerBuilder(
|
||||||
TextFormField(
|
TextFormField(
|
||||||
onChanged: _updateCurrentEmail,
|
onChanged: _updateCurrentEmail,
|
||||||
validator:
|
validator: widget.options.validations.validateEmail,
|
||||||
widget.options.validations.validateEmail,
|
|
||||||
initialValue: options.initialEmail,
|
initialValue: options.initialEmail,
|
||||||
keyboardType: TextInputType.emailAddress,
|
keyboardType: TextInputType.emailAddress,
|
||||||
textInputAction: TextInputAction.next,
|
textInputAction: TextInputAction.next,
|
||||||
|
@ -165,8 +162,7 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
? IconButton(
|
? IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_obscurePassword =
|
_obscurePassword = !_obscurePassword;
|
||||||
!_obscurePassword;
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
@ -196,7 +192,6 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
if (options.spacers.spacerAfterForm != null) ...[
|
if (options.spacers.spacerAfterForm != null) ...[
|
||||||
Spacer(flex: options.spacers.spacerAfterForm!),
|
Spacer(flex: options.spacers.spacerAfterForm!),
|
||||||
],
|
],
|
||||||
const SizedBox(height: 8),
|
|
||||||
AnimatedBuilder(
|
AnimatedBuilder(
|
||||||
animation: _formValid,
|
animation: _formValid,
|
||||||
builder: (context, _) => options.loginButtonBuilder(
|
builder: (context, _) => options.loginButtonBuilder(
|
||||||
|
@ -231,7 +226,6 @@ class _EmailPasswordLoginFormState extends State<EmailPasswordLoginForm> {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_login
|
name: flutter_login
|
||||||
description: Flutter Login Component
|
description: Flutter Login Component
|
||||||
version: 5.1.2
|
version: 5.1.3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.18.1 <3.0.0"
|
sdk: ">=2.18.1 <3.0.0"
|
||||||
|
|
Loading…
Reference in a new issue