flutter_tutorial/lib/AppDrawer.dart

98 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'listViewPage.dart';
import 'buttonPage.dart';
import 'AlertDialogPage.dart';
import 'snackbarPage.dart';
class AppDrawer extends StatefulWidget {
const AppDrawer({super.key});
@override
State<AppDrawer> createState() => _AppDrawerState();
}
class _AppDrawerState extends State<AppDrawer>{
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(
decoration: BoxDecoration(
color: Colors.blue,
),
child: Text(
'App Menu',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
),
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
onTap: () {
Navigator.pop(context);
},
),
ListTile(
leading: Icon(Icons.list),
title: Text('List View'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ListViewPage()),
);
},
),
ListTile(
leading: Icon(Icons.input),
title: Text('Button Page'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ButtonPage()),
);
},
),
ListTile(
leading: Icon(Icons.warning),
title: Text('Alert Dialog'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => AlertDialogPage()),
);
},
),
ListTile(
leading: Icon(Icons.notifications),
title: Text('Snackbar'),
onTap: () {
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SnackbarPage()),
);
},
),
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
onTap: () {
Navigator.pop(context);
// Navigate to settings page
},
),
],
),
);
}
}