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
41ff8408
Unverified
Commit
41ff8408
authored
May 13, 2019
by
Shi-Hao Hong
Committed by
GitHub
May 13, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Actions to AppBar Sample Doc (#32530)
* Add actions to AppBar sample doc
parent
74d3fe65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
49 deletions
+55
-49
app_bar.dart
packages/flutter/lib/src/material/app_bar.dart
+55
-49
No files found.
packages/flutter/lib/src/material/app_bar.dart
View file @
41ff8408
...
...
@@ -23,11 +23,6 @@ import 'tabs.dart';
import
'text_theme.dart'
;
import
'theme.dart'
;
// Examples can assume:
// void _airDress() { }
// void _restitchDress() { }
// void _repairDress() { }
const
double
_kLeadingWidth
=
kToolbarHeight
;
// So the leading button is square.
// Bottom justify the kToolbarHeight child which may overflow the top.
...
...
@@ -94,29 +89,65 @@ class _ToolbarContainerLayout extends SingleChildLayoutDelegate {
/// to false. In that case a null leading widget will result in the middle/title widget
/// stretching to start.
///
/// {@tool sample}
/// {@tool snippet --template=stateless_widget_material}
///
/// This sample shows an [AppBar] with two simple actions. The first action
/// opens a [SnackBar], while the second action navigates to a new page.
///
/// ```dart preamble
/// final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
/// final SnackBar snackBar = const SnackBar(content: Text('Showing Snackbar'));
///
/// void openPage(BuildContext context) {
/// Navigator.push(context, MaterialPageRoute(
/// builder: (BuildContext context) {
/// return Scaffold(
/// appBar: AppBar(
/// title: const Text('Next page'),
/// ),
/// body: const Center(
/// child: Text(
/// 'This is the next page',
/// style: TextStyle(fontSize: 24),
/// ),
/// ),
/// );
/// },
/// ));
/// }
/// ```
///
/// ```dart
/// AppBar(
/// title: Text('My Fancy Dress'),
/// actions: <Widget>[
/// IconButton(
/// icon: Icon(Icons.playlist_play),
/// tooltip: 'Air it',
/// onPressed: _airDress,
/// ),
/// IconButton(
/// icon: Icon(Icons.playlist_add),
/// tooltip: 'Restitch it',
/// onPressed: _restitchDress,
/// Widget build(BuildContext context) {
/// return Scaffold(
/// key: scaffoldKey,
/// appBar: AppBar(
/// title: const Text('AppBar Demo'),
/// actions: <Widget>[
/// IconButton(
/// icon: const Icon(Icons.add_alert),
/// tooltip: 'Show Snackbar',
/// onPressed: () {
/// scaffoldKey.currentState.showSnackBar(snackBar);
/// },
/// ),
/// IconButton(
/// icon: const Icon(Icons.navigate_next),
/// tooltip: 'Next page',
/// onPressed: () {
/// openPage(context);
/// },
/// ),
/// ],
/// ),
/// IconButton(
/// icon: Icon(Icons.playlist_add_check),
/// tooltip: 'Repair it',
/// onPressed: _repairDress,
/// body: const Center(
/// child: Text(
/// 'This is the home page',
/// style: TextStyle(fontSize: 24),
/// ),
/// ),
///
],
///
)
///
);
///
}
/// ```
/// {@end-tool}
///
...
...
@@ -233,31 +264,6 @@ class AppBar extends StatefulWidget implements PreferredSizeWidget {
/// Typically these widgets are [IconButton]s representing common operations.
/// For less common operations, consider using a [PopupMenuButton] as the
/// last action.
///
/// {@tool snippet --template=stateless_widget_material}
///
/// This sample shows adding an action to an [AppBar] that opens a shopping cart.
///
/// ```dart
/// Widget build(BuildContext context) {
/// return Scaffold(
/// appBar: AppBar(
/// title: Text('Ready, Set, Shop!'),
/// actions: <Widget>[
/// IconButton(
/// icon: Icon(Icons.shopping_cart),
/// tooltip: 'Open shopping cart',
/// onPressed: () {
/// // Implement navigation to shopping cart page here...
/// print('Shopping cart opened.');
/// },
/// ),
/// ],
/// ),
/// );
/// }
/// ```
/// {@end-tool}
final
List
<
Widget
>
actions
;
/// This widget is stacked behind the toolbar and the tab bar. It's height will
...
...
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