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
a2d322c0
Commit
a2d322c0
authored
Mar 30, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3013 from abarth/dismiss_snackbar
Make it possible to dismiss a snackbar manually
parents
040ff9b0
d4febd08
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
17 deletions
+36
-17
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+11
-0
snack_bar.dart
packages/flutter/lib/src/material/snack_bar.dart
+25
-17
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
a2d322c0
...
...
@@ -304,6 +304,17 @@ class ScaffoldState extends State<Scaffold> {
}
}
void
removeCurrentSnackBar
()
{
if
(
_snackBars
.
isEmpty
)
return
;
Completer
<
Null
>
completer
=
_snackBars
.
first
.
_completer
;
if
(!
completer
.
isCompleted
)
completer
.
complete
();
_snackBarTimer
?.
cancel
();
_snackBarTimer
=
null
;
_snackBarController
.
value
=
0.0
;
}
void
_hideSnackBar
()
{
assert
(
_snackBarController
.
status
==
AnimationStatus
.
forward
||
_snackBarController
.
status
==
AnimationStatus
.
completed
);
...
...
packages/flutter/lib/src/material/snack_bar.dart
View file @
a2d322c0
...
...
@@ -7,6 +7,7 @@ import 'package:flutter/widgets.dart';
import
'button.dart'
;
import
'flat_button.dart'
;
import
'material.dart'
;
import
'scaffold.dart'
;
import
'theme_data.dart'
;
import
'theme.dart'
;
import
'typography.dart'
;
...
...
@@ -118,6 +119,12 @@ class SnackBar extends StatelessWidget {
},
child:
new
Semantics
(
container:
true
,
child:
new
Dismissable
(
key:
new
Key
(
'dismissable'
),
direction:
DismissDirection
.
down
,
onDismissed:
(
DismissDirection
direction
)
{
Scaffold
.
of
(
context
).
removeCurrentSnackBar
();
},
child:
new
Material
(
elevation:
6
,
color:
_kSnackBackground
,
...
...
@@ -142,6 +149,7 @@ class SnackBar extends StatelessWidget {
)
)
)
)
);
}
...
...
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