import 'package:cheminova/controller/home_controller.dart'; import 'package:cheminova/screens/authentication/change_password_screen.dart'; import 'package:cheminova/screens/authentication/login_screen.dart'; import 'package:cheminova/screens/home_screen.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../screens/authentication/Profile.dart'; class MyDrawer extends StatefulWidget { const MyDrawer({super.key}); @override State createState() => _MyDrawerState(); } class _MyDrawerState extends State { final homeController = Get.put(HomeController()); @override Widget build(BuildContext context) { return Drawer( child: ListView( padding: EdgeInsets.zero, children: [ SizedBox( height: 150, child:( DrawerHeader( decoration: const BoxDecoration( color: Colors.black87, ), child: GetBuilder( init: homeController, builder: (controller) { return Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start, children: [ Text( controller.user?.name?? "username", style: const TextStyle( color: Colors.white, fontSize: 18, ), ), Text( controller.user?.uniqueId?? 'Employee ID', style: const TextStyle( color: Colors.white, fontSize: 20, ), ), ], ); } ), ) ), ), ListTile( leading: const Icon(Icons.home), title: const Text('Home'), onTap: () => Get.offAll(() => const HomeScreen()), ), ListTile( leading: const Icon(Icons.account_circle), title: const Text('Profile'), onTap: () { Get.to(ProfileScreen()); }, ), ListTile( leading: const Icon(Icons.settings), title: const Text('Change Password'), onTap: () { Get.to(ChangePasswordScreen()); }, ), ListTile( leading: const Icon(Icons.exit_to_app), title: const Text('Logout'), onTap: () => Get.offAll(() => const LoginScreen()), ), ], ), ); } }