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.
PatientApp-KKUMC/lib/pages/ErService/rapid-response-team/rrt-order-list-item.dart

81 lines
3.0 KiB
Dart

import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5));
class RRTLogListItem extends StatelessWidget {
final PrescriptionsOrder order;
final Function(PrescriptionsOrder) onCancel;
RRTLogListItem(this.order, {this.onCancel});
BuildContext _context;
TranslationBase localize;
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
_context = context;
localize = TranslationBase.of(context);
return Container(
padding: EdgeInsets.all(15),
margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_contentItem(label: localize.reqId, value: order.iD.toString()),
_item_content_seperator,
_contentItem(label: localize.status, value: projectViewModel.isArabic ? order.descriptionN.toString() : order.description.toString()), //order.getStatusName(localize)),
_item_content_seperator,
_contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()),
_item_content_seperator,
_contentItem(label: localize.location, value: order.getNearestProjectDescription()),
_item_content_seperator,
SizedBox(height: 10),
if (onCancel != null && order.status == 1 && order.status == 2) FractionallySizedBox(child: cancelButton())
],
),
);
}
Widget _contentItem({@required String label, String value}) {
return Container(
padding: EdgeInsets.symmetric(vertical: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),
),
SizedBox(
height: 5,
),
Text(
value,
style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontWeight: FontWeight.bold, fontSize: 14),
),
],
),
);
}
Widget cancelButton() => MaterialButton(
height: 45,
color: Color(0xFFc5272d),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
onPressed: () => onCancel(order),
child: Text(
localize.cancel,
style: TextStyle(color: Colors.white, fontSize: 13),
),
);
}