This repository has been archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Material Navigation_Drawer in material demo (#340)
- Loading branch information
1 parent
7456f23
commit 8f84336
Showing
7 changed files
with
519 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2019 The Flutter team. 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'; | ||
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
// BEGIN navDrawerDemo | ||
|
||
// Pressing the Navigation Drawer button the left of Appbar to show | ||
// a simple Drawer with Two items. | ||
class NavDrawerDemo extends StatelessWidget { | ||
const NavDrawerDemo({Key key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var localization = GalleryLocalizations.of(context); | ||
final drawerHeader = UserAccountsDrawerHeader( | ||
accountName: Text( | ||
localization.demoNavigationDrawerUserName, | ||
), | ||
accountEmail: Text( | ||
localization.demoNavigationDrawerUserEmail, | ||
), | ||
currentAccountPicture: const CircleAvatar( | ||
child: FlutterLogo(size: 42.0), | ||
), | ||
); | ||
final drawerItems = ListView( | ||
children: [ | ||
drawerHeader, | ||
ListTile( | ||
title: Text( | ||
localization.demoNavigationDrawerToPageOne, | ||
), | ||
leading: const Icon(Icons.favorite), | ||
onTap: () { | ||
Navigator.pop(context); | ||
}, | ||
), | ||
ListTile( | ||
title: Text( | ||
localization.demoNavigationDrawerToPageTwo, | ||
), | ||
leading: const Icon(Icons.comment), | ||
onTap: () { | ||
Navigator.pop(context); | ||
}, | ||
), | ||
], | ||
); | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text( | ||
localization.demoNavigationDrawerTitle, | ||
), | ||
), | ||
body: Center( | ||
child: Padding( | ||
padding: const EdgeInsets.all(50.0), | ||
child: Text( | ||
localization.demoNavigationDrawerText, | ||
), | ||
), | ||
), | ||
drawer: Drawer( | ||
child: drawerItems, | ||
), | ||
); | ||
} | ||
} | ||
|
||
// END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.