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/clients/notes_screen.dart

209 lines
6.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../ftc_mobile_app.dart';
class NotesScreen extends StatefulWidget {
const NotesScreen({Key? key}) : super(key: key);
@override
State<NotesScreen> createState() => _NotesScreenState();
}
class _NotesScreenState extends State<NotesScreen> {
NotesScreenController controller =
Get.put(NotesScreenController());
@override
Widget build(BuildContext context) {
return CustomScaffold(
floatingActionButton: FloatingActionButton(
onPressed: () {
Navigator.pushNamed(
controller.screenKey.currentContext!,
CustomRouteNames.kNewNoteScreenRoute,
);
},
shape: const CircleBorder(),
backgroundColor: CustomAppColors.kPrimaryColor,
child: CustomImageWidget(
imagePath: AssetsManager.kPlusIcon,
height: 35.h,
width: 35.w,
imageColor: CustomAppColors.kSecondaryColor,
),
),
backgroundColor: CustomAppColors.kPrimaryColor,
screenKey: controller.screenKey,
onScreenTap: controller.removeFocus,
showAppBar: true,
appBar: CustomAppBar(
leadingButton: Container(),
showBoxShadow: false,
titleWidget: Row(
children: [
InkWell(
onTap: () {
Navigator.pop(context);
},
child: CustomImageWidget(
imagePath: AssetsManager.kBackIcon,
height: 11.53.h,
width: 8.66.w,
),
),
SizedBox(width: 15.w,),
CustomTextWidget(
text: 'Notes for ${controller.user.name}',
isExpanded: false,
fontSize: 16.sp,
fontWeight: FontWeight.w700,
fontColor: CustomAppColors.kDarkBlueTextColor,
),
],
),
),
body: Center(
child: SingleChildScrollView(
child: Column(
children: [
Container(
height: 40,
margin: EdgeInsets.symmetric(horizontal: 20.w, vertical: 10.h),
decoration: BoxDecoration(
border: Border.all(
color: CustomAppColors.kLightGreyColor,
),
borderRadius: BorderRadius.circular(40.r)),
child: Row(
children: [
IconButton(
onPressed: () {
Navigator.pushNamed(context, CustomRouteNames.kSelectNoteScreenRoute);
}, icon: const Icon(Icons.search)),
CustomTextWidget(
text: "Search...",
fontSize: 18.sp,
fontWeight: FontWeight.w400,
fontColor: CustomAppColors.kLightGreyColor,
isExpanded: false),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.height / 1.2,
child: ListView.builder(
itemCount: controller.users.length + 1,
itemBuilder: (BuildContext context, int index) {
return index < controller.users.length
? NotesRoundOutlinedBox(
context: context,
child: BuildNotesList(
history: controller.user.aboutPatient,
date: controller.user.diagnosisDate,
userName: controller.users[index],
),
)
: SizedBox(height: 60.h,);
},
),
),
],
),
),
),
);
}
}
class NotesRoundOutlinedBox extends StatelessWidget {
const NotesRoundOutlinedBox({
super.key,
required this.context,
required this.child,
});
final BuildContext context;
final Widget child;
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.centerLeft,
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 25.w,vertical: 5.h),
padding: EdgeInsets.symmetric(horizontal: 13.sp,vertical: 10),
decoration: BoxDecoration(
border: Border.all(color: CustomAppColors.kSecondaryColor),
borderRadius: BorderRadius.circular(10.r),
),
child: child,
);
}
}
class BuildNotesList extends StatelessWidget {
const BuildNotesList({
super.key,
required this.date,
required this.history, required this.userName,
});
final String date;
final String history;
final String userName;
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomTextWidget(
text: 'Note Title',
isExpanded: false,
fontWeight: FontWeight.w600,
fontSize: 14.sp,
fontColor: CustomAppColors.kDarkBlueTextColor,
),
CustomTextWidget(
text: date,
isExpanded: false,
fontWeight: FontWeight.w600,
fontSize: 10.sp,
fontColor: CustomAppColors.kLightGreyColor,
),
CustomTextWidget(
alignment: Alignment.centerLeft,
textAlign: TextAlign.left,
text: history,
isExpanded: false,
fontSize: 10.sp,
fontColor: CustomAppColors.kBlackColor,
),
Padding(
padding: EdgeInsets.only(top: 8.0.h),
child: Row(
children: [
CustomImageWidget(
imagePath: AssetsManager.kPersonMainIcon,
height: 18.h,
width: 18.w,
),
SizedBox(width: 8.w,),
CustomTextWidget(
alignment: Alignment.centerLeft,
text: userName,
isExpanded: false,
fontSize: 10.sp,
fontWeight: FontWeight.w600,
fontColor: CustomAppColors.kBlackColor,
),
],
),
),
],
);
}
}