From 6237398ea775705aa03846466b7ad65122f868f6 Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Wed, 20 Nov 2019 01:33:17 -0600 Subject: [PATCH 1/2] make login page color configurable independent of primary color --- lib/flutter_login.dart | 5 ++++- lib/src/providers/login_theme.dart | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/flutter_login.dart b/lib/flutter_login.dart index 9cda2808..153ed664 100644 --- a/lib/flutter_login.dart +++ b/lib/flutter_login.dart @@ -515,7 +515,10 @@ class _FlutterLoginState extends State body: Stack( children: [ GradientBox( - colors: [theme.primaryColor, theme.primaryColorDark], + colors: [ + loginTheme.pageColorLight ?? theme.primaryColor, + loginTheme.pageColorDark ?? theme.primaryColorDark, + ], begin: Alignment.topLeft, end: Alignment.bottomRight, ), diff --git a/lib/src/providers/login_theme.dart b/lib/src/providers/login_theme.dart index 7809dd1e..58210922 100644 --- a/lib/src/providers/login_theme.dart +++ b/lib/src/providers/login_theme.dart @@ -36,6 +36,8 @@ class LoginButtonTheme { class LoginTheme with ChangeNotifier { LoginTheme({ + this.pageColorLight, + this.pageColorDark, this.primaryColor, this.accentColor, this.errorColor, @@ -52,6 +54,14 @@ class LoginTheme with ChangeNotifier { this.afterHeroFontSize = 15.0, }); + /// The background color of the login page for light gradient; if specified, + /// overrides the [primaryColor] for page background + final Color pageColorLight; + + /// The background color of the login page for dark gradient; if specified, + /// overrides the computed primaryColorDark for page background + final Color pageColorDark; + /// The background color of major parts of the widget like the login screen /// and buttons final Color primaryColor; From d490c6fb0ccc9f7830b861b6e7bfe5ba8fb69aa7 Mon Sep 17 00:00:00 2001 From: Ryan Jones Date: Wed, 20 Nov 2019 11:44:03 -0600 Subject: [PATCH 2/2] update README --- README.md | 3 +++ lib/src/providers/login_theme.dart | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1bfd6c7e..659580e7 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,9 @@ textFieldStyle | `TextStyle` | Text style for [TextField] input text buttonStyle | `TextStyle` | Text style for button text beforeHeroFontSize | `double` | Defines the font size of the title in the login screen (before the hero transition) afterHeroFontSize | `double` | Defines the font size of the title in the screen after the login screen (after the hero transition) +pageColorLight | `Color` | The optional light background color of login screen; if provided, used for light gradient instead of primaryColor +pageColorDark | `Color` | The optional dark background color of login screen; if provided, used for dark gradient instead of primaryColor + ## Examples diff --git a/lib/src/providers/login_theme.dart b/lib/src/providers/login_theme.dart index 58210922..e2b7b6d7 100644 --- a/lib/src/providers/login_theme.dart +++ b/lib/src/providers/login_theme.dart @@ -54,11 +54,11 @@ class LoginTheme with ChangeNotifier { this.afterHeroFontSize = 15.0, }); - /// The background color of the login page for light gradient; if specified, + /// The background color of the login page for light gradient; if provided, /// overrides the [primaryColor] for page background final Color pageColorLight; - /// The background color of the login page for dark gradient; if specified, + /// The background color of the login page for dark gradient; if provided, /// overrides the computed primaryColorDark for page background final Color pageColorDark;