import 'package:flutter/material.dart'; import '../pages/conversations_page.dart'; import '../pages/liked_users_page.dart'; import '../pages/settings_page.dart'; import '../pages/user_matching_page.dart'; import '../pages/user_profile_page.dart'; import '../services/auth/auth_service.dart'; import 'feedback_dialog.dart'; import 'my_about_dialog.dart'; class MyDrawer extends StatelessWidget { const MyDrawer({super.key}); @override Widget build(BuildContext context) { return Drawer( backgroundColor: Theme.of(context).colorScheme.surface, child: CustomScrollView(slivers: [ SliverFillRemaining( hasScrollBody: false, child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( children: [ // logo SizedBox( height: 100, child: DrawerHeader( child: Center( child: Icon( Icons.people_alt, color: Theme.of(context).colorScheme.primary, size: 40, ), ), ), ), // home list tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('Home'), leading: const Icon(Icons.home), onTap: () { // home screen is the only place this drawer is used on, // so just pop the drawer, else add page navigation. Navigator.pop(context); }, ), ), // matching list tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('Find Matches'), leading: const Icon(Icons.person_search), onTap: () { // pop the drawer first, then navigate to destination Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) => const UserMatchingPage(), ), ); }, ), ), // liked users tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('Favored Profiles'), leading: const Icon(Icons.format_list_bulleted), onTap: () { Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (BuildContext context) => const LikedUsersPage(), ), ); }, ), ), // chats list tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('Chats'), leading: const Icon(Icons.chat), onTap: () { Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (context) => ConversationsPage(), ), ); }, ), ), Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('My Profile'), leading: const Icon(Icons.edit_note), onTap: () { Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (context) => const UserProfilePage(), ), ); }, ), ), // settings list tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text("App Settings"), leading: const Icon(Icons.settings), onTap: () { Navigator.pop(context); Navigator.push( context, MaterialPageRoute( builder: (context) => const SettingsPage(), ), ); }, ), ), // horizontal line const Padding( padding: EdgeInsets.symmetric(horizontal: 16), child: Divider(), ), // about tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('About the app'), leading: const Icon(Icons.perm_device_info), onTap: () { Navigator.pop(context); showDialog( context: context, builder: (context) => const MyAboutDialog()); }, ), ), // feedback tile Padding( padding: const EdgeInsets.only(left: 25), child: ListTile( title: const Text('Send feedback'), leading: const Icon(Icons.sentiment_satisfied_alt), onTap: () { showDialog( context: context, builder: (context) => const FeedbackDialog()); }, ), ), ], ), // logout list tile Padding( padding: const EdgeInsets.only(left: 25, bottom: 25), child: ListTile( title: const Text('L O G O U T'), leading: const Icon(Icons.logout), onTap: () { Navigator.of(context).pop(); AuthService().signOut(); }, ), ), ], ), ), ]), ); } }