Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
aeb94191
Commit
aeb94191
authored
Feb 21, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2064 from abarth/snackbar_action
SnackBar should have a single optional action
parents
505547ae
72fcbb7d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
22 deletions
+24
-22
feed.dart
examples/fitness/lib/feed.dart
+5
-4
snack_bar_demo.dart
examples/material_gallery/lib/demo/snack_bar_demo.dart
+8
-10
stock_home.dart
examples/stocks/lib/stock_home.dart
+6
-3
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+5
-5
No files found.
examples/fitness/lib/feed.dart
View file @
aeb94191
...
...
@@ -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
);
}
),
]
}
)
));
}
...
...
examples/material_gallery/lib/demo/snack_bar_demo.dart
View file @
aeb94191
...
...
@@ -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"
)
));
}
)
));
}
),
...
...
examples/stocks/lib/stock_home.dart
View file @
aeb94191
...
...
@@ -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
);
}
)
));
}
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
aeb94191
...
...
@@ -74,7 +74,7 @@ class SnackBar extends StatelessComponent {
SnackBar
({
Key
key
,
this
.
content
,
this
.
action
s
,
this
.
action
,
this
.
duration
:
kSnackBarShortDisplayDuration
,
this
.
animation
})
:
super
(
key:
key
)
{
...
...
@@ -82,7 +82,7 @@ class SnackBar extends StatelessComponent {
}
final
Widget
content
;
final
List
<
SnackBarAction
>
actions
;
final
SnackBarAction
action
;
final
Duration
duration
;
final
Animation
<
double
>
animation
;
...
...
@@ -99,8 +99,8 @@ class SnackBar extends StatelessComponent {
)
)
];
if
(
action
s
!=
null
)
children
.
add
All
(
actions
);
if
(
action
!=
null
)
children
.
add
(
action
);
CurvedAnimation
heightAnimation
=
new
CurvedAnimation
(
parent:
animation
,
curve:
_snackBarHeightCurve
);
CurvedAnimation
fadeAnimation
=
new
CurvedAnimation
(
parent:
animation
,
curve:
_snackBarFadeCurve
);
ThemeData
theme
=
Theme
.
of
(
context
);
...
...
@@ -156,7 +156,7 @@ class SnackBar extends StatelessComponent {
return
new
SnackBar
(
key:
key
??
fallbackKey
,
content:
content
,
action
s:
actions
,
action
:
action
,
duration:
duration
,
animation:
newAnimation
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment