File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
packages/flutter/lib/src/material Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -34,11 +34,19 @@ const Duration _kBaseSettleDuration = const Duration(milliseconds: 246);
34
34
/// Typically, the child of the drawer is a [Block] whose first child is a
35
35
/// [DrawerHeader] that displays status information about the current user.
36
36
///
37
+ /// The [Scaffold] automatically shows an appropriate [IconButton] , and handles
38
+ /// the edge-swipe gesture, to show the drawer.
39
+ ///
37
40
/// See also:
38
41
///
39
- /// * [Scaffold.drawer]
40
- /// * [DrawerItem]
41
- /// * [DrawerHeader]
42
+ /// * [Scaffold.drawer] , where one specifies a [Drawer] so that it can be
43
+ /// shown.
44
+ /// * [Scaffold.of] , to obtain the current [ScaffoldState] , which manages the
45
+ /// display and animation of the drawer.
46
+ /// * [ScaffoldState.openDrawer] , which displays its [Drawer] , if any.
47
+ /// * [Navigator.pop] , which closes the drawer if it is open.
48
+ /// * [DrawerItem] , a widget for items in drawers.
49
+ /// * [DrawerHeader] , a widget for the top part of a drawer.
42
50
/// * <https://material.google.com/patterns/navigation-drawer.html>
43
51
class Drawer extends StatelessWidget {
44
52
/// Creates a material design drawer.
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ class DrawerItem extends StatelessWidget {
52
52
/// Called when the user taps this drawer item.
53
53
///
54
54
/// If null, the drawer item is displayed as disabled.
55
+ ///
56
+ /// To close the [Drawer] when an item is pressed, call [Navigator.pop] .
55
57
final VoidCallback onPressed;
56
58
57
59
/// Whether this drawer item is currently selected.
Original file line number Diff line number Diff line change @@ -504,6 +504,12 @@ class ScaffoldState extends State<Scaffold> with TickerProviderStateMixin {
504
504
///
505
505
/// If the scaffold has a non-null [Scaffold.drawer] , this function will cause
506
506
/// the drawer to begin its entrance animation.
507
+ ///
508
+ /// Normally this is not needed since the [Scaffold] automatically shows an
509
+ /// appropriate [IconButton] , and handles the edge-swipe gesture, to show the
510
+ /// drawer.
511
+ ///
512
+ /// To close the drawer once it is open, use [Navigator.pop] .
507
513
void openDrawer () {
508
514
_drawerKey.currentState? .open ();
509
515
}
You can’t perform that action at this time.
0 commit comments