import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Custom Drawer Menu'),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
radius: 50,
backgroundImage: AssetImage('assets/profile_picture.jpg'),
),
SizedBox(height: 10),
Text(
'John Doe',
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
],
),
),
ListTile(
title: Text('Item 1'),
onTap: () {
Navigator.pop(context);
// Handle item 1 tap
},
),
ListTile(
title: Text('Item 2'),
onTap: () {
Navigator.pop(context);
// Handle item 2 tap
},
),
// Add more ListTile widgets for additional items
],
),
),
body: Center(
child: Text('Drawer Example'),
),
);
}
}
DrawerHeader()