Advertisement
Guest User

Untitled

a guest
Jul 10th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.19 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. class Drawer extends StatelessWidget {
  4.   @override
  5.   Widget build(BuildContext context) {
  6.     return Drawer(
  7.       // Add a ListView to the drawer. This ensures the user can scroll
  8.       // through the options in the drawer if there isn't enough vertical
  9.       // space to fit everything.
  10.       child: ListView(
  11.         // Important: Remove any padding from the ListView.
  12.         padding: EdgeInsets.zero,
  13.         children: <Widget>[
  14.           DrawerHeader(
  15.             child: Text('Drawer Header'),
  16.             decoration: BoxDecoration(
  17.               color: Colors.blue,
  18.             ),
  19.           ),
  20.           ListTile(
  21.             title: Text('Item 1'),
  22.             onTap: () {
  23.               // Update the state of the app
  24.               // ...
  25.               // Then close the drawer
  26.               Navigator.pop(context);
  27.             },
  28.           ),
  29.           ListTile(
  30.             title: Text('Item 2'),
  31.             onTap: () {
  32.               // Update the state of the app
  33.               // ...
  34.               // Then close the drawer
  35.               Navigator.pop(context);
  36.             },
  37.           ),
  38.         ],
  39.       ),
  40.     ),
  41.   }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement