143 lines
4.3 KiB
Dart
143 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:ftc_mobile_app/ftc_mobile_app.dart';
|
|
import 'package:ftc_mobile_app/models/clients/care_note_category.dart';
|
|
import 'package:ftc_mobile_app/view/custom_widgets/clients/CareNoteOptionCard.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
import 'all_care_notes_screen.dart';
|
|
|
|
class CareNotesScreenArgs {
|
|
final String serviceUserId;
|
|
|
|
CareNotesScreenArgs({required this.serviceUserId});
|
|
}
|
|
|
|
class CareNotesScreen extends StatefulWidget {
|
|
final CareNotesScreenArgs args;
|
|
|
|
const CareNotesScreen({super.key, required this.args});
|
|
|
|
@override
|
|
State<CareNotesScreen> createState() => _CareNotesScreenState();
|
|
}
|
|
|
|
class _CareNotesScreenState extends State<CareNotesScreen> {
|
|
final CareNotesScreenController controller =
|
|
Get.put(CareNotesScreenController());
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return CustomScaffold(
|
|
onBackButton: () => controller.backButtonPressed(context),
|
|
backgroundColor: CustomAppColors.kPrimaryColor,
|
|
screenKey: controller.screenKey,
|
|
onScreenTap: controller.removeFocus,
|
|
showAppBar: true,
|
|
appBar: CustomAppBar(
|
|
leadingButton: Container(),
|
|
showBoxShadow: false,
|
|
titleWidget: Row(
|
|
children: [
|
|
InkWell(
|
|
onTap: () => controller.backButtonPressed(context),
|
|
child: CustomImageWidget(
|
|
imagePath: AssetsManager.kBackIcon,
|
|
height: 11.53.h,
|
|
width: 8.66.w,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 15.w,
|
|
),
|
|
CustomTextWidget(
|
|
text: 'Care Notes',
|
|
isExpanded: false,
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w700,
|
|
fontColor: CustomAppColors.kDarkBlueTextColor,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
body: SafeArea(
|
|
child: Padding(
|
|
padding: REdgeInsets.symmetric(horizontal: 18),
|
|
child: ListView(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: AspectRatio(
|
|
aspectRatio: 1,
|
|
child: InkWell(
|
|
onTap: () {
|
|
Navigator.pushNamed(context,
|
|
CustomRouteNames.kAllCareNotesScreenRoute,
|
|
arguments: AllCareNotesScreenArgs(
|
|
serviceUserId: widget.args.serviceUserId));
|
|
},
|
|
child: const CareNoteOptionCard(
|
|
icon: AssetsManager.kIcGeneral,
|
|
name: "All Care Notes",
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const Expanded(child: SizedBox.shrink()),
|
|
],
|
|
),
|
|
16.verticalSpace,
|
|
CustomTextWidget(
|
|
alignment: Alignment.centerLeft,
|
|
isExpanded: false,
|
|
text: "Common Options",
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w700),
|
|
10.verticalSpace,
|
|
_categoriesList(),
|
|
// Flexible(child: ),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _categoriesList() {
|
|
return GridView.builder(
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 2, mainAxisSpacing: 6.r, crossAxisSpacing: 6.r),
|
|
itemCount: controller.categories.length,
|
|
itemBuilder: (_, index) {
|
|
return InkWell(
|
|
onTap: () => _onCategoryCardTap(controller.categories[index]),
|
|
child: CareNoteOptionCard(
|
|
icon: controller.categories[index].iconPath ?? "",
|
|
name: controller.categories[index].category ?? "",
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// ---------Methods-----------
|
|
void _onCategoryCardTap(CareNoteCategory category) {
|
|
Navigator.pushNamed(
|
|
context,
|
|
CustomRouteNames.kCareNotesSubcategoriesScreenRoute,
|
|
arguments: CareNotesSubcategoriesScreenArgs(
|
|
serviceUserId: widget.args.serviceUserId,
|
|
category: category,
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
controller.dispose();
|
|
super.dispose();
|
|
}
|
|
}
|