From 1f45ca9b85378efe33d6be95d75006e112692c89 Mon Sep 17 00:00:00 2001 From: Freek van de Ven Date: Thu, 27 Jul 2023 14:04:40 +0200 Subject: [PATCH] feat: added spacers before and after form --- CHANGELOG.md | 3 ++ example/pubspec.lock | 36 +++++++++++------------ lib/src/config/spacer_options.dart | 8 +++++ lib/src/widgets/email_password_login.dart | 8 ++++- pubspec.yaml | 2 +- 5 files changed, 37 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fac1d6e..03e3196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 4.2.0 +* Option for spacers add the start and end of the form + ## 4.1.1 * Export default LoginValidationService diff --git a/example/pubspec.lock b/example/pubspec.lock index 59864fe..fa083f7 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" boolean_selector: dependency: transitive description: @@ -21,10 +21,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" clock: dependency: transitive description: @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" fake_async: dependency: transitive description: @@ -68,7 +68,7 @@ packages: path: ".." relative: true source: path - version: "4.1.0" + version: "4.2.0" flutter_test: dependency: "direct dev" description: flutter @@ -83,10 +83,10 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" lints: dependency: transitive description: @@ -99,10 +99,10 @@ packages: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -115,18 +115,18 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" pinput: dependency: transitive description: @@ -192,10 +192,10 @@ packages: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" universal_platform: dependency: transitive description: @@ -213,5 +213,5 @@ packages: source: hosted version: "2.1.4" sdks: - dart: ">=2.18.1 <3.0.0" + dart: ">=3.0.0-0 <4.0.0" flutter: ">=3.7.0" diff --git a/lib/src/config/spacer_options.dart b/lib/src/config/spacer_options.dart index 9d463b1..ceb6ec9 100644 --- a/lib/src/config/spacer_options.dart +++ b/lib/src/config/spacer_options.dart @@ -3,13 +3,18 @@ import 'package:flutter/material.dart'; @immutable class LoginSpacerOptions { const LoginSpacerOptions({ + this.spacerBeforeTitle, this.spacerAfterTitle, this.spacerAfterSubtitle, this.spacerAfterImage, this.spacerAfterForm, + this.spacerAfterButton, this.formFlexValue = 1, }); + /// Flex value for the spacer before the title. + final int? spacerBeforeTitle; + /// Flex value for the spacer between the title and subtitle. final int? spacerAfterTitle; @@ -22,6 +27,9 @@ class LoginSpacerOptions { /// Flex value for the spacer between the form and button. final int? spacerAfterForm; + /// Flex value for the spacer after the button. + final int? spacerAfterButton; + /// Flex value for the form. Defaults to 1. Use this when also using the other spacer options. final int formFlexValue; } diff --git a/lib/src/widgets/email_password_login.dart b/lib/src/widgets/email_password_login.dart index d77a720..1e57110 100644 --- a/lib/src/widgets/email_password_login.dart +++ b/lib/src/widgets/email_password_login.dart @@ -83,6 +83,9 @@ class _EmailPasswordLoginFormState extends State { hasScrollBody: false, child: Column( children: [ + if (options.spacers.spacerBeforeTitle != null) ...[ + Spacer(flex: options.spacers.spacerBeforeTitle!), + ], if (options.title != null) ...[ const SizedBox( height: 60, @@ -218,7 +221,10 @@ class _EmailPasswordLoginFormState extends State { () {}, options, ), - ] + ], + if (options.spacers.spacerAfterButton != null) ...[ + Spacer(flex: options.spacers.spacerAfterButton!), + ], ], ), ), diff --git a/pubspec.yaml b/pubspec.yaml index 949ab21..f72243b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_login description: Flutter Login Component -version: 4.1.1 +version: 4.2.0 environment: sdk: ">=2.18.1 <3.0.0"