Commit 1e76c1f8 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Added backgroundColor to SnackBar (#6929)

parent 5ceaaeef
...@@ -113,6 +113,7 @@ class SnackBar extends StatelessWidget { ...@@ -113,6 +113,7 @@ class SnackBar extends StatelessWidget {
SnackBar({ SnackBar({
Key key, Key key,
this.content, this.content,
this.backgroundColor,
this.action, this.action,
this.duration: _kSnackBarDisplayDuration, this.duration: _kSnackBarDisplayDuration,
this.animation this.animation
...@@ -125,6 +126,9 @@ class SnackBar extends StatelessWidget { ...@@ -125,6 +126,9 @@ class SnackBar extends StatelessWidget {
/// Typically a [Text] widget. /// Typically a [Text] widget.
final Widget content; final Widget content;
/// The Snackbar's background color. By default the color is dark grey.
final Color backgroundColor;
/// (optional) An action that the user can take based on the snack bar. /// (optional) An action that the user can take based on the snack bar.
/// ///
/// For example, the snack bar might let the user undo the operation that /// For example, the snack bar might let the user undo the operation that
...@@ -201,7 +205,7 @@ class SnackBar extends StatelessWidget { ...@@ -201,7 +205,7 @@ class SnackBar extends StatelessWidget {
}, },
child: new Material( child: new Material(
elevation: 6, elevation: 6,
color: _kSnackBackground, color: backgroundColor ?? _kSnackBackground,
child: new Theme( child: new Theme(
data: darkTheme, data: darkTheme,
child: new FadeTransition( child: new FadeTransition(
...@@ -238,6 +242,7 @@ class SnackBar extends StatelessWidget { ...@@ -238,6 +242,7 @@ class SnackBar extends StatelessWidget {
return new SnackBar( return new SnackBar(
key: key ?? fallbackKey, key: key ?? fallbackKey,
content: content, content: content,
backgroundColor: backgroundColor,
action: action, action: action,
duration: duration, duration: duration,
animation: newAnimation animation: newAnimation
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment