You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/screens/procedures/procedure_card.dart

213 lines
9.4 KiB
Dart

import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/core/model/procedure/get_ordered_procedure_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/utils/date-utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/utils/utils.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/user-guid/CusomRow.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
/// TODO Roaa Add translation and make sure it working fine
class ProcedureCard extends StatelessWidget {
final Function()? onTap;
final EntityList? entityList;
final String? categoryName;
final int? categoryID;
final PatiantInformtion? patient;
final int? doctorID;
final bool? isInpatient;
const ProcedureCard({
Key? key,
this.onTap,
this.entityList,
this.categoryID,
this.categoryName,
this.patient,
this.doctorID,
this.isInpatient = false,
}) : super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
width: double.maxFinite,
margin: EdgeInsets.all(10),
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15),
color: Colors.white,
),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: MediaQuery.of(context).size.height * .212,
width: 5,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
bottomLeft: Radius.circular(10),
),
color: entityList!.orderType == 0 ? Colors.black : Colors.red[500],
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 15, right: projectViewModel.isArabic ? 15 : 0),
child: InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
entityList!.orderType == 0 ? 'Routine' : 'Urgent',
color: entityList!.orderType == 0 ? Colors.black : AppGlobal.appRedColor,
fontWeight: FontWeight.w600,
),
SizedBox(
height: 5,
),
AppText(
Utils.convertToTitleCase(entityList!.procedureName!),
bold: true,
fontSize: 14,
),
],
),
),
SizedBox(
width: 5,
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
AppText(
'${AppDateUtils.getDayMonthYearDateFormatted(
AppDateUtils.convertISOStringToDateTime(entityList!.createdOn!),
isMonthShort: true,
isArabic: projectViewModel.isArabic,
)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
AppText(
'${AppDateUtils.getHour(AppDateUtils.convertISOStringToDateTime(entityList!.createdOn!))}',
fontWeight: FontWeight.w600,
color: Colors.grey[700]!,
fontSize: 14,
),
],
),
],
),
CustomRow(
label: TranslationBase.of(context).orderNo + ": ",
value: entityList!.orderNo.toString() ?? "".toString(),
isCopyable: false,
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: EdgeInsets.only(left: 10, right: 0),
child: Image.asset(
'assets/images/patient/ic_ref_arrow_left.png',
height: 50,
width: 30,
),
),
Container(
margin: EdgeInsets.only(left: 0, top: 25, right: 0, bottom: 0),
padding: EdgeInsets.only(left: 4.0, right: 4.0),
child: Container(
width: 40,
height: 40,
child: ClipRRect(
borderRadius: BorderRadius.circular(20.0),
child: Image.asset(
'assets/images/dr_avatar.png',
height: 25,
width: 30,
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Text('No Image');
},
))),
),
Expanded(
flex: 4,
child: Container(
margin: EdgeInsets.only(left: 10, top: 25, right: 10, bottom: 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppText(
Utils.convertToTitleCase(entityList!.doctorName!),
fontFamily: 'Poppins',
fontWeight: FontWeight.w800,
fontSize: 1.7 * SizeConfig.textMultiplier!,
color: Colors.black,
),
if (entityList!.clinicDescription != null)
AppText(
Utils.convertToTitleCase(entityList!.clinicDescription!),
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
fontSize: 1.4 * SizeConfig.textMultiplier!,
color: Color(0XFF2E303A),
),
],
),
),
),
],
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: AppText(
entityList!.remarks != null ? Utils.convertToTitleCase(entityList!.remarks.toString()) : '',
fontSize: 12,
),
),
if ((entityList!.categoryID == 2 || entityList!.categoryID == 4) && doctorID == entityList!.doctorID && !isInpatient!)
InkWell(
child: Icon(DoctorApp.edit),
onTap: onTap,
)
],
),
)
],
),
//onTap: onTap,
),
),
),
],
),
),
);
}
}