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/screens/home/dashboard_screen.dart

199 lines
6.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
import 'package:get/get.dart';
import 'home_screen.dart';
class DashboardScreen extends StatefulWidget {
const DashboardScreen({Key? key}) : super(key: key);
@override
State<DashboardScreen> createState() => _DashboardScreenState();
}
class _DashboardScreenState extends State<DashboardScreen> {
final controller = Get.put(DashboardScreenController());
@override
Widget build(BuildContext context) {
return CustomScaffold(
appBar: appBar,
sideDrawer: const CustomDrawer(),
bottomMenu: Obx(
() => BottomNavigationBar(
type: BottomNavigationBarType.fixed,
currentIndex: controller.selectedIndex.value,
onTap: (value) {
if (value == 0) {
Navigator.pushNamed(
context, CustomRouteNames.kRotaDashboardScreenRoute);
return;
}
controller.selectedIndex.value = value;
},
items: [
BottomNavigationBarItem(
label: "",
icon: Column(
children: [
CustomImageWidget(
imagePath: AssetsManager.kCalendarIcon,
height: 26.h,
width: 26.w,
imageColor: controller.selectedIndex.value == 0
? CustomAppColors.kSecondaryColor
: null,
),
CustomTextWidget(
text: "Rota",
isExpanded: false,
fontSize: 12.sp,
fontColor: controller.selectedIndex.value == 0
? CustomAppColors.kSecondaryColor
: null),
],
),
),
BottomNavigationBarItem(
label: "",
icon: Column(
children: [
CustomImageWidget(
imagePath: AssetsManager.kHomeIcon,
height: 26.h,
width: 26.w,
imageColor: controller.selectedIndex.value == 1
? CustomAppColors.kSecondaryColor
: null,
),
CustomTextWidget(
text: "Dashboard",
isExpanded: false,
fontSize: 12.sp,
fontColor: controller.selectedIndex.value == 1
? CustomAppColors.kSecondaryColor
: null,
),
],
),
),
BottomNavigationBarItem(
label: "",
icon: Column(
children: [
CustomImageWidget(
imagePath: AssetsManager.kMessageIcon,
height: 26.h,
width: 26.w,
imageColor: controller.selectedIndex.value == 2
? CustomAppColors.kSecondaryColor
: null,
),
CustomTextWidget(
text: "Inbox",
isExpanded: false,
fontSize: 12.sp,
fontColor: controller.selectedIndex.value == 2
? CustomAppColors.kSecondaryColor
: null,
),
],
),
),
BottomNavigationBarItem(
label: "",
icon: Column(
children: [
CustomImageWidget(
imagePath: AssetsManager.kPeopleUnselectedIcon,
height: 26.h,
width: 26.w,
imageColor: controller.selectedIndex.value == 3
? CustomAppColors.kSecondaryColor
: null,
),
CustomTextWidget(
text: "Clients",
isExpanded: false,
fontSize: 12.sp,
fontColor: controller.selectedIndex.value == 3
? CustomAppColors.kSecondaryColor
: null,
),
],
),
),
],
),
),
backgroundColor: CustomAppColors.kPrimaryColor,
screenKey: controller.screenKey,
onScreenTap: controller.removeFocus,
showAppBar: true,
body: SafeArea(
child: Obx(() => selectedScreen()[controller.selectedIndex.value])),
);
}
PreferredSizeWidget get appBar => CustomAppBar(
showBoxShadow: false,
titleWidget: Row(
children: [
InkWell(
onTap: () => controller.screenKey.currentState!.openDrawer(),
child: CustomImageWidget(
imagePath: AssetsManager.kDrawerIcon,
height: 27.h,
width: 27.w,
),
),
Padding(
padding: EdgeInsets.only(left: 15.0.w),
child: Obx(() {
return CustomTextWidget(
text: controller.selectedIndex.value == 0
? 'Home'
: controller.selectedIndex.value == 1
? 'Home'
: controller.selectedIndex.value == 2
? 'Inbox'
: controller.selectedIndex.value == 3
? 'Clients'
: "",
isExpanded: false,
fontSize: 16.sp,
fontWeight: FontWeight.w700,
fontColor: CustomAppColors.kDarkBlueTextColor,
);
}),
),
const Spacer(),
Obx(() {
return Visibility(
visible: controller.selectedIndex.value == 0,
child: CustomImageWidget(
imagePath: AssetsManager.kBellIcon,
height: 23.h,
width: 22.w,
),
);
}),
],
),
);
List<Widget> selectedScreen() {
return <Widget>[
const RotaDashboardScreen(),
const HomeScreen(),
const InboxScreen(),
const ClientsListScreen(),
];
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
}