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/ProcedureCard.dart

143 lines
5.8 KiB
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/util/date-utils.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/Text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class ProcedureCard extends StatelessWidget {
final Function onTap;
final EntityList entityList;
const ProcedureCard({Key key, this.onTap, this.entityList}) : super(key: key);
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
width: double.maxFinite,
height: MediaQuery.of(context).size.height * .22,
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: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Container(
height: MediaQuery.of(context).size.height * .20,
width: 5,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10),
bottomLeft: Radius.circular(10),
),
color: entityList.orderType == 1
? Colors.red[500]
: Colors.black,
),
),
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: [
Texts(
entityList.orderType == 0
? 'Routine'
: 'Urgent',
color: entityList.orderType == 0
? Colors.black
: Colors.red[800],
fontWeight: FontWeight.w600,
),
SizedBox(
height: 5,
),
Texts(
entityList.procedureName,
bold: true,
fontSize: 14,
),
],
),
),
SizedBox(
width: 5,
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Texts(
'${DateUtils.getDayMonthYearDateFormatted(DateUtils.convertISOStringToDateTime(entityList.orderDate), isArabic: projectViewModel.isArabic)}',
color: Colors.black,
fontWeight: FontWeight.w600,
fontSize: 14,
),
Texts(
'${DateUtils.getHour(DateUtils.convertISOStringToDateTime(entityList.orderDate))}',
fontWeight: FontWeight.w600,
color: Colors.grey[700],
fontSize: 14,
),
],
),
],
),
Row(
children: [
Texts(
TranslationBase.of(context).orderNo,
color: Colors.grey,
fontSize: 12,
),
Texts(
entityList.orderNo.toString(),
color: Colors.grey,
fontSize: 12,
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
entityList.remarks ?? '',
fontSize: 12,
),
Icon(Icons.edit)
],
)
],
),
onTap: onTap,
),
),
),
],
),
),
),
);
}
}