|
|
@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
|
|
|
|
|
|
|
|
|
|
|
|
final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5));
|
|
|
|
final _item_content_seperator = Container(height: 0.25, padding: EdgeInsets.all(10), color: Colors.grey.withOpacity(0.5));
|
|
|
|
|
|
|
|
|
|
|
@ -22,59 +23,188 @@ class RRTLogListItem extends StatelessWidget {
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
ProjectViewModel projectViewModel = Provider.of(context);
|
|
|
|
_context = context;
|
|
|
|
_context = context;
|
|
|
|
localize = TranslationBase.of(context);
|
|
|
|
localize = TranslationBase.of(context);
|
|
|
|
|
|
|
|
int status = order.status;
|
|
|
|
|
|
|
|
String _statusDisp = projectViewModel.isArabic ? order.descriptionN : order.description;
|
|
|
|
|
|
|
|
Color _color;
|
|
|
|
|
|
|
|
if (status == 1) {
|
|
|
|
|
|
|
|
//pending
|
|
|
|
|
|
|
|
_color = Color(0xffCC9B14);
|
|
|
|
|
|
|
|
} else if (status == 2) {
|
|
|
|
|
|
|
|
//processing
|
|
|
|
|
|
|
|
_color = Color(0xff2E303A);
|
|
|
|
|
|
|
|
} else if (status == 3) {
|
|
|
|
|
|
|
|
//completed
|
|
|
|
|
|
|
|
_color = Color(0xff359846);
|
|
|
|
|
|
|
|
} else if (status == 4) {
|
|
|
|
|
|
|
|
//cancel // Rejected
|
|
|
|
|
|
|
|
_color = Color(0xffD02127);
|
|
|
|
|
|
|
|
}
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
padding: EdgeInsets.all(15),
|
|
|
|
margin: EdgeInsets.all(5),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]),
|
|
|
|
color: _color,
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.all(
|
|
|
|
|
|
|
|
Radius.circular(10.0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
boxShadow: [
|
|
|
|
|
|
|
|
BoxShadow(
|
|
|
|
|
|
|
|
color: Color(0xff000000).withOpacity(.05),
|
|
|
|
|
|
|
|
blurRadius: 27,
|
|
|
|
|
|
|
|
offset: Offset(0, -3),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
// decoration: containerColorRadiusLeft(Colors.white, 12),
|
|
|
|
|
|
|
|
margin: EdgeInsets.only(left: projectViewModel.isArabic ? 0 : 6, right: projectViewModel.isArabic ? 6 : 0),
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 12),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
|
|
|
border: Border.all(color: Colors.white, width: 1),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.only(
|
|
|
|
|
|
|
|
bottomRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
|
|
|
|
|
|
|
|
topRight: projectViewModel.isArabic ? Radius.circular(0) : Radius.circular(10.0),
|
|
|
|
|
|
|
|
bottomLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
|
|
|
|
|
|
|
|
topLeft: projectViewModel.isArabic ? Radius.circular(10.0) : Radius.circular(0),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
// clipBehavior: Clip.antiAlias,
|
|
|
|
|
|
|
|
child: Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
_statusDisp,
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: _color, letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(height: 6),
|
|
|
|
|
|
|
|
Text(
|
|
|
|
|
|
|
|
'${TranslationBase.of(context).requestID}: ${order.iD}',
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600, color: Color(0xff2E303A), letterSpacing: -0.64, height: 25 / 16),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Row(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
_contentItem(label: localize.reqId, value: order.iD.toString()),
|
|
|
|
Text(
|
|
|
|
_item_content_seperator,
|
|
|
|
TranslationBase.of(context).location + ": ",
|
|
|
|
_contentItem(label: localize.status, value: projectViewModel.isArabic ? order.descriptionN.toString() : order.description.toString()), //order.getStatusName(localize)),
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
_item_content_seperator,
|
|
|
|
),
|
|
|
|
_contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()),
|
|
|
|
Expanded(
|
|
|
|
_item_content_seperator,
|
|
|
|
child: Text(
|
|
|
|
_contentItem(label: localize.location, value: order.getNearestProjectDescription()),
|
|
|
|
!projectViewModel.isArabic ? order.nearestProjectDescription.trim().toString() : order.nearestProjectDescriptionN.toString(),
|
|
|
|
_item_content_seperator,
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
|
|
|
|
SizedBox(height: 10),
|
|
|
|
),
|
|
|
|
if (onCancel != null && order.status == 1 && order.status == 2) FractionallySizedBox(child: cancelButton())
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
Row(
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget _contentItem({@required String label, String value}) {
|
|
|
|
|
|
|
|
return Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10),
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
label,
|
|
|
|
localize.pickupDate + ": ",
|
|
|
|
style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff575757), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
order.getFormattedDateTime(),
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.56),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(
|
|
|
|
],
|
|
|
|
height: 5,
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
value,
|
|
|
|
DateUtil.formatDateToDate(order.createdOn, projectViewModel.isArabic),
|
|
|
|
style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontWeight: FontWeight.bold, fontSize: 14),
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.4, height: 16 / 10),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(height: 12),
|
|
|
|
|
|
|
|
if (order.status == 1 || order.status == 2)
|
|
|
|
|
|
|
|
InkWell(
|
|
|
|
|
|
|
|
onTap: () {
|
|
|
|
|
|
|
|
onCancel(order);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Container(
|
|
|
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
|
|
|
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
|
|
|
color: Color(0xffD02127),
|
|
|
|
|
|
|
|
border: Border.all(color: Colors.white, width: 1),
|
|
|
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: Text(
|
|
|
|
|
|
|
|
TranslationBase.of(context).cancel_nocaps,
|
|
|
|
|
|
|
|
style: TextStyle(fontSize: 12, fontWeight: FontWeight.w600, color: Colors.white, letterSpacing: -0.4),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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 (order.status == 1 || order.status == 2) Container(child: cancelButton())
|
|
|
|
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget cancelButton() => MaterialButton(
|
|
|
|
// Widget _contentItem({@required String label, String value}) {
|
|
|
|
height: 45,
|
|
|
|
// return Container(
|
|
|
|
color: Color(0xFFc5272d),
|
|
|
|
// padding: EdgeInsets.symmetric(vertical: 10),
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
|
|
|
// child: Column(
|
|
|
|
onPressed: () => onCancel(order),
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
child: Text(
|
|
|
|
// children: [
|
|
|
|
localize.cancel,
|
|
|
|
// Text(
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 13),
|
|
|
|
// 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),
|
|
|
|
|
|
|
|
// ),
|
|
|
|
|
|
|
|
// );
|
|
|
|
}
|
|
|
|
}
|
|
|
|