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
32a1c275
Unverified
Commit
32a1c275
authored
Jun 06, 2023
by
Leigha Jarett
Committed by
GitHub
Jun 06, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding example for migrating to navigation drawer (#128295)
Fixes
https://github.com/flutter/flutter/issues/127214
parent
42cf3e37
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
navigation_drawer.1.dart
...i/lib/material/navigation_drawer/navigation_drawer.1.dart
+60
-0
drawer.dart
packages/flutter/lib/src/material/drawer.dart
+6
-0
No files found.
examples/api/lib/material/navigation_drawer/navigation_drawer.1.dart
0 → 100644
View file @
32a1c275
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
/// Flutter code sample for [NavigationDrawer].
void
main
(
)
=>
runApp
(
const
MyApp
());
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
title:
'Flutter Demo'
,
debugShowCheckedModeBanner:
false
,
theme:
ThemeData
(
useMaterial3:
true
,
),
home:
const
MyHomePage
(),
);
}
}
class
MyHomePage
extends
StatelessWidget
{
const
MyHomePage
({
super
.
key
});
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
title:
const
Text
(
'Drawer Demo'
),
),
drawer:
NavigationDrawer
(
children:
<
Widget
>[
Padding
(
padding:
const
EdgeInsets
.
fromLTRB
(
28
,
16
,
16
,
10
),
child:
Text
(
'Drawer Header'
,
style:
Theme
.
of
(
context
).
textTheme
.
titleSmall
,
),
),
const
NavigationDrawerDestination
(
icon:
Icon
(
Icons
.
message
),
label:
Text
(
'Messages'
),
),
const
NavigationDrawerDestination
(
icon:
Icon
(
Icons
.
account_circle
),
label:
Text
(
'Profile'
),
),
const
NavigationDrawerDestination
(
icon:
Icon
(
Icons
.
settings
),
label:
Text
(
'Settings'
),
),
])
);
}
}
packages/flutter/lib/src/material/drawer.dart
View file @
32a1c275
...
@@ -130,6 +130,12 @@ const Duration _kBaseSettleDuration = Duration(milliseconds: 246);
...
@@ -130,6 +130,12 @@ const Duration _kBaseSettleDuration = Duration(milliseconds: 246);
/// ```
/// ```
/// {@end-tool}
/// {@end-tool}
///
///
/// {@tool snippet}
/// This example shows how to migrate the above [Drawer] to a [NavigationDrawer].
///
/// See code in examples/api/lib/material/navigation_drawer/navigation_drawer.1.dart **
/// {@end-tool}
///
/// An open drawer may be closed with a swipe to close gesture, pressing the
/// An open drawer may be closed with a swipe to close gesture, pressing the
/// escape key, by tapping the scrim, or by calling pop route function such as
/// escape key, by tapping the scrim, or by calling pop route function such as
/// [Navigator.pop]. For example a drawer item might close the drawer when tapped:
/// [Navigator.pop]. For example a drawer item might close the drawer when tapped:
...
...
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