This repository has been archived on 2024-10-18. You can view files and clone it, but cannot push or open issues or pull requests.
ftc_patient_app/lib/view/custom_widgets/custom_navigation_drawer.dart

191 lines
7.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:ftc_mobile_app/view/screens/webview/webview_screen.dart';
import 'package:get/get.dart';
import 'my_circle_image.dart';
class CustomDrawer extends StatefulWidget {
const CustomDrawer({Key? key}) : super(key: key);
@override
State<CustomDrawer> createState() => _CustomDrawerState();
}
class _CustomDrawerState extends State<CustomDrawer> {
DashboardScreenController dashboardController =
Get.put(DashboardScreenController());
CustomNavigationDrawerController drawerController =
Get.put(CustomNavigationDrawerController());
@override
Widget build(BuildContext context) {
return Drawer(
elevation: 5,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(1.r)),
backgroundColor: CustomAppColors.kPrimaryColor,
surfaceTintColor: CustomAppColors.kPrimaryColor,
child: SafeArea(
child: Column(
children: [
40.verticalSpace,
SizedBox(
width: double.infinity,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Center(
child: GestureDetector(
onTap: () {
// drawerController.selectedIndex.value = -1;
// Navigator.pop(context);
// Navigator.pushNamed(
// context, CustomRouteNames.kViewProfileScreenRoute);
},
child: Obx(() {
return MyCircleImage(
imageSize: 80.r,
url:
"${WebUrls.baseUrl}${DashboardScreenController.instance.myProfileData()?.profilePictureUrl ?? ""}",
errorWidget: CustomImageWidget(
imagePath: AssetsManager.kPersonMainIcon,
imageColor: CustomAppColors.kDarkBlueTextColor,
height: 80.r,
width: 80.r,
),
);
}),
),
),
10.verticalSpace,
Obx(
() => CustomTextWidget(
text: DashboardScreenController.instance
.myProfileData()
?.displayName ??
"",
textAlign: TextAlign.center,
fontColor: CustomAppColors.kBlackColor,
fontWeight: FontWeight.w600,
fontSize: 14.sp,
),
),
],
),
),
Expanded(
child: Container(
width: double.infinity,
padding: EdgeInsets.only(top: 20.h, bottom: 20.h),
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
children: [
_getDrawerNavItem(
title: "Home",
iconPath: AssetsManager.kHomeIcon,
color: CustomAppColors.kLightGreyColor,
selected: drawerController.selectedIndex.value == 1,
onTap: () {
Navigator.pop(context);
dashboardController.selectedIndex.value = 1;
drawerController.selectedIndex.value = 1;
}),
6.verticalSpace,
_getDrawerNavItem(
title: "Policies and Procedures",
iconPath: AssetsManager.kPoliciesIcon,
color: CustomAppColors.kLightGreyColor,
onTap: () {
Navigator.pop(context);
Navigator.pushNamed(
context,
CustomRouteNames.kWebviewScreen,
arguments: WebviewScreenArgument(
title: 'Policies and Procedures',
url: ConstantText.privacyUrl),
);
}),
6.verticalSpace,
_getDrawerNavItem(
title: "Settings",
iconPath: AssetsManager.kSettingsIcon,
color: CustomAppColors.kLightGreyColor,
onTap: () {
Navigator.pop(context);
//Todo: uncomment when start working
// Navigator.pushNamed(
// context,
// CustomRouteNames.kSettingsScreen,
// );
}),
6.verticalSpace,
_getDrawerNavItem(
title: "Notifications",
iconPath: AssetsManager.kBellIcon,
color: CustomAppColors.kLightGreyColor,
selected: drawerController.selectedIndex.value == 6,
onTap: () {
Navigator.pop(context);
//Todo: uncomment
// Navigator.pushNamed(
// context,
// CustomRouteNames.kNotificationListScreenRoute,
// );
}),
],
),
),
),
],
),
),
);
}
Widget _getDrawerNavItem(
{required String title,
required String iconPath,
Color color = CustomAppColors.kSecondaryColor,
bool selected = false,
required Function() onTap}) {
return Container(
color: selected
? CustomAppColors.kSecondaryColor
: CustomAppColors.kPrimaryColor,
padding: REdgeInsets.symmetric(horizontal: 26, vertical: 12),
child: GestureDetector(
onTap: onTap,
// onTap: ()=> controller.onTap(title),
child: Row(
children: [
// Icon(
// icon,
// size: 27,
// color: selected ? CustomAppColors.kWhiteColor : color,
// ),
CustomImageWidget(
imagePath: iconPath,
width: title == "Clients" ? 20.w : 22.w,
height: title == "Clients" ? 20.h : 26.h,
// height: 26.h,
imageColor: selected ? CustomAppColors.kWhiteColor : color,
),
10.horizontalSpace,
Expanded(
child: CustomTextWidget(
text: title,
textAlign: TextAlign.left,
fontColor: selected
? CustomAppColors.kWhiteColor
: CustomAppColors.kIconColor,
fontSize: 18.sp,
),
),
],
),
),
);
}
}