Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/material.dart';
- class Drawer extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Drawer(
- // Add a ListView to the drawer. This ensures the user can scroll
- // through the options in the drawer if there isn't enough vertical
- // space to fit everything.
- child: ListView(
- // Important: Remove any padding from the ListView.
- padding: EdgeInsets.zero,
- children: <Widget>[
- DrawerHeader(
- child: Text('Drawer Header'),
- decoration: BoxDecoration(
- color: Colors.blue,
- ),
- ),
- ListTile(
- title: Text('Item 1'),
- onTap: () {
- // Update the state of the app
- // ...
- // Then close the drawer
- Navigator.pop(context);
- },
- ),
- ListTile(
- title: Text('Item 2'),
- onTap: () {
- // Update the state of the app
- // ...
- // Then close the drawer
- Navigator.pop(context);
- },
- ),
- ],
- ),
- ),
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement