mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
61 lines
1.5 KiB
Dart
61 lines
1.5 KiB
Dart
// 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'),
|
|
),
|
|
])
|
|
);
|
|
}
|
|
}
|