add MediaQuery into the design and make Package Content appear dynamic.

setting_branch
enadhilal 5 years ago
commit df0049cd35

@ -0,0 +1,153 @@
class PendingOrdersRes {
int rowID;
int orderID;
String firstName;
String middleName;
String lastName;
int gender;
String nationalityID;
String mobileNumber;
String preferredLanguage;
int driverID;
int statusID;
bool ispaused;
int groupID;
String description;
String descriptionN;
double longitude;
double latitude;
Null amount;
String orderCreatedOn;
Null ePharmacyOrderNo;
int projectID;
String appointmentNo;
String dischargeID;
String patientID;
bool patientOutSA;
int distanceInKilometers;
List<ItemsQuantitiesList> itemsQuantitiesList;
PendingOrdersRes(
{this.rowID,
this.orderID,
this.firstName,
this.middleName,
this.lastName,
this.gender,
this.nationalityID,
this.mobileNumber,
this.preferredLanguage,
this.driverID,
this.statusID,
this.ispaused,
this.groupID,
this.description,
this.descriptionN,
this.longitude,
this.latitude,
this.amount,
this.orderCreatedOn,
this.ePharmacyOrderNo,
this.projectID,
this.appointmentNo,
this.dischargeID,
this.patientID,
this.patientOutSA,
this.distanceInKilometers,
this.itemsQuantitiesList});
PendingOrdersRes.fromJson(Map<String, dynamic> json) {
rowID = json['RowID'];
orderID = json['OrderID'];
firstName = json['FirstName'];
middleName = json['MiddleName'];
lastName = json['LastName'];
gender = json['Gender'];
nationalityID = json['NationalityID'];
mobileNumber = json['MobileNumber'];
preferredLanguage = json['PreferredLanguage'];
driverID = json['DriverID'];
statusID = json['StatusID'];
ispaused = json['Ispaused'];
groupID = json['GroupID'];
description = json['Description'];
descriptionN = json['DescriptionN'];
longitude = json['Longitude'];
latitude = json['Latitude'];
amount = json['Amount'];
orderCreatedOn = json['OrderCreatedOn'];
ePharmacyOrderNo = json['ePharmacyOrderNo'];
projectID = json['ProjectID'];
appointmentNo = json['AppointmentNo'];
dischargeID = json['DischargeID'];
patientID = json['PatientID'];
patientOutSA = json['PatientOutSA'];
distanceInKilometers = json['DistanceInKilometers'];
if (json['ItemsQuantitiesList'] != null) {
itemsQuantitiesList = new List<ItemsQuantitiesList>();
json['ItemsQuantitiesList'].forEach((v) {
itemsQuantitiesList.add(new ItemsQuantitiesList.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['RowID'] = this.rowID;
data['OrderID'] = this.orderID;
data['FirstName'] = this.firstName;
data['MiddleName'] = this.middleName;
data['LastName'] = this.lastName;
data['Gender'] = this.gender;
data['NationalityID'] = this.nationalityID;
data['MobileNumber'] = this.mobileNumber;
data['PreferredLanguage'] = this.preferredLanguage;
data['DriverID'] = this.driverID;
data['StatusID'] = this.statusID;
data['Ispaused'] = this.ispaused;
data['GroupID'] = this.groupID;
data['Description'] = this.description;
data['DescriptionN'] = this.descriptionN;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
data['Amount'] = this.amount;
data['OrderCreatedOn'] = this.orderCreatedOn;
data['ePharmacyOrderNo'] = this.ePharmacyOrderNo;
data['ProjectID'] = this.projectID;
data['AppointmentNo'] = this.appointmentNo;
data['DischargeID'] = this.dischargeID;
data['PatientID'] = this.patientID;
data['PatientOutSA'] = this.patientOutSA;
data['DistanceInKilometers'] = this.distanceInKilometers;
if (this.itemsQuantitiesList != null) {
data['ItemsQuantitiesList'] =
this.itemsQuantitiesList.map((v) => v.toJson()).toList();
}
return data;
}
}
class ItemsQuantitiesList {
String itemName;
var productID;
var quantity;
ItemsQuantitiesList({this.itemName, this.productID, this.quantity});
ItemsQuantitiesList.fromJson(Map<String, dynamic> json) {
itemName = json['ItemName'];
productID = json['ProductID'];
quantity = json['Quantity'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ItemName'] = this.itemName;
data['ProductID'] = this.productID;
data['Quantity'] = this.quantity;
return data;
}
}

@ -1,12 +1,13 @@
import 'package:driverapp/config/config.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_req_model.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_res_model.dart';
import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart';
import 'package:driverapp/core/service/base_service.dart';
class OrdersService extends BaseService {
List<PendingOrders> _orders = List();
List<PendingOrdersRes> _orders = List();
List<PendingOrders> get orders => _orders;
List<PendingOrdersRes> get orders => _orders;
bool isOrderInserted;
PendingOrders _requestGetPendingOrders = PendingOrders(
@ -26,7 +27,7 @@ class OrdersService extends BaseService {
onSuccess: (dynamic response, int statusCode) {
_orders.clear();
response['PatientER_Delivery_GetAllOrderList'].forEach((order) {
_orders.add(PendingOrders.fromJson(order));
_orders.add(PendingOrdersRes.fromJson(order));
});
}, onFailure: (String error, int statusCode) {
hasError = true;
@ -35,6 +36,7 @@ class OrdersService extends BaseService {
} catch (e) {
hasError = true;
super.error = error;
throw e;
}
}

@ -1,5 +1,5 @@
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_res_model.dart';
import 'package:driverapp/core/service/orders_service.dart';
import '../../locator.dart';
@ -8,7 +8,7 @@ import 'base_view_model.dart';
class OrdersViewModel extends BaseViewModel {
OrdersService _pendingOrdersService = locator<OrdersService>();
List<PendingOrders> get orders => _pendingOrdersService.orders;
List<PendingOrdersRes> get orders => _pendingOrdersService.orders;
Future getPendingOrders() async {
setState(ViewState.Busy);
@ -20,7 +20,6 @@ class OrdersViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future insertOrder() async {
setState(ViewState.ErrorLocal);
await _pendingOrdersService.insertOrder();

@ -23,8 +23,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
int orderId;
return BaseView<OrdersViewModel>(
onModelReady: (model) => model.getPendingOrders(),
builder:
(BuildContext context, OrdersViewModel model, Widget child) =>
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
AppScaffold(
body: Column(
// mainAxisAlignment: MainAxisAlignment.center,
@ -365,8 +364,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.vertical,
itemCount: //model.orders == null ? 0 : model.orders.length,
3,
itemCount: model.orders == null ? 0 : model.orders.length,
// 2,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 12.2),
@ -388,7 +387,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
padding: EdgeInsets.only(left: 22.0),
child: Image.asset(
'assets/images/location.png',
height: MediaQuery
height:
MediaQuery
.of(context)
.size
.height *
@ -407,25 +407,28 @@ class _DashboardScreenState extends State<DashboardScreen> {
Expanded(
flex: 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
model.orders[index].firstName +
' ' +
model.orders[index].lastName,
style: TextStyle(fontSize: 18.0),
Padding(
padding: EdgeInsets.only(top: 5.0),
child: Text(
model.orders[index].firstName +
' ' +
model.orders[index].lastName,
style: TextStyle(fontSize: 18.0),
),
),
Text(
model.orders[index].mobileNumber,
style: TextStyle(
color: Color(0xff30B7B9),
fontWeight: FontWeight.w600,
fontSize: 15.0),
color: Color(0xff30B7B9),
fontWeight: FontWeight.w600,
fontSize: 15.0,
),
),
Expanded(
child: Text(
'Olaya ST, Behind kfc next to king ,Olaya ST ',
'Olaya ST, Behind kfc next to king ,',
style: TextStyle(color: Colors.black45),
),
),
@ -496,5 +499,4 @@ class _DashboardScreenState extends State<DashboardScreen> {
AppToast.showSuccessToast(message: "Order Added");
}
}
}

@ -39,13 +39,25 @@ class DeliveryConfirmedPage extends StatelessWidget {
child: Column(
children: <Widget>[
Container(
width: 300,
height: 300,
padding: EdgeInsets.only(top:60),
width: MediaQuery
.of(context)
.size
.width,
//300,
height: MediaQuery
.of(context)
.size
.width * 0.7,
//300,
padding: EdgeInsets.only(
top: MediaQuery
.of(context)
.size
.width * 0.2, //60,
),
decoration: BoxDecoration(
color: Colors.white10,
shape: BoxShape.circle
),
shape: BoxShape.circle),
child: Column(
children: <Widget>[
Icon(
@ -79,16 +91,29 @@ class DeliveryConfirmedPage extends StatelessWidget {
),
],
),
Stack(
children: <Widget>[
Container(
width: 400,
height: 500,
width: MediaQuery
.of(context)
.size
.width, //400,
height: MediaQuery
.of(context)
.size
.width, //500,
),
Container(
width: 800,
height: 440,
width: MediaQuery
.of(context)
.size
.width,
//800,
height: MediaQuery
.of(context)
.size
.width * 1.2,
//440,
margin: EdgeInsets.only(top: 60),
decoration: BoxDecoration(
color: Colors.white,
@ -101,14 +126,20 @@ class DeliveryConfirmedPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.only(bottom: 50),
margin: EdgeInsets.only(
bottom: MediaQuery
.of(context)
.size
.width * 0.15, //50
),
child: Column(
children: <Widget>[
FlatButton.icon(
padding: EdgeInsets.all(8),
color: Colors.orangeAccent,
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(10.0),
borderRadius:
new BorderRadius.circular(10.0),
),
icon: Icon(
Icons.mode_edit,
@ -122,13 +153,30 @@ class DeliveryConfirmedPage extends StatelessWidget {
),
onPressed: () {},
),
SizedBox(height: 20,),
SizedBox(
height: MediaQuery
.of(context)
.size
.width * 0.1, //20,
),
FlatButton(
color: Color(0xff41bdbb),
padding: EdgeInsets.only(right: 100, left: 100),
padding:
EdgeInsets.only(
right: MediaQuery
.of(context)
.size
.width * 0.25, //100,
left: MediaQuery
.of(context)
.size
.width * 0.25, //100
),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
side: BorderSide(color: Color(0xff41bdbb)),
borderRadius:
new BorderRadius.circular(18.0),
side:
BorderSide(color: Color(0xff41bdbb)),
),
child: Text(
TranslationBase
@ -145,10 +193,12 @@ class DeliveryConfirmedPage extends StatelessWidget {
),
),
CustomerBrief(
itemId: item.driverID,
itemId: item.patientID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber
mobileNo: item.mobileNumber,
totalPayment: item.amount,
deliveryTime: item.orderCreatedOn
),
],
),
@ -161,4 +211,3 @@ class DeliveryConfirmedPage extends StatelessWidget {
);
}
}

@ -15,224 +15,267 @@ class InformationPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// return AppScaffold(
// body: Center(
// child: InkWell(onTap: () {},
// child: Texts('Replay Page')),
// ),
// );
return AppScaffold(
body: Container(
color: Color(0xff41bdbb),
child: ListView(
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.only(right: 50),
child: IconButton(
color: Colors.white,
iconSize: 50,
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
),
Container(
child: Text(
TranslationBase
.of(context)
.deliveryInfo,
style: TextStyle(
child: Container(
color: Color(0xff41bdbb),
child: ListView(
children: <Widget>[
Column(
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.only(
right: MediaQuery
.of(context)
.size
.width * 0.15, //50
),
child: IconButton(
color: Colors.white,
fontSize: 20,
iconSize: 50,
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
),
),
],
),
Stack(
children: <Widget>[
Container(
width: 400,
height: 500,
),
Container(
width: 800,
height: 700,
margin: EdgeInsets.only(top: 100),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(45),
topRight: Radius.circular(45)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 170,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
delivery_info_button(
btnColor: Color(0xfff44336),
btnIcon: Icon(
Icons.near_me,
size: 30,
color: Colors.white,
),
btnName: TranslationBase
.of(context)
.location,
btnFunction: () {},
),
delivery_info_button(
btnColor: Colors.green,
btnIcon: Icon(
Icons.whatshot,
size: 30,
color: Colors.white,
),
btnName: 'Whatsapp',
btnFunction: () {},
),
delivery_info_button(
btnColor: Colors.orangeAccent,
btnIcon: Icon(
Icons.mail_outline,
size: 30,
color: Colors.white,
),
btnName: TranslationBase
.of(context)
.sms,
btnFunction: () {},
),
delivery_info_button(
btnColor: Color(0xff41bdbb),
btnIcon: Icon(
Icons.phone,
size: 30,
color: Colors.white,
),
btnName: TranslationBase
.of(context)
.call,
btnFunction: () {},
),
],
Container(
child: Text(
TranslationBase
.of(context)
.deliveryInfo,
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
SizedBox(
height: 30,
),
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
),
),
],
),
Stack(
children: <Widget>[
Container(
width: MediaQuery
.of(context)
.size
.width, //400,
height: MediaQuery
.of(context)
.size
.width, //500,
),
Container(
width: MediaQuery
.of(context)
.size
.width * 1,
//800,
height: MediaQuery
.of(context)
.size
.width * 1.5,
//700,
margin: EdgeInsets.only(
top: MediaQuery
.of(context)
.size
.width * 0.3, //100
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(45),
topRight: Radius.circular(45)),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(
height: MediaQuery
.of(context)
.size
.width * 0.2, //170,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
TranslationBase
delivery_info_button(
btnColor: Color(0xfff44336),
btnIcon: Icon(
Icons.near_me,
size: 30,
color: Colors.white,
),
btnName: TranslationBase
.of(context)
.packageContent,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
SizedBox(
height: 20,
),
package_content(
packageName: 'Panadol Extra 50 tablet',
packageCount: '5 box',
),
SizedBox(
height: 10,
.location,
btnFunction: () {},
),
package_content(
packageName: 'Xeractan 20MG 30 Capsules',
packageCount: '1 PCS',
delivery_info_button(
btnColor: Colors.green,
btnIcon: Icon(
Icons.whatshot,
size: 30,
color: Colors.white,
),
btnName: 'Whatsapp',
btnFunction: () {},
),
SizedBox(
height: 10,
),
package_content(
packageName: 'Oltment for Rash unbranded 50 ml',
packageCount: '1 tube',
),
SizedBox(
height: 10,
),
package_content(
packageName: 'Face Mask 50 Pieces',
packageCount: '1 box',
),
SizedBox(
height: 10,
),
package_content(
packageName: 'Panadol Extra 50 tablet',
packageCount: '5 box',
delivery_info_button(
btnColor: Colors.orangeAccent,
btnIcon: Icon(
Icons.mail_outline,
size: 30,
color: Colors.white,
),
btnName: TranslationBase
.of(context)
.sms,
btnFunction: () {},
),
SizedBox(
height: 10,
delivery_info_button(
btnColor: Color(0xff41bdbb),
btnIcon: Icon(
Icons.phone,
size: 30,
color: Colors.white,
),
btnName: TranslationBase
.of(context)
.call,
btnFunction: () {},
),
],
),
),
SizedBox(
height: 30,
),
FlatButton(
color: Color(0xff41bdbb),
padding: EdgeInsets.only(
right: 100, left: 100, bottom: 15, top: 15),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),
side: BorderSide(color: Color(0xff41bdbb)),
SizedBox(
height: MediaQuery
.of(context)
.size
.width * 0.1, //30,
),
Container(
margin: EdgeInsets.only(
left: MediaQuery
.of(context)
.size
.width * 0.05, //15,
right: MediaQuery
.of(context)
.size
.width * 0.02, //15
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
TranslationBase
.of(context)
.packageContent,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20),
),
SizedBox(
height: MediaQuery
.of(context)
.size
.width * 0.05, //20,
),
Column(
children: List.generate(
item.itemsQuantitiesList.length,
(index) {
return package_content(
packageName: item
.itemsQuantitiesList[index]
.itemName
.toString(),
//'Panadol Extra 50 tablet',
packageCount: item
.itemsQuantitiesList[index]
.quantity
.toString(),
);
}),
),
SizedBox(
height: MediaQuery
.of(context)
.size
.width * 0.01, //10,
),
],
),
),
child: Text(
TranslationBase
SizedBox(
height: MediaQuery
.of(context)
.clientReached,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16),
.size
.width * 0.1, //30,
),
onPressed: () {
Navigator.push(
context, MaterialPageRoute(
builder: (context) =>
DeliveryConfirmedPage(item)));
},
),
],
FlatButton(
color: Color(0xff41bdbb),
padding: EdgeInsets.only(
right: MediaQuery
.of(context)
.size
.width * 0.3, //100,
left: MediaQuery
.of(context)
.size
.width * 0.3, //100,
bottom: MediaQuery
.of(context)
.size
.width * 0.035, //15,
top: MediaQuery
.of(context)
.size
.width * 0.035, //15
),
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),
side: BorderSide(color: Color(0xff41bdbb)),
),
child: Text(
TranslationBase
.of(context)
.clientReached,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 16),
),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
DeliveryConfirmedPage(item)));
},
),
],
),
),
),
CustomerBrief(
itemId: item.driverID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber
),
],
),
],
),
],
CustomerBrief(
itemId: item.patientID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
deliveryTime: item.orderCreatedOn),
],
),
],
),
],
),
),
),
);
}
}

@ -16,8 +16,7 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
Widget build(BuildContext context) {
return BaseView<OrdersViewModel>(
onModelReady: (model) => model.getPendingOrders(),
builder:
(BuildContext context, OrdersViewModel model, Widget child) =>
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
Scaffold(
appBar: AppBar(
centerTitle: true,
@ -97,7 +96,8 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
crossAxisAlignment: CrossAxisAlignment
.start,
children: <Widget>[
Expanded(
Padding(
padding: EdgeInsets.only(top: 10.0),
child: Text(
model.orders[index].firstName +
' ' +

@ -119,4 +119,14 @@ class DateUtil {
else
return "";
}
static String convertStringToHours(String date) {
DateTime stringDate = convertStringToDate(date);
DateTime dateTime = DateTime.parse(stringDate.toString());
String hours = dateTime.toString();
hours = hours.substring(10, 16);
return hours;
}
}

@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import '../../uitl/date_uitl.dart';
import '../../uitl/translations_delegate_base.dart';
class CustomerBrief extends StatelessWidget {
final int itemId;
final String itemId;
final String time;
final String customerFirstName;
final String customerLastName;
@ -119,7 +120,7 @@ class CustomerBrief extends StatelessWidget {
width: 170,
),
Text(
'SAR 70',
totalPayment.toString(), //'SAR 70',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
@ -137,7 +138,12 @@ class CustomerBrief extends StatelessWidget {
SizedBox(
width: 50,
),
Text('05 Aug 20 - 10:00 AM',
Text(
'${DateUtil.getMonthDayYearDateFormatted(
DateUtil.convertStringToDate(
deliveryTime))} ${(DateUtil
.convertStringToHours(deliveryTime))}',
//'05 Aug 20 - 10:00 AM',
style: TextStyle(fontWeight: FontWeight.bold)),
],
)

Loading…
Cancel
Save