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
e0a9c0a9
Commit
e0a9c0a9
authored
Nov 22, 2016
by
Adam Barth
Committed by
GitHub
Nov 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Scaffold.drawer and Navigator.popUntil docs (#6977)
Fixes #6963
parent
8ca4caa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
13 deletions
+49
-13
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+37
-13
navigator.dart
packages/flutter/lib/src/widgets/navigator.dart
+12
-0
No files found.
packages/flutter/lib/src/material/scaffold.dart
View file @
e0a9c0a9
...
@@ -292,13 +292,23 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
...
@@ -292,13 +292,23 @@ class _FloatingActionButtonTransitionState extends State<_FloatingActionButtonTr
///
///
/// See also:
/// See also:
///
///
/// * [AppBar]
/// * [AppBar], which is a horizontal bar typically shown at the top of an app
/// * [FloatingActionButton]
/// using the [appBar] property.
/// * [Drawer]
/// * [FloatingActionButton], which is a circular button typically shown in the
/// * [BottomNavigationBar]
/// bottom right corner of the app using the [floatingActionButton] property.
/// * [SnackBar]
/// * [Drawer], which is a vertical panel that is typically displayed to the
/// * [BottomSheet]
/// left of the body (and often hidden on phones) using the [drawer]
/// * [ScaffoldState]
/// property.
/// * [BottomNavigationBar], which is a horizontal array of buttons typically
/// shown along the bottom of the app using the [bottomNavigationBar]
/// property.
/// * [SnackBar], which is a temporary notification typically shown near the
/// bottom of the app using the [ScaffoldState.showSnackBar] method.
/// * [BottomSheet], which is an overlay typically shown near the bottom of the
/// app. A bottom sheet can either be persistent, in which case it is shown
/// using the [ScaffoldState.showBottomSheet] method, or modal, in which case
/// it is shown using the [showModalBottomSheet] function.
/// * [ScaffoldState], which is the state associated with this widget.
/// * <https://material.google.com/layout/structure.html>
/// * <https://material.google.com/layout/structure.html>
class
Scaffold
extends
StatefulWidget
{
class
Scaffold
extends
StatefulWidget
{
/// Creates a visual scaffold for material design widgets.
/// Creates a visual scaffold for material design widgets.
...
@@ -341,7 +351,7 @@ class Scaffold extends StatefulWidget {
...
@@ -341,7 +351,7 @@ class Scaffold extends StatefulWidget {
/// [LazyScrollableList], or [MaterialList] as the body of the scaffold.
/// [LazyScrollableList], or [MaterialList] as the body of the scaffold.
final
Widget
body
;
final
Widget
body
;
/// A button displayed
on top of the [body]
.
/// A button displayed
floating above [body], in the bottom right corner
.
///
///
/// Typically a [FloatingActionButton].
/// Typically a [FloatingActionButton].
final
Widget
floatingActionButton
;
final
Widget
floatingActionButton
;
...
@@ -358,15 +368,23 @@ class Scaffold extends StatefulWidget {
...
@@ -358,15 +368,23 @@ class Scaffold extends StatefulWidget {
/// * <https://material.google.com/components/buttons.html#buttons-persistent-footer-buttons>
/// * <https://material.google.com/components/buttons.html#buttons-persistent-footer-buttons>
final
List
<
Widget
>
persistentFooterButtons
;
final
List
<
Widget
>
persistentFooterButtons
;
/// A panel displayed to the side of the [body], often hidden on mobile devices.
/// A panel displayed to the side of the [body], often hidden on mobile
/// devices.
///
/// If the [appBar] lacks an [AppBar.leading] widget, the scaffold will add a
/// button that opens the drawer. The scaffold will also open the drawer if
/// the user drags from the left edge of the scaffold.
///
/// In the uncommon case that you wish to open the drawer manually, use the
/// [ScaffoldState.openDrawer] function.
///
///
/// Typically a [Drawer].
/// Typically a [Drawer].
final
Widget
drawer
;
final
Widget
drawer
;
/// A bottom navigation bar to display at the bottom of the scaffold.
/// A bottom navigation bar to display at the bottom of the scaffold.
///
///
/// Snack bars slide from underneath the botto
n navigation while bottom sheets
/// Snack bars slide from underneath the botto
m navigation bar while bottom
/// are stacked on top.
///
sheets
are stacked on top.
final
Widget
bottomNavigationBar
;
final
Widget
bottomNavigationBar
;
/// The key of the primary [Scrollable] widget in the [body].
/// The key of the primary [Scrollable] widget in the [body].
...
@@ -511,6 +529,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -511,6 +529,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
/// drawer.
/// drawer.
///
///
/// To close the drawer once it is open, use [Navigator.pop].
/// To close the drawer once it is open, use [Navigator.pop].
///
/// See [Scaffold.of] for information about how to obtain the [ScaffoldState].
void
openDrawer
()
{
void
openDrawer
()
{
_drawerKey
.
currentState
?.
open
();
_drawerKey
.
currentState
?.
open
();
}
}
...
@@ -532,6 +552,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -532,6 +552,8 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
///
///
/// To remove a [SnackBar] suddenly (without an animation), use
/// To remove a [SnackBar] suddenly (without an animation), use
/// [removeCurrentSnackBar].
/// [removeCurrentSnackBar].
///
/// See [Scaffold.of] for information about how to obtain the [ScaffoldState].
ScaffoldFeatureController
<
SnackBar
,
Null
>
showSnackBar
(
SnackBar
snackbar
)
{
ScaffoldFeatureController
<
SnackBar
,
Null
>
showSnackBar
(
SnackBar
snackbar
)
{
_snackBarController
??=
SnackBar
.
createAnimationController
(
vsync:
this
)
_snackBarController
??=
SnackBar
.
createAnimationController
(
vsync:
this
)
..
addStatusListener
(
_handleSnackBarStatusChange
);
..
addStatusListener
(
_handleSnackBarStatusChange
);
...
@@ -626,8 +648,10 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
...
@@ -626,8 +648,10 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
///
///
/// See also:
/// See also:
///
///
/// * [BottomSheet]
/// * [BottomSheet], which is the widget typicaly returned by the `builder`.
/// * [showModalBottomSheet]
/// * [showModalBottomSheet], which can be used to display a modal bottom
/// sheet.
/// * [Scaffold.of], for information about how to obtain the [ScaffoldState].
/// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-persistent-bottom-sheets>
/// * <https://material.google.com/components/bottom-sheets.html#bottom-sheets-persistent-bottom-sheets>
PersistentBottomSheetController
<
dynamic
/*=T*/
>
showBottomSheet
/*<T>*/
(
WidgetBuilder
builder
)
{
PersistentBottomSheetController
<
dynamic
/*=T*/
>
showBottomSheet
/*<T>*/
(
WidgetBuilder
builder
)
{
if
(
_currentBottomSheet
!=
null
)
{
if
(
_currentBottomSheet
!=
null
)
{
...
...
packages/flutter/lib/src/widgets/navigator.dart
View file @
e0a9c0a9
...
@@ -330,6 +330,15 @@ class Navigator extends StatefulWidget {
...
@@ -330,6 +330,15 @@ class Navigator extends StatefulWidget {
///
///
/// The predicate may be applied to the same route more than once if
/// The predicate may be applied to the same route more than once if
/// [Route.willHandlePopInternally] is true.
/// [Route.willHandlePopInternally] is true.
///
/// To pop until a route with a certain name, use the [RoutePredicate]
/// returned from [ModalRoute.withName].
///
/// Typical usage is as follows:
///
/// ```dart
/// Navigator.popUntil(context, ModalRoute.withName('/login'));
/// ```
static
void
popUntil
(
BuildContext
context
,
RoutePredicate
predicate
)
{
static
void
popUntil
(
BuildContext
context
,
RoutePredicate
predicate
)
{
Navigator
.
of
(
context
).
popUntil
(
predicate
);
Navigator
.
of
(
context
).
popUntil
(
predicate
);
}
}
...
@@ -622,6 +631,9 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
...
@@ -622,6 +631,9 @@ class NavigatorState extends State<Navigator> with TickerProviderStateMixin {
///
///
/// The predicate may be applied to the same route more than once if
/// The predicate may be applied to the same route more than once if
/// [Route.willHandlePopInternally] is true.
/// [Route.willHandlePopInternally] is true.
///
/// To pop until a route with a certain name, use the [RoutePredicate]
/// returned from [ModalRoute.withName].
void
popUntil
(
RoutePredicate
predicate
)
{
void
popUntil
(
RoutePredicate
predicate
)
{
while
(!
predicate
(
_history
.
last
))
while
(!
predicate
(
_history
.
last
))
pop
();
pop
();
...
...
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