UI updates & fixes
parent
19e6954bc8
commit
46d800c0c6
@ -1,71 +1,80 @@
|
|||||||
|
|
||||||
import 'package:diplomaticquarterapp/core/model/prescriptions/prescriptions_order.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: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';
|
||||||
|
|
||||||
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));
|
||||||
|
|
||||||
class RRTLogListItem extends StatelessWidget{
|
class RRTLogListItem extends StatelessWidget {
|
||||||
final PrescriptionsOrder order;
|
final PrescriptionsOrder order;
|
||||||
final Function(PrescriptionsOrder) onCancel;
|
final Function(PrescriptionsOrder) onCancel;
|
||||||
|
|
||||||
RRTLogListItem(this.order, {this.onCancel});
|
RRTLogListItem(this.order, {this.onCancel});
|
||||||
|
|
||||||
BuildContext _context;
|
BuildContext _context;
|
||||||
|
|
||||||
TranslationBase localize;
|
TranslationBase localize;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectViewModel = Provider.of(context);
|
||||||
_context = context;
|
_context = context;
|
||||||
localize = TranslationBase.of(context);
|
localize = TranslationBase.of(context);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.all(15), margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
padding: EdgeInsets.all(15),
|
||||||
decoration: BoxDecoration(
|
margin: EdgeInsets.symmetric(horizontal: 15, vertical: 10),
|
||||||
color: Colors.white,
|
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15), boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]),
|
||||||
borderRadius: BorderRadius.circular(15),
|
|
||||||
boxShadow: [BoxShadow(color: Colors.grey.withOpacity(0.25), spreadRadius: 1, blurRadius: 3)]
|
|
||||||
),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
_contentItem(label: localize.reqId, value: order.iD.toString()),
|
_contentItem(label: localize.reqId, value: order.iD.toString()),
|
||||||
_item_content_seperator,
|
_item_content_seperator,
|
||||||
_contentItem(label: localize.status, value: order.getStatusName(localize)),
|
_contentItem(label: localize.status, value: projectViewModel.isArabic ? order.descriptionN.toString() : order.description.toString()), //order.getStatusName(localize)),
|
||||||
_item_content_seperator,
|
_item_content_seperator,
|
||||||
_contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()),
|
_contentItem(label: localize.pickupDate, value: order.getFormattedDateTime()),
|
||||||
_item_content_seperator,
|
_item_content_seperator,
|
||||||
_contentItem(label: localize.location, value: order.getNearestProjectDescription()),
|
_contentItem(label: localize.location, value: order.getNearestProjectDescription()),
|
||||||
_item_content_seperator,
|
_item_content_seperator,
|
||||||
SizedBox(height: 10),
|
SizedBox(height: 10),
|
||||||
|
if (onCancel != null && order.status == 1 && order.status == 2) FractionallySizedBox(child: cancelButton())
|
||||||
if(onCancel != null)
|
|
||||||
FractionallySizedBox(child: cancelButton())
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _contentItem({@required String label, String value}){
|
Widget _contentItem({@required String label, String value}) {
|
||||||
return Container(
|
return Container(
|
||||||
padding: EdgeInsets.symmetric(vertical: 10),
|
padding: EdgeInsets.symmetric(vertical: 10),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(label, style: TextStyle(color: Theme.of(_context).appBarTheme.color, fontSize: 9, letterSpacing: 1),),
|
Text(
|
||||||
SizedBox(height: 5,),
|
label,
|
||||||
Text(value, style: TextStyle(color: Theme.of(_context).appBarTheme.color,fontWeight: FontWeight.bold, fontSize: 14),),
|
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(
|
Widget cancelButton() => MaterialButton(
|
||||||
height: 45,
|
height: 45,
|
||||||
color: Color(0xFFc5272d),
|
color: Color(0xFFc5272d),
|
||||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
|
||||||
onPressed: () => onCancel(order),
|
onPressed: () => onCancel(order),
|
||||||
child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13),),
|
child: Text(
|
||||||
|
localize.cancel,
|
||||||
);
|
style: TextStyle(color: Colors.white, fontSize: 13),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue