84 lines
3.2 KiB
Dart
84 lines
3.2 KiB
Dart
import 'package:cheminova/provider/home_provider.dart';
|
|
import 'package:cheminova/screens/change_password_screen.dart';
|
|
import 'package:cheminova/screens/home_screen.dart';
|
|
import 'package:cheminova/screens/login_screen.dart';
|
|
import 'package:cheminova/screens/profile_screen.dart';
|
|
import 'package:cheminova/services/secure__storage_service.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class CommonDrawer extends StatelessWidget {
|
|
const CommonDrawer({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Drawer(
|
|
child: ListView(
|
|
padding: EdgeInsets.zero,
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 150,
|
|
child: DrawerHeader(
|
|
decoration: const BoxDecoration(
|
|
color: Colors.black87,
|
|
),
|
|
child: Consumer<HomeProvider>(
|
|
builder: (context, value, child) =>
|
|
(value.profileResponse == null ||
|
|
value.profileResponse!.myData == null ||
|
|
value.profileResponse!.myData!.name == null)
|
|
? const SizedBox()
|
|
: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(value.profileResponse!.myData!.name!,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 18)),
|
|
Text(value.profileResponse!.myData!.uniqueId!,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 15))
|
|
])))),
|
|
ListTile(
|
|
leading: const Icon(Icons.home),
|
|
title: const Text('Home'),
|
|
onTap: () => Navigator.push(context,
|
|
MaterialPageRoute(builder: (context) => const HomePage()))),
|
|
ListTile(
|
|
leading: const Icon(Icons.person),
|
|
title: const Text('Profile'),
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => const ProfileScreen(),
|
|
));
|
|
},
|
|
),
|
|
ListTile(
|
|
leading: const Icon(Icons.settings),
|
|
title: const Text('Change Password'),
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => const ChangePasswordPage(),
|
|
));
|
|
},
|
|
),
|
|
ListTile(
|
|
leading: const Icon(Icons.exit_to_app),
|
|
title: const Text('Logout'),
|
|
onTap: () {
|
|
Provider.of<HomeProvider>(context,listen: false).logOut(context);
|
|
|
|
},
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|