Added backgroundColor to SnackBar (#6929)
This commit is contained in:
@@ -113,6 +113,7 @@ class SnackBar extends StatelessWidget {
|
||||
SnackBar({
|
||||
Key key,
|
||||
this.content,
|
||||
this.backgroundColor,
|
||||
this.action,
|
||||
this.duration: _kSnackBarDisplayDuration,
|
||||
this.animation
|
||||
@@ -125,6 +126,9 @@ class SnackBar extends StatelessWidget {
|
||||
/// Typically a [Text] widget.
|
||||
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.
|
||||
///
|
||||
/// For example, the snack bar might let the user undo the operation that
|
||||
@@ -201,7 +205,7 @@ class SnackBar extends StatelessWidget {
|
||||
},
|
||||
child: new Material(
|
||||
elevation: 6,
|
||||
color: _kSnackBackground,
|
||||
color: backgroundColor ?? _kSnackBackground,
|
||||
child: new Theme(
|
||||
data: darkTheme,
|
||||
child: new FadeTransition(
|
||||
@@ -238,6 +242,7 @@ class SnackBar extends StatelessWidget {
|
||||
return new SnackBar(
|
||||
key: key ?? fallbackKey,
|
||||
content: content,
|
||||
backgroundColor: backgroundColor,
|
||||
action: action,
|
||||
duration: duration,
|
||||
animation: newAnimation
|
||||
|
||||
Reference in New Issue
Block a user