Skip to content

Commit 7e6aa6d

Browse files
authored
Clarify AppBar.actions (flutter#6700)
Closes flutter#6125
1 parent b47b16f commit 7e6aa6d

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

packages/flutter/lib/src/material/app_bar.dart

+26-6
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,13 @@ class _AppBarExpandedHeight extends InheritedWidget {
125125
///
126126
/// See also:
127127
///
128-
/// * [Scaffold]
129-
/// * [TabBar]
130-
/// * [IconButton]
131-
/// * [PopupMenuButton]
132-
/// * [FlexibleSpaceBar]
128+
/// * [Scaffold], which displays the [AppBar] in its [Scaffold.appBar] slot.
129+
/// * [TabBar], which is typically placed in the [bottom] slot of the [AppBar]
130+
/// if the screen has multiple pages arranged in tabs.
131+
/// * [IconButton], which is used with [actions] to show buttons on the app bar.
132+
/// * [PopupMenuButton], to show a popup menu on the app bar, via [actions].
133+
/// * [FlexibleSpaceBar], which is used with [flexibleSpace] when the app bar
134+
/// can expand and collapse.
133135
/// * <https://material.google.com/layout/structure.html#structure-toolbars>
134136
class AppBar extends StatelessWidget {
135137
/// Creates a material design app bar.
@@ -172,11 +174,29 @@ class AppBar extends StatelessWidget {
172174
/// of the app.
173175
final Widget title;
174176

175-
/// Widgets to display after the title widget.
177+
/// Widgets to display after the [title] widget.
176178
///
177179
/// Typically these widgets are [IconButton]s representing common operations.
178180
/// For less common operations, consider using a [PopupMenuButton] as the
179181
/// last action.
182+
///
183+
/// For example:
184+
///
185+
/// ```dart
186+
/// return new Scaffold(
187+
/// appBar: new AppBar(
188+
/// title: new Text('Hello World'),
189+
/// actions: <Widget>[
190+
/// new IconButton(
191+
/// icon: new Icon(Icons.shopping_cart),
192+
/// tooltip: 'Open shopping cart',
193+
/// onPressed: _openCart,
194+
/// ),
195+
/// ]
196+
/// ),
197+
/// body: _buildBody(),
198+
/// );
199+
/// ```
180200
final List<Widget> actions;
181201

182202
/// This widget is stacked behind the toolbar and the tabbar and it is not

0 commit comments

Comments
 (0)