cofounderella/lib/components/my_drawer.dart

204 lines
7.3 KiB
Dart

import 'package:flutter/material.dart';
import '../pages/home_page.dart';
import '../pages/user_data_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.background,
child: CustomScrollView(slivers: [
SliverFillRemaining(
hasScrollBody: false,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
// logo
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: () {
// pop the drawer
Navigator.pop(context);
// Navigate to HomePage?
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) => HomePage(),
),
);
},
),
),
// 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
Navigator.pop(context);
// Navigate to UserProfile
Navigator.push(
context,
MaterialPageRoute(
builder: (BuildContext context) =>
const UserMatchingPage(),
),
);
},
),
),
// chats list tile
Padding(
padding: const EdgeInsets.only(left: 25),
child: ListTile(
title: const Text("Conversations"),
leading: const Icon(Icons.chat),
onTap: () {}, // TODO
),
),
// settings list tile
Padding(
padding: const EdgeInsets.only(left: 25),
child: ListTile(
title: const Text("My Profile"),
leading: const Icon(Icons.settings),
onTap: () {
// pop the drawer and navigate to settings page
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsPage(),
),
);
},
),
),
Padding(
padding: const EdgeInsets.only(left: 25),
child: ListTile(
title: const Text("My Profile Settings"),
leading: const Icon(Icons.edit_note),
onTap: () {
// pop the drawer first, then navigate to destination
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UserProfilePage(),
),
);
},
),
),
// TODO TESTING - user data tile
Padding(
padding: const EdgeInsets.only(left: 25),
child: ListTile(
title: const Text("TESTING - User Data"),
leading: const Icon(Icons.supervised_user_circle),
onTap: () {
// pop the drawer first, then navigate to destination
Navigator.pop(context);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const UserDataPage(
isRegProcess: false,
),
),
);
},
),
),
// horizontal line
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Divider(
color: Theme.of(context).colorScheme.primary,
),
),
// 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();
},
),
),
],
),
),
]),
);
}
}