Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added backgroundImage #480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Binary file added example/assets/images/bgr.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions example/lib/login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class LoginScreen extends StatelessWidget {
title: Constants.appName,
keyboardDismissBehavior: ScrollViewKeyboardDismissBehavior.onDrag,
logo: const AssetImage('assets/images/ecorp.png'),
backgroundImage: const AssetImage('assets/images/bgr.jpg'),
logoTag: Constants.logoTag,
titleTag: Constants.titleTag,
navigateBackAfterRecovery: true,
Expand Down
3 changes: 2 additions & 1 deletion example/linux/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
flutter/ephemeral
flutter/ephemeral/
flutter/generated_*
28 changes: 14 additions & 14 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ packages:
dependency: "direct dev"
description:
name: lint
sha256: "77b3777e8e9adca8e942da1e835882ae3248dfa00488a2ebbdbc1f1a4aa3f4a7"
sha256: d758a5211fce7fd3f5e316f804daefecdc34c7e53559716125e6da7388ae8565
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.3.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -219,10 +219,10 @@ packages:
dependency: transitive
description:
name: plugin_platform_interface
sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8
sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
url: "https://pub.dev"
source: hosted
version: "2.1.7"
version: "2.1.8"
provider:
dependency: transitive
description:
Expand Down Expand Up @@ -304,26 +304,26 @@ packages:
dependency: transitive
description:
name: url_launcher
sha256: e9aa5ea75c84cf46b3db4eea212523591211c3cf2e13099ee4ec147f54201c86
sha256: d25bb0ca00432a5e1ee40e69c36c85863addf7cc45e433769d61bed3fe81fd96
url: "https://pub.dev"
source: hosted
version: "6.2.2"
version: "6.2.3"
url_launcher_android:
dependency: transitive
description:
name: url_launcher_android
sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def"
sha256: "507dc655b1d9cb5ebc756032eb785f114e415f91557b73bf60b7e201dfedeb2f"
url: "https://pub.dev"
source: hosted
version: "6.2.0"
version: "6.2.2"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3
sha256: "75bb6fe3f60070407704282a2d295630cab232991eb52542b18347a8a941df03"
url: "https://pub.dev"
source: hosted
version: "6.2.1"
version: "6.2.4"
url_launcher_linux:
dependency: transitive
description:
Expand All @@ -344,18 +344,18 @@ packages:
dependency: transitive
description:
name: url_launcher_platform_interface
sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50"
sha256: a932c3a8082e118f80a475ce692fde89dc20fddb24c57360b96bc56f7035de1f
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.3.1"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
sha256: "7286aec002c8feecc338cc33269e96b73955ab227456e9fb2a91f7fab8a358e9"
sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b
url: "https://pub.dev"
source: hosted
version: "2.2.2"
version: "2.2.3"
url_launcher_windows:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ flutter:
- assets/images/ecorp.png
- assets/images/ecorp-lightblue.png
- assets/images/ecorp-lightgreen.png
- assets/images/bgr.jpg

fonts:
- family: OpenSans
Expand Down
1 change: 1 addition & 0 deletions example/windows/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
flutter/ephemeral/
flutter/generated_*

# Visual Studio user-specific files.
*.suo
Expand Down
37 changes: 30 additions & 7 deletions lib/flutter_login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ class FlutterLogin extends StatefulWidget {

/// The [ImageProvider] or asset path [String] for the logo image to be displayed
dynamic logo,

/// The [ImageProvider] or asset path [String] for the background image to be displayed
dynamic backgroundImage,
this.messages,
this.theme,
this.userValidator,
Expand Down Expand Up @@ -314,7 +317,14 @@ class FlutterLogin extends StatefulWidget {
this.onSwitchToAdditionalFields,
this.initialIsoCode,
this.keyboardDismissBehavior = ScrollViewKeyboardDismissBehavior.manual,
}) : assert((logo is String?) || (logo is ImageProvider?)),
}) : assert(
((logo is String?) || (logo is ImageProvider?)) &&
((backgroundImage is String?) ||
(backgroundImage is ImageProvider?)),
),
backgroundImage = backgroundImage is String
? AssetImage(backgroundImage)
: backgroundImage as ImageProvider?,
logo = logo is String ? AssetImage(logo) : logo as ImageProvider?;

/// Called when the user hit the submit button when in sign up mode
Expand Down Expand Up @@ -343,6 +353,9 @@ class FlutterLogin extends StatefulWidget {
/// The image provider for the logo image to be displayed
final ImageProvider? logo;

/// The image provider for the background image to be displayed
final ImageProvider? backgroundImage;

/// Describes all of the labels, text hints, button texts and other auth
/// descriptions
final LoginMessages? messages;
Expand Down Expand Up @@ -817,12 +830,22 @@ class _FlutterLoginState extends State<FlutterLogin>
backgroundColor: Colors.transparent,
body: Stack(
children: <Widget>[
GradientBox(
colors: [
loginTheme.pageColorLight ?? theme.primaryColor,
loginTheme.pageColorDark ?? theme.primaryColorDark,
],
),
if (widget.backgroundImage == null)
GradientBox(
colors: [
loginTheme.pageColorLight ?? theme.primaryColor,
loginTheme.pageColorDark ?? theme.primaryColorDark,
],
)
else
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: widget.backgroundImage!,
fit: BoxFit.cover,
),
),
),
SingleChildScrollView(
keyboardDismissBehavior: widget.keyboardDismissBehavior,
child: Theme(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_login
description: A login widget with login/signup functionalities to help speed up development
version: 5.0.0
version: 5.0.1
repository: https://github.com/NearHuscarl/flutter_login

environment:
Expand Down