buildWebHeader method
Implementation
Widget buildWebHeader(BuildContext context) {
List<Widget> newActionsForWeb = actions != null ? List.from(actions!) : [];
if (Get.currentRoute != CommonRoutes.login && showAllApps) {
newActionsForWeb.add(IconButton(
icon: Obx(() {
return Badge.count(
count: homeController.notificationCount.value,
backgroundColor: Colors.redAccent,
textColor: Colors.white,
child: const Icon(CupertinoIcons.bell));
}),
tooltip: 'Notifications',
onPressed: () {
// homeController.toggleNotificationView();
homeController.setEndDrawerContent(context, NotificationView());
},
));
}
if (Get.currentRoute != CommonRoutes.login &&
Get.currentRoute != CommonRoutes.home) {
newActionsForWeb.add(IconButton(
icon: const Icon(Icons.home_rounded),
tooltip: 'Home',
onPressed: onHomeCallback ??
() {
homeController.navigateToHomeScreen();
},
));
}
// Add All Apps icon
if (Get.currentRoute != CommonRoutes.login && showAllApps) {
newActionsForWeb.add(IconButton(
icon: const Icon(CupertinoIcons.square_grid_2x2),
tooltip: 'Main Menu',
onPressed: () {
homeController.setEndDrawerContent(context, AllAppsDrawer());
},
));
}
if (Get.currentRoute != CommonRoutes.login &&
appConfigService.getModuleType() == 0) {
newActionsForWeb.add(buildUserProfile(context));
} else {
if (Get.currentRoute == CommonRoutes.masterDashboardScreen) {
newActionsForWeb.add(buildUserProfile(context));
}
}
return AppBar(
title: title == 'simpliWORKS™'
? Row(
children: [
InkWell(
onTap: Get.currentRoute != CommonRoutes.login
? onHomeCallback ??
() {
homeController.navigateToHomeScreen();
}
: null,
child: headerLogoAsset ?? AppImageAssets(
_themeService.isThemeFromBox()
? 'assets/images/simpliworks_logo_white.png'
: 'assets/images/simpliworks_logo.png',
height: 45.0,
width: 150.0,
fit: BoxFit.contain, // or any fit you need
),
),
],
)
: Row(
children: [
SizedBox(
height: 50.0,
width: 200.0,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppUtils.buildClientLogo(appConfigService.getClientType()),
buildModuleName(context, appConfigService.getModuleType())
],
),
),
],
),
// : AppText(title, style: TextStyles.largeBold(context)),
elevation: 2.0,
backgroundColor: Theme.of(context).drawerTheme.backgroundColor,
surfaceTintColor: Theme.of(context).drawerTheme.backgroundColor,
automaticallyImplyLeading: automaticallyImplyLeading,
actions: newActionsForWeb.isNotEmpty ? newActionsForWeb : null,
bottom: bottom,
centerTitle: centerTitle,
leading: leading,
);
}