Merge branch 'delivery_confirmed' of https://gitlab.com/Cloud_Solution/driver-app into merge_delivery_info_into_dev

 Conflicts:
	lib/pages/delivery/information_page.dart
logut
Elham Rababah 6 years ago
commit dc2e1ab785

@ -6,6 +6,7 @@ import 'package:driverapp/core/service/base_service.dart';
class OrdersService extends BaseService { class OrdersService extends BaseService {
List<PendingOrdersRes> _orders = List(); List<PendingOrdersRes> _orders = List();
List<PendingOrdersRes> get orders => _orders; List<PendingOrdersRes> get orders => _orders;
bool isOrderInserted; bool isOrderInserted;

@ -1,7 +1,7 @@
import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/pending_orders/pending_orders_res_model.dart';
import 'package:driverapp/core/service/orders_service.dart'; import 'package:driverapp/core/service/orders_service.dart';
import 'package:driverapp/core/model/pending_orders/pending_orders_req_model.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';

@ -91,8 +91,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
Padding( Padding(
padding: EdgeInsets.symmetric(horizontal: 10.0), padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.15, height: MediaQuery
width: MediaQuery.of(context).size.width * 0.44, .of(context)
.size
.height * 0.15,
width: MediaQuery
.of(context)
.size
.width * 0.44,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient( gradient: LinearGradient(
@ -138,11 +144,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
padding: EdgeInsets.only(right: 9.5), padding: EdgeInsets.only(right: 9.5),
child: Image.asset( child: Image.asset(
'assets/images/closed_box.png', 'assets/images/closed_box.png',
height: MediaQuery.of(context) height: MediaQuery
.of(context)
.size .size
.height * .height *
0.09, 0.09,
width: MediaQuery.of(context) width: MediaQuery
.of(context)
.size .size
.width * .width *
0.20, 0.20,
@ -165,7 +173,10 @@ class _DashboardScreenState extends State<DashboardScreen> {
padding: EdgeInsets.symmetric(horizontal: 10.0), padding: EdgeInsets.symmetric(horizontal: 10.0),
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.15, height: MediaQuery.of(context).size.height * 0.15,
width: MediaQuery.of(context).size.width * 0.44, width: MediaQuery
.of(context)
.size
.width * 0.44,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient( gradient: LinearGradient(
@ -235,8 +246,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
Expanded( Expanded(
child: InkWell( child: InkWell(
child: Container( child: Container(
height: MediaQuery.of(context).size.height * 0.16, height: MediaQuery
width: MediaQuery.of(context).size.width * 0.50, .of(context)
.size
.height * 0.16,
width: MediaQuery
.of(context)
.size
.width * 0.50,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15.0), borderRadius: BorderRadius.circular(15.0),
gradient: LinearGradient(colors: [ gradient: LinearGradient(colors: [
@ -252,9 +269,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
Image.asset( Image.asset(
'assets/images/qr_code.png', 'assets/images/qr_code.png',
width: width:
MediaQuery.of(context).size.width * 0.25, MediaQuery
.of(context)
.size
.width * 0.25,
height: height:
MediaQuery.of(context).size.height * 0.14, MediaQuery
.of(context)
.size
.height * 0.14,
fit: BoxFit.cover, fit: BoxFit.cover,
) )
], ],
@ -341,14 +364,17 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
itemCount: //model.orders == null ? 0 : model.orders.length, itemCount: model.orders == null ? 0 : model.orders.length,
3, // 2,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return Padding(
padding: EdgeInsets.symmetric(horizontal: 12.2), padding: EdgeInsets.symmetric(horizontal: 12.2),
child: InkWell( child: InkWell(
child: RoundedContainer( child: RoundedContainer(
height: MediaQuery.of(context).size.height * 0.108, height: MediaQuery
.of(context)
.size
.height * 0.108,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -362,9 +388,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Image.asset( child: Image.asset(
'assets/images/location.png', 'assets/images/location.png',
height: height:
MediaQuery.of(context).size.height * MediaQuery
.of(context)
.size
.height *
0.10, 0.10,
width: MediaQuery.of(context).size.width * width: MediaQuery
.of(context)
.size
.width *
0.09, 0.09,
), ),
) )

@ -39,9 +39,22 @@ class DeliveryConfirmedPage extends StatelessWidget {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Container( Container(
width: 300, width: MediaQuery
height: 300, .of(context)
padding: EdgeInsets.only(top: 60), .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( decoration: BoxDecoration(
color: Colors.white10, color: Colors.white10,
shape: BoxShape.circle), shape: BoxShape.circle),
@ -81,12 +94,26 @@ class DeliveryConfirmedPage extends StatelessWidget {
Stack( Stack(
children: <Widget>[ children: <Widget>[
Container( Container(
width: 400, width: MediaQuery
height: 500, .of(context)
.size
.width, //400,
height: MediaQuery
.of(context)
.size
.width, //500,
), ),
Container( Container(
width: 800, width: MediaQuery
height: 440, .of(context)
.size
.width,
//800,
height: MediaQuery
.of(context)
.size
.width * 1.2,
//440,
margin: EdgeInsets.only(top: 60), margin: EdgeInsets.only(top: 60),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -99,7 +126,12 @@ class DeliveryConfirmedPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(bottom: 50), margin: EdgeInsets.only(
bottom: MediaQuery
.of(context)
.size
.width * 0.15, //50
),
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
FlatButton.icon( FlatButton.icon(
@ -122,12 +154,24 @@ class DeliveryConfirmedPage extends StatelessWidget {
onPressed: () {}, onPressed: () {},
), ),
SizedBox( SizedBox(
height: 20, height: MediaQuery
.of(context)
.size
.width * 0.1, //20,
), ),
FlatButton( FlatButton(
color: Color(0xff41bdbb), color: Color(0xff41bdbb),
padding: padding:
EdgeInsets.only(right: 100, left: 100), EdgeInsets.only(
right: MediaQuery
.of(context)
.size
.width * 0.25, //100,
left: MediaQuery
.of(context)
.size
.width * 0.25, //100
),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
new BorderRadius.circular(18.0), new BorderRadius.circular(18.0),
@ -149,10 +193,13 @@ class DeliveryConfirmedPage extends StatelessWidget {
), ),
), ),
CustomerBrief( CustomerBrief(
itemId: item.driverID, itemId: item.patientID,
customerFirstName: item.firstName, customerFirstName: item.firstName,
customerLastName: item.lastName, customerLastName: item.lastName,
mobileNo: item.mobileNumber), mobileNo: item.mobileNumber,
totalPayment: item.amount,
deliveryTime: item.orderCreatedOn
),
], ],
), ),
], ],

@ -4,9 +4,6 @@ import 'package:driverapp/widgets/delivery/delivery_action_button.dart';
import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:driverapp/widgets/delivery/package_content.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:map_launcher/map_launcher.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../uitl/translations_delegate_base.dart'; import '../../uitl/translations_delegate_base.dart';
import '../../widgets/others/app_scaffold_widget.dart'; import '../../widgets/others/app_scaffold_widget.dart';
@ -18,14 +15,10 @@ class InformationPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// return AppScaffold(
// body: Center(
// child: InkWell(onTap: () {},
// child: Texts('Replay Page')),
// ),
// );
return AppScaffold( return AppScaffold(
body: Container( body: Container(
color: Color(0xff41bdbb),
child: Container(
color: Color(0xff41bdbb), color: Color(0xff41bdbb),
child: ListView( child: ListView(
children: <Widget>[ children: <Widget>[
@ -35,7 +28,12 @@ class InformationPage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container( Container(
margin: EdgeInsets.only(right: 50), margin: EdgeInsets.only(
right: MediaQuery
.of(context)
.size
.width * 0.15, //50
),
child: IconButton( child: IconButton(
color: Colors.white, color: Colors.white,
iconSize: 50, iconSize: 50,
@ -47,7 +45,9 @@ class InformationPage extends StatelessWidget {
), ),
Container( Container(
child: Text( child: Text(
TranslationBase.of(context).deliveryInfo, TranslationBase
.of(context)
.deliveryInfo,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 20, fontSize: 20,
@ -59,13 +59,32 @@ class InformationPage extends StatelessWidget {
Stack( Stack(
children: <Widget>[ children: <Widget>[
Container( Container(
width: 400, width: MediaQuery
height: 500, .of(context)
.size
.width, //400,
height: MediaQuery
.of(context)
.size
.width, //500,
), ),
Container( Container(
width: 800, width: MediaQuery
height: 700, .of(context)
margin: EdgeInsets.only(top: 100), .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( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
@ -76,7 +95,10 @@ class InformationPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: 170, height: MediaQuery
.of(context)
.size
.width * 0.2, //170,
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -88,11 +110,10 @@ class InformationPage extends StatelessWidget {
size: 30, size: 30,
color: Colors.white, color: Colors.white,
), ),
btnName: TranslationBase.of(context).location, btnName: TranslationBase
btnFunction: () { .of(context)
MapsLauncher.launchCoordinates( .location,
item.longitude, item.latitude); btnFunction: () {},
},
), ),
delivery_info_button( delivery_info_button(
btnColor: Colors.green, btnColor: Colors.green,
@ -111,7 +132,9 @@ class InformationPage extends StatelessWidget {
size: 30, size: 30,
color: Colors.white, color: Colors.white,
), ),
btnName: TranslationBase.of(context).sms, btnName: TranslationBase
.of(context)
.sms,
btnFunction: () {}, btnFunction: () {},
), ),
delivery_info_button( delivery_info_button(
@ -121,83 +144,107 @@ class InformationPage extends StatelessWidget {
size: 30, size: 30,
color: Colors.white, color: Colors.white,
), ),
btnName: TranslationBase.of(context).call, btnName: TranslationBase
btnFunction: () { .of(context)
launch( .call,
"tel://" + item.mobileNumber.toString()); btnFunction: () {},
},
), ),
], ],
), ),
SizedBox( SizedBox(
height: 30, height: MediaQuery
.of(context)
.size
.width * 0.1, //30,
), ),
Container( Container(
margin: EdgeInsets.only(left: 15, right: 15), margin: EdgeInsets.only(
left: MediaQuery
.of(context)
.size
.width * 0.05, //15,
right: MediaQuery
.of(context)
.size
.width * 0.02, //15
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
TranslationBase.of(context).packageContent, TranslationBase
.of(context)
.packageContent,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 20), fontSize: 20),
), ),
SizedBox( SizedBox(
height: 20, height: MediaQuery
), .of(context)
package_content( .size
packageName: 'Panadol Extra 50 tablet', .width * 0.05, //20,
packageCount: '5 box',
),
SizedBox(
height: 10,
),
package_content(
packageName: 'Xeractan 20MG 30 Capsules',
packageCount: '1 PCS',
), ),
SizedBox( Column(
height: 10, children: List.generate(
), item.itemsQuantitiesList.length,
package_content( (index) {
packageName: return package_content(
'Oltment for Rash unbranded 50 ml', packageName: item
packageCount: '1 tube', .itemsQuantitiesList[index]
), .itemName
SizedBox( .toString(),
height: 10, //'Panadol Extra 50 tablet',
), packageCount: item
package_content( .itemsQuantitiesList[index]
packageName: 'Face Mask 50 Pieces', .quantity
packageCount: '1 box', .toString(),
), );
SizedBox( }),
height: 10,
),
package_content(
packageName: 'Panadol Extra 50 tablet',
packageCount: '5 box',
), ),
SizedBox( SizedBox(
height: 10, height: MediaQuery
.of(context)
.size
.width * 0.01, //10,
), ),
], ],
), ),
), ),
SizedBox( SizedBox(
height: 30, height: MediaQuery
.of(context)
.size
.width * 0.1, //30,
), ),
FlatButton( FlatButton(
color: Color(0xff41bdbb), color: Color(0xff41bdbb),
padding: EdgeInsets.only( padding: EdgeInsets.only(
right: 100, left: 100, bottom: 15, top: 15), 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( shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0), borderRadius: new BorderRadius.circular(30.0),
side: BorderSide(color: Color(0xff41bdbb)), side: BorderSide(color: Color(0xff41bdbb)),
), ),
child: Text( child: Text(
TranslationBase.of(context).clientReached, TranslationBase
.of(context)
.clientReached,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -215,13 +262,12 @@ class InformationPage extends StatelessWidget {
), ),
), ),
CustomerBrief( CustomerBrief(
itemId: item.driverID, itemId: item.patientID,
customerFirstName: item.firstName, customerFirstName: item.firstName,
customerLastName: item.lastName, customerLastName: item.lastName,
mobileNo: item.mobileNumber, mobileNo: item.mobileNumber,
latitude: item.latitude, totalPayment: item.amount,
longitude: item.longitude, deliveryTime: item.orderCreatedOn),
),
], ],
), ),
], ],
@ -229,6 +275,7 @@ class InformationPage extends StatelessWidget {
], ],
), ),
), ),
),
); );
} }
} }

@ -1,9 +1,10 @@
import 'package:flutter/material.dart';
import 'package:driverapp/config/size_config.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart';
import '../base/base_view.dart'; import 'package:driverapp/pages/delivery/information_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:driverapp/widgets/others/rounded_container.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../base/base_view.dart';
class OrdersListScreen extends StatefulWidget { class OrdersListScreen extends StatefulWidget {
@override @override
@ -41,27 +42,47 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Padding( return InkWell(
onTap: () {
Navigator.push(
context, MaterialPageRoute(
builder: (context) =>
InformationPage(model.orders[index])));
},
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.2), padding: EdgeInsets.symmetric(horizontal: 12.2),
child: RoundedContainer( child: RoundedContainer(
height: MediaQuery.of(context).orientation == height: MediaQuery
.of(context)
.orientation ==
Orientation.portrait Orientation.portrait
? MediaQuery.of(context).size.height * 0.107 ? MediaQuery
: MediaQuery.of(context).size.height * 0.18, .of(context)
.size
.height * 0.107
: MediaQuery
.of(context)
.size
.height * 0.18,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment
.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment
.center,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(left: 22.0), padding: EdgeInsets.only(left: 22.0),
child: Image.asset( child: Image.asset(
'assets/images/location.png', 'assets/images/location.png',
height: height:
MediaQuery.of(context).size.height * MediaQuery
.of(context)
.size
.height *
0.101, 0.101,
), ),
), ),
@ -72,7 +93,8 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
Expanded( Expanded(
flex: 3, flex: 3,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment
.start,
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: EdgeInsets.only(top: 10.0), padding: EdgeInsets.only(top: 10.0),
@ -93,7 +115,8 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
Expanded( Expanded(
child: Text( child: Text(
'Olaya ST, Behind kfc next to king ', 'Olaya ST, Behind kfc next to king ',
style: TextStyle(color: Colors.black45), style: TextStyle(
color: Colors.black45),
), ),
) )
], ],
@ -102,7 +125,8 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
Padding( Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment
.center,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: CircleAvatar( child: CircleAvatar(
@ -112,13 +136,15 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
backgroundColor: Colors.white, backgroundColor: Colors.white,
maxRadius: 25.1, maxRadius: 25.1,
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(
8.0),
child: Text( child: Text(
'3 K.m \n away', '3 K.m \n away',
style: TextStyle( style: TextStyle(
color: Color(0xff30B7B9), color: Color(0xff30B7B9),
fontSize: 12.5, fontSize: 12.5,
fontWeight: FontWeight.w600), fontWeight: FontWeight
.w600),
), ),
), ),
), ),
@ -130,6 +156,7 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
], ],
), ),
), ),
),
); );
}), }),
), ),

@ -119,4 +119,14 @@ class DateUtil {
else else
return ""; 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 'package:flutter/material.dart';
import '../../uitl/date_uitl.dart';
import '../../uitl/translations_delegate_base.dart'; import '../../uitl/translations_delegate_base.dart';
class CustomerBrief extends StatelessWidget { class CustomerBrief extends StatelessWidget {
final int itemId; final String itemId;
final String time; final String time;
final String customerFirstName; final String customerFirstName;
final String customerLastName; final String customerLastName;
@ -121,7 +122,7 @@ class CustomerBrief extends StatelessWidget {
width: 170, width: 170,
), ),
Text( Text(
'SAR 70', totalPayment.toString(), //'SAR 70',
style: TextStyle(fontWeight: FontWeight.bold), style: TextStyle(fontWeight: FontWeight.bold),
), ),
], ],
@ -137,7 +138,12 @@ class CustomerBrief extends StatelessWidget {
SizedBox( SizedBox(
width: 50, 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)), style: TextStyle(fontWeight: FontWeight.bold)),
], ],
) )

Loading…
Cancel
Save