SnackBar should have a single optional action
The example in the spec with multiple actions is an anti-example. Fixes #1876
This commit is contained in:
@@ -110,11 +110,12 @@ class FeedFragmentState extends State<FeedFragment> {
|
||||
config.onItemDeleted(item);
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text("Item deleted."),
|
||||
actions: <SnackBarAction>[
|
||||
new SnackBarAction(label: "UNDO", onPressed: () {
|
||||
action: new SnackBarAction(
|
||||
label: "UNDO",
|
||||
onPressed: () {
|
||||
config.onItemCreated(item);
|
||||
}),
|
||||
]
|
||||
}
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -32,16 +32,14 @@ class SnackBarDemo extends StatelessComponent {
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text('This is a SnackBar'),
|
||||
actions: <SnackBarAction>[
|
||||
new SnackBarAction(
|
||||
label: 'Action',
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text("You pressed the SnackBar's Action")
|
||||
));
|
||||
}
|
||||
)
|
||||
]
|
||||
action: new SnackBarAction(
|
||||
label: 'Action',
|
||||
onPressed: () {
|
||||
Scaffold.of(context).showSnackBar(new SnackBar(
|
||||
content: new Text("You pressed the SnackBar's Action")
|
||||
));
|
||||
}
|
||||
)
|
||||
));
|
||||
}
|
||||
),
|
||||
|
||||
@@ -210,9 +210,12 @@ class StockHomeState extends State<StockHome> {
|
||||
});
|
||||
_scaffoldKey.currentState.showSnackBar(new SnackBar(
|
||||
content: new Text("Purchased ${stock.symbol} for ${stock.lastSale}"),
|
||||
actions: <SnackBarAction>[
|
||||
new SnackBarAction(label: "BUY MORE", onPressed: () { _buyStock(stock, arrowKey); })
|
||||
]
|
||||
action: new SnackBarAction(
|
||||
label: "BUY MORE",
|
||||
onPressed: () {
|
||||
_buyStock(stock, arrowKey);
|
||||
}
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user