Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

Added Material Navigation_Drawer in material demo #340

Merged
merged 17 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration_test/gallery_compile_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:test/test.dart';
import 'package:path/path.dart' as path;

// Benchmark size in kB.
const int bundleSizeBenchmark = 4500;
const int bundleSizeBenchmark = 5000;
const int gzipBundleSizeBenchmark = 1200;

void main() {
Expand Down
335 changes: 335 additions & 0 deletions lib/codeviewer/code_segments.dart

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions lib/data/demos.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import 'package:gallery/demos/material/dialog_demo.dart';
import 'package:gallery/demos/material/grid_list_demo.dart';
import 'package:gallery/demos/material/list_demo.dart';
import 'package:gallery/demos/material/menu_demo.dart';
import 'package:gallery/demos/material/navigation_drawer.dart';
import 'package:gallery/demos/material/picker_demo.dart';
import 'package:gallery/demos/material/progress_indicator_demo.dart';
import 'package:gallery/demos/material/selection_controls_demo.dart';
Expand Down Expand Up @@ -521,6 +522,22 @@ List<GalleryDemo> materialDemos(GalleryLocalizations localizations) {
],
category: GalleryDemoCategory.material,
),
GalleryDemo(
title: localizations.demoNavigationDrawerTitle,
icon: GalleryIcons.menu,
slug: 'nav_drawer',
subtitle: localizations.demoNavigationDrawerSubtitle,
configurations: [
GalleryDemoConfiguration(
title: localizations.demoNavigationDrawerTitle,
description: localizations.demoNavigationDrawerDescription,
documentationUrl: '$_docsBaseUrl/material/Drawer-class.html',
buildRoute: (_) => const NavDrawerDemo(),
code: CodeSegments.navDrawerDemo,
),
],
category: GalleryDemoCategory.material,
),
GalleryDemo(
title: localizations.demoPickersTitle,
icon: GalleryIcons.event,
Expand Down
74 changes: 74 additions & 0 deletions lib/demos/material/navigation_drawer.dart
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(
rami-a marked this conversation as resolved.
Show resolved Hide resolved
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
32 changes: 32 additions & 0 deletions lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1081,6 +1081,38 @@
}
}
},
"demoNavigationDrawerTitle": "Navigation Drawer",
"@demoNavigationDrawerTitle": {
"description": "Title for the material drawer component demo."
},
"demoNavigationDrawerSubtitle": "Displaying a drawer within appbar",
"@demoNavigationDrawerSubtitle": {
"description": "Subtitle for the material drawer component demo."
},
"demoNavigationDrawerDescription": "A Material Design panel that slides in horizontally from the edge of the screen to show navigation links in an application.",
"@demoNavigationDrawerDescription": {
"description": "Description for the material drawer component demo."
},
"demoNavigationDrawerUserName": "User Name",
"@demoNavigationDrawerUserName": {
"description": "Demo username for navigation drawer."
},
"demoNavigationDrawerUserEmail": "user.name@example.com",
"@demoNavigationDrawerUserEmail": {
"description": "Demo email for navigation drawer."
},
"demoNavigationDrawerToPageOne": "Item One",
"@demoNavigationDrawerToPageOne": {
"description": "Drawer Item One."
},
"demoNavigationDrawerToPageTwo": "Item Two",
"@demoNavigationDrawerToPageTwo": {
"description": "Drawer Item Two."
},
"demoNavigationDrawerText": "Swipe from the edge or tap the upper-left icon to see the drawer",
"@demoNavigationDrawerText": {
"description": "Description to open navigation drawer."
},
"demoMenuAnItemWithASimpleMenu": "An item with a simple menu",
"@demoMenuAnItemWithASimpleMenu": {
"description": "Label next to a button that opens a simple menu. A menu displays a list of choices on a temporary surface. Used as an example in a demo."
Expand Down
32 changes: 32 additions & 0 deletions lib/l10n/intl_en_US.xml
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,38 @@
name="demoMenuChecked"
description="A text to show what value was checked."
>Checked: {value}</string>
<string
name="demoNavigationDrawerTitle"
description="Title for the material drawer component demo."
>Navigation Drawer</string>
<string
name="demoNavigationDrawerSubtitle"
description="Subtitle for the material drawer component demo."
>Displaying a drawer within appbar</string>
<string
name="demoNavigationDrawerDescription"
description="Description for the material drawer component demo."
>A Material Design panel that slides in horizontally from the edge of the screen to show navigation links in an application.</string>
<string
name="demoNavigationDrawerUserName"
description="Demo username for navigation drawer."
>User Name</string>
<string
name="demoNavigationDrawerUserEmail"
description="Demo email for navigation drawer."
>user.name@example.com</string>
<string
name="demoNavigationDrawerToPageOne"
description="Drawer Item One."
>Item One</string>
<string
name="demoNavigationDrawerToPageTwo"
description="Drawer Item Two."
>Item Two</string>
<string
name="demoNavigationDrawerText"
description="Description to open navigation drawer."
>Swipe from the edge or tap the upper-left icon to see the drawer</string>
<string
name="demoMenuAnItemWithASimpleMenu"
description="Label next to a button that opens a simple menu. A menu displays a list of choices on a temporary surface. Used as an example in a demo."
Expand Down
Loading