Skip to content

Commit

Permalink
Merge pull request #12 from doc-rj-celltrak/rjones_page_color
Browse files Browse the repository at this point in the history
Optional config for login screen background color gradients (independent of primaryColor)
  • Loading branch information
NearHuscarl committed Dec 8, 2019
2 parents 8f6186f + d490c6f commit b453583
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -76,6 +76,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

Expand Down
5 changes: 4 additions & 1 deletion lib/flutter_login.dart
Expand Up @@ -517,7 +517,10 @@ class _FlutterLoginState extends State<FlutterLogin>
body: Stack(
children: <Widget>[
GradientBox(
colors: [theme.primaryColor, theme.primaryColorDark],
colors: [
loginTheme.pageColorLight ?? theme.primaryColor,
loginTheme.pageColorDark ?? theme.primaryColorDark,
],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
Expand Down
10 changes: 10 additions & 0 deletions lib/src/providers/login_theme.dart
Expand Up @@ -36,6 +36,8 @@ class LoginButtonTheme {

class LoginTheme with ChangeNotifier {
LoginTheme({
this.pageColorLight,
this.pageColorDark,
this.primaryColor,
this.accentColor,
this.errorColor,
Expand All @@ -52,6 +54,14 @@ class LoginTheme with ChangeNotifier {
this.afterHeroFontSize = 15.0,
});

/// 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 provided,
/// 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;
Expand Down

0 comments on commit b453583

Please sign in to comment.