diff --git a/lib/core/model/orders/deliverd_order_req_model.dart b/lib/core/model/orders/deliverd_order_req_model.dart index 08cd574..d685ac0 100644 --- a/lib/core/model/orders/deliverd_order_req_model.dart +++ b/lib/core/model/orders/deliverd_order_req_model.dart @@ -8,6 +8,7 @@ class DeliverdOrderModel { String mobileNo; String longitude; String latitude; + String firstName; DeliverdOrderModel( {this.driverID, @@ -18,7 +19,8 @@ class DeliverdOrderModel { this.userID, this.mobileNo, this.longitude, - this.latitude}); + this.latitude, + this.firstName}); DeliverdOrderModel.fromJson(Map json) { driverID = json['DriverID']; @@ -30,6 +32,7 @@ class DeliverdOrderModel { mobileNo = json['MobileNo']; longitude = json['Longitude']; latitude = json['Latitude']; + firstName = json['FirstName']; } Map toJson() { diff --git a/lib/core/model/orders/deliverd_order_res_model.dart b/lib/core/model/orders/deliverd_order_res_model.dart index e69de29..46807f8 100644 --- a/lib/core/model/orders/deliverd_order_res_model.dart +++ b/lib/core/model/orders/deliverd_order_res_model.dart @@ -0,0 +1,158 @@ +class DeliverdOrderResModel { + 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; + int ePharmacyOrderNo; + int projectID; + String appointmentNo; + String dischargeID; + String patientID; + bool patientOutSA; + int channel; + double distanceInKilometers; + List itemsQuantitiesList; + + DeliverdOrderResModel( + {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.channel, + this.distanceInKilometers, + this.itemsQuantitiesList}); + + DeliverdOrderResModel.fromJson(Map 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']; + channel = json['Channel']; + distanceInKilometers = json['DistanceInKilometers']; + if (json['ItemsQuantitiesList'] != null) { + itemsQuantitiesList = new List(); + json['ItemsQuantitiesList'].forEach((v) { + itemsQuantitiesList.add(new ItemsQuantitiesList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + 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['Channel'] = this.channel; + data['DistanceInKilometers'] = this.distanceInKilometers; + if (this.itemsQuantitiesList != null) { + data['ItemsQuantitiesList'] = + this.itemsQuantitiesList.map((v) => v.toJson()).toList(); + } + return data; + } +} + +class ItemsQuantitiesList { + String itemName; + String itemNameN; + int productID; + int quantity; + + ItemsQuantitiesList( + {this.itemName, this.itemNameN, this.productID, this.quantity}); + + ItemsQuantitiesList.fromJson(Map json) { + itemName = json['ItemName']; + itemNameN = json['ItemNameN']; + productID = json['ProductID']; + quantity = json['Quantity']; + } + + Map toJson() { + final Map data = new Map(); + data['ItemName'] = this.itemName; + data['ItemNameN'] = this.itemNameN; + data['ProductID'] = this.productID; + data['Quantity'] = this.quantity; + return data; + } +} diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index 785ad1e..60cc4a6 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -6,26 +6,21 @@ import 'package:driverapp/core/model/orders/update_order_status_request_model.da import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/base_service.dart'; import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart'; +import 'package:driverapp/uitl/utils.dart'; +import 'package:location/location.dart'; +import 'package:driverapp/core/model/orders/deliverd_order_res_model.dart'; class OrdersService extends BaseService { List _orders = List(); List _nextOrdersList = List(); - List _deliverdOrderList = List(); - + List _deliverdOrderList = List(); List get orders => _orders; - List get deliverdOrderList => _deliverdOrderList; + List get deliverdOrderList => _deliverdOrderList; List get nextOrdersList => _nextOrdersList; bool isOrderInserted; bool isOrderStatusUpdated; - PendingOrders _requestGetPendingOrders = PendingOrders( - searchKey: "", - pageSize: 0, - pageIndex: 0, - latitude: "24.640000", - longitude: "46.753000", - ); DeliverdOrderModel _requestGetDeliverdOrders = DeliverdOrderModel( searchKey: "", pageSize: 0, @@ -35,6 +30,14 @@ class OrdersService extends BaseService { ); Future getPendingOrders() async { + LocationData loc = await Utils.getLocation(); + PendingOrders _requestGetPendingOrders = PendingOrders( + searchKey: "", + pageSize: 0, + pageIndex: 0, + latitude: loc.latitude.toString(), + longitude: loc.longitude.toString(), + ); hasError = false; try { await baseAppClient.post(GET_ALL_ORDERS, @@ -110,13 +113,21 @@ class OrdersService extends BaseService { } Future getDeliverdList() async { + LocationData loc = await Utils.getLocation(); + PendingOrders _requestGetPendingOrders = PendingOrders( + searchKey: "", + pageSize: 0, + pageIndex: 0, + latitude: loc.latitude.toString(), + longitude: loc.longitude.toString(), + ); hasError = false; try { await baseAppClient.post(GET_ALL_DELIVERD_ORDER, onSuccess: (dynamic response, int statusCode) { _deliverdOrderList.clear(); response['PatientER_Delivery_GetAllDeliverdOrderList'].forEach((order) { - _deliverdOrderList.add(DeliverdOrderModel.fromJson(order)); + _deliverdOrderList.add(DeliverdOrderResModel.fromJson(order)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModels/orders_view_model.dart b/lib/core/viewModels/orders_view_model.dart index 4d825b4..028656e 100644 --- a/lib/core/viewModels/orders_view_model.dart +++ b/lib/core/viewModels/orders_view_model.dart @@ -5,7 +5,7 @@ import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/orders_service.dart'; - +import 'package:driverapp/core/model/orders/deliverd_order_res_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; @@ -14,7 +14,7 @@ class OrdersViewModel extends BaseViewModel { List get orders => _ordersService.orders; - List get deliverdOrders => + List get deliverdOrders => _ordersService.deliverdOrderList; List get nextOrdersList => _ordersService.nextOrdersList; diff --git a/lib/main.dart b/lib/main.dart index 2036786..8449b2e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,4 @@ -import 'package:driverapp/root_page.dart'; +import 'package:driverapp/pages/splash_screen_page.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -81,8 +81,9 @@ class MyApp extends StatelessWidget { ), ), ), - initialRoute: '/', - routes: {'/': (context) => RootPage()}, + home: SplashScreenPage(), +// initialRoute: '/', +// routes: {'/': (context) => RootPage()}, debugShowCheckedModeBanner: false, ), ), diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index 867ddaa..f0fe1be 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -5,6 +5,7 @@ import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/viewModels/authentication_view_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; +import 'package:driverapp/pages/orders/deliverd_orders_page.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart'; import 'package:driverapp/pages/setting/setting.dart'; import 'package:driverapp/uitl/app_toast.dart'; @@ -18,7 +19,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; -import 'package:driverapp/pages/orders/deliverd_orders_page.dart'; import '../base/base_view.dart'; @@ -76,8 +76,9 @@ class _DashboardScreenState extends State { child: Text( _authenticationViewModel.user.userName, style: TextStyle( - fontWeight: FontWeight.w400, - fontSize: 25.0), + fontSize: 22.0, + color: Hexcolor("#343333"), + fontWeight: FontWeight.bold), ), ), ], @@ -355,12 +356,26 @@ class _DashboardScreenState extends State { children: [ Expanded( child: InkWell( + onTap: () { + _scanQrAndGetPatient(context, model); + }, child: Container( - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.18 - : MediaQuery.of(context).size.height * 0.30, - width: MediaQuery.of(context).size.width * 0.50, + height: MediaQuery + .of(context) + .orientation == + Orientation.portrait + ? MediaQuery + .of(context) + .size + .height * 0.18 + : MediaQuery + .of(context) + .size + .height * 0.30, + width: MediaQuery + .of(context) + .size + .width * 0.50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.0), gradient: LinearGradient( @@ -381,50 +396,50 @@ class _DashboardScreenState extends State { width: MediaQuery.of(context).size.width * 0.26, height: MediaQuery.of(context) - .orientation == - Orientation.portrait + .orientation == + Orientation.portrait ? MediaQuery.of(context).size.height * - 0.14 + 0.14 : MediaQuery.of(context).size.height * - 0.28, + 0.28, fit: BoxFit.contain, ) ], ), Column( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ - InkWell( - onTap: () { - _scanQrAndGetPatient(context, model); - }, - child: Padding( - padding: EdgeInsets.only(top: 8.0), - child: Text( - TranslationBase.of(context).scan, - style: TextStyle( - fontSize: MediaQuery.of(context) - .orientation == - Orientation.landscape - ? SizeConfig.textMultiplier * 6.0 - : SizeConfig.textMultiplier * 4.0, - color: Colors.white, - fontWeight: FontWeight.w400, - ), + Padding( + padding: EdgeInsets.only(top: 8.0), + child: Text( + TranslationBase + .of(context) + .scan, + style: TextStyle( + fontSize: MediaQuery + .of(context) + .orientation == + Orientation.landscape + ? SizeConfig.textMultiplier * 6.0 + : SizeConfig.textMultiplier * 4.0, + color: Colors.white, + fontWeight: FontWeight.w400, ), ), ), Padding( padding: EdgeInsets.only(top: 0.0), child: Text( - TranslationBase.of(context) + TranslationBase + .of(context) .toAddPackageToQue, style: TextStyle( - fontSize: MediaQuery.of(context) - .orientation == - Orientation.landscape + fontSize: MediaQuery + .of(context) + .orientation == + Orientation.landscape ? SizeConfig.textMultiplier * 3.0 : SizeConfig.textMultiplier * 2.0, color: Colors.white, @@ -443,25 +458,22 @@ class _DashboardScreenState extends State { ], ), ), - NetworkBaseView( - baseViewModel: model, - child: Padding( - padding: - EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Text( + Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Text( TranslationBase.of(context).nearestDropOffs, style: TextStyle( - fontSize: 21.0, - fontWeight: FontWeight.w400, - ), - ), - ], - ), + fontSize: 18.0, + color: Hexcolor("#343333"), + fontWeight: FontWeight.bold)), + ], + ), + if (model.state == ViewState.Idle) Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -480,16 +492,16 @@ class _DashboardScreenState extends State { ), ], ), - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OrdersListScreen()), - ), + onTap: () => + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + ), ), ], ), - ], - ), + ], ), ), NetworkBaseView( @@ -503,109 +515,131 @@ class _DashboardScreenState extends State { : model.orders.length < 3 ? model.orders.length : 3, itemBuilder: (BuildContext context, int index) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), + padding: EdgeInsets.symmetric(horizontal: 0.2), child: InkWell( - child: RoundedContainer( - raduis: 25.0, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.120 - : MediaQuery.of(context).size.height * 0.209, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - left: 15.0, top: 14.0), - child: Image.asset( - 'assets/images/location.png', - height: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context) - .size - .height * - 0.06 - : MediaQuery.of(context) - .size - .height * - 0.11, - width: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context) - .size - .width * - 0.05 - : MediaQuery.of(context) - .size - .width * - 0.09, - ), - ) - ], - ), - ), - if (model.orders.length != 0) + child: Container( + child: RoundedContainer( + showShadow: true, + raduis: 25.0, + height: MediaQuery + .of(context) + .orientation == + Orientation.portrait + ? MediaQuery + .of(context) + .size + .height * 0.120 + : MediaQuery + .of(context) + .size + .height * 0.209, + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ Expanded( - flex: 5, + flex: 1, child: Column( + mainAxisAlignment: + MainAxisAlignment.start, crossAxisAlignment: - CrossAxisAlignment.start, + CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(top: 20.0), - child: Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), + padding: EdgeInsets.only( + left: 15.0, top: 14.0), + child: Image.asset( + 'assets/images/location.png', + height: MediaQuery + .of(context) + .orientation == + Orientation.portrait + ? MediaQuery + .of(context) + .size + .height * + 0.06 + : MediaQuery + .of(context) + .size + .height * + 0.11, + width: MediaQuery + .of(context) + .orientation == + Orientation.portrait + ? MediaQuery + .of(context) + .size + .width * + 0.05 + : MediaQuery + .of(context) + .size + .width * + 0.09, ), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0, + ) + ], + ), + ), + if (model.orders.length != 0) + Expanded( + flex: 5, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 20.0), + child: Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle( + fontSize: 18.0, + color: Hexcolor("#343333"), + fontWeight: FontWeight.bold), + ), ), - ), - Expanded( - child: Text( - model.orders[index].orderID - .toString(), + Text( + model.orders[index].mobileNumber, style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.w400, - letterSpacing: 8.0), + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0, + ), ), - ), - ], + Expanded( + child: Text( + model.orders[index].orderID + .toString(), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.w400, + letterSpacing: 8.0), + ), + ), + ], + ), ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: CircleContainer( - borderWidth: 0.9, - child: Text( - model.orders[index].distanceInKilometers - .toString() + - '\nK.m\naway', - style: TextStyle( - color: Color(0xff42B6AD), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.normal), + Padding( + padding: EdgeInsets.all(8.0), + child: CircleContainer( + borderWidth: 1.5, + child: Text( + model.orders[index].distanceInKilometers + .toString() + + '\nK.m\naway', + style: TextStyle( + color: Color(0xff42B6AD), + fontWeight: FontWeight.w800, + fontStyle: FontStyle.normal), + ), ), ), - ), - ], + ], + ), ), ), onTap: () { diff --git a/lib/pages/delivery/delivery_confirmed_page.dart b/lib/pages/delivery/delivery_confirmed_page.dart index 24c367b..c2e6f54 100644 --- a/lib/pages/delivery/delivery_confirmed_page.dart +++ b/lib/pages/delivery/delivery_confirmed_page.dart @@ -68,79 +68,82 @@ class DeliveryConfirmedPage extends StatelessWidget { fontWeight: FontWeight.bold), ), SizedBox( - height: - MediaQuery.of(context).size.width * 0.03, - ), - Text( - TranslationBase.of(context).confirmationSent, - style: TextStyle( - color: Colors.white, - fontSize: 13, + height: + MediaQuery.of(context).size.width * + 0.01, ), - ), - ], + Text( + TranslationBase.of(context) + .confirmationSent, + style: TextStyle( + color: Colors.white, + fontSize: 13, + ), + ), + ], + ), ), - ), - ], + ], + ), ), - ), - ], - ), - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width, - ), - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 1.0, - margin: EdgeInsets.only( - top: MediaQuery.of(context).size.width * 0.75, + ], ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(80), - topRight: Radius.circular(80)), + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width, ), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.width * 0.09, - ), - child: Column( - children: [ - FlatButton.icon( - padding: EdgeInsets.all(8), - color: Colors.orangeAccent, - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(10.0), - ), - label: Text( - TranslationBase.of(context).addNoteBtn, - style: TextStyle(color: Colors.white), + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width * 1.0, + margin: EdgeInsets.only( + top: MediaQuery.of(context).size.width * 0.75, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(80), + topRight: Radius.circular(80)), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).size.width * 0.09, + ), + child: Column( + children: [ + FlatButton.icon( + padding: EdgeInsets.all(8), + color: Colors.orangeAccent, + shape: RoundedRectangleBorder( + borderRadius: + new BorderRadius.circular(10.0), + ), + label: Text( + TranslationBase.of(context).addNoteBtn, + style: TextStyle(color: Colors.white), + ), + icon: Icon( + Icons.mode_edit, + color: Colors.white, + ), + onPressed: () {}, ), - icon: Icon( - Icons.mode_edit, - color: Colors.white, + SizedBox( + height: MediaQuery.of(context).size.width * + 0.02, //20, ), - onPressed: () {}, - ), - SizedBox( - height: - MediaQuery.of(context).size.width * 0.02, //20, - ), - Container( - margin: EdgeInsets.all(10), + Container( + margin: EdgeInsets.all(10), child: SecondaryButton( - label: TranslationBase - .of(context) - .nextDelivery, - loading: model.state == ViewState.BusyLocal, - onTap: () { - getNextOrder(context, model);}, + label: TranslationBase.of(context) + .nextDelivery, + loading: model.state == ViewState.BusyLocal, + onTap: () { + getNextOrder(context, model); + }, ), ), ], diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart index 3a13967..6860891 100644 --- a/lib/pages/delivery/information_page.dart +++ b/lib/pages/delivery/information_page.dart @@ -1 +1 @@ -import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/dialog/custom_dialog.dart'; import 'package:driverapp/widgets/data_display/text.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/delivery_action_button.dart'; import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { showDeliveryOptions(OrdersViewModel model) { showModalBottomSheet( backgroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), context: context, builder: (BuildContext bc) { return ListView( children: [ Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: MediaQuery.of(context).orientation == Orientation.portrait ? 0.9 : 0.98, child: Container( height: MediaQuery.of(context).size.height * 0.45, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), width: double.infinity, child: ListView( children: [ Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 15, ), ActionSheetButton( label: TranslationBase.of(context).delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context).canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox(height: 15), ], ), ], ), )) ], ), ), ], ); }); } return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Color(0xff45B7AE), arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, body: Container( color: Colors.red, child: Container( color: Color(0xff45B7AE), child: ListView( children: [ Column( children: [ Stack( children: [ // Container( // width: MediaQuery.of(context).size.width, // height: MediaQuery.of(context).size.width, // ), Container( width: MediaQuery .of(context) .size .width * 1, height: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 1.5 : MediaQuery.of(context).size.width * 0.9, margin: EdgeInsets.only( top: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 0.23 : MediaQuery.of(context).size.width * 0.13), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(45), topRight: Radius.circular(45)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: MediaQuery.of(context).size.width * 0.23, //MediaQuery.of(context).size.width * 0.005, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Colors.white, //Color(0xffED1C24), btnIcon: Icon(DriverApp.location_1, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Color(0xffED1C24)), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); }, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Color(0xFF5EA34A), ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Color(0xffFFA540), ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors .white, //Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Theme.of(context).primaryColor, ), btnName: TranslationBase.of(context).call, btnFunction: () => launch("tel://" + item.mobileNumber), ), ], ), SizedBox( height: MediaQuery.of(context).size.width * 0.08, ), Container( margin: EdgeInsets.only( left: MediaQuery .of(context) .size .width * 0.05, right: MediaQuery .of(context) .size .width * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment .start, children: [ Padding( padding: const EdgeInsets.only( left: 8), child: Text( TranslationBase .of(context) .packageContent, style: TextStyle( fontWeight: FontWeight.w900, fontSize: 20), ), ), SizedBox( height: MediaQuery .of(context) .size .width * 0.05, ), Padding( padding: const EdgeInsets.only( left: 10), child: Column( children: List.generate( item.itemsQuantitiesList != null ? item .itemsQuantitiesList.length : 0, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), SizedBox( height: MediaQuery .of(context) .size .width * 0.01, ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: EdgeInsets.all(10), child: SecondaryButton( label: TranslationBase.of(context).clientReached, onTap: () { showDeliveryOptions(model); }, ), ), ], ), ), CustomerBriefCard( itemId: item.orderID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn, longitude: item.longitude, latitude: item.latitude, ), ], ), ], ), ], ), ), ), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase.of(context).delivered; break; case 4: orderStatusText = TranslationBase.of(context).deliveredAccepted; break; case 5: orderStatusText = TranslationBase.of(context).deliveredRejected; break; case 6: orderStatusText = TranslationBase.of(context).canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model, ); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel( deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file +import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/dialog/custom_dialog.dart'; import 'package:driverapp/widgets/data_display/text.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/delivery_action_button.dart'; import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { showDeliveryOptions(OrdersViewModel model) { showModalBottomSheet( backgroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), context: context, builder: (BuildContext bc) { return ListView( children: [ Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: MediaQuery.of(context).orientation == Orientation.portrait ? 0.9 : 0.98, child: Container( height: MediaQuery.of(context).size.height * 0.45, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), width: double.infinity, child: ListView( children: [ Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 15, ), ActionSheetButton( label: TranslationBase.of(context).delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context).canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox(height: 15), ], ), ], ), )) ], ), ), ], ); }); } return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Color(0xff45B7AE), arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, body: Container( color: Colors.red, child: Container( color: Color(0xff45B7AE), child: ListView( children: [ Column( children: [ Stack( children: [ // Container( // width: MediaQuery.of(context).size.width, // height: MediaQuery.of(context).size.width, // ), Container( width: MediaQuery.of(context).size.width * 1, height: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 1.9 : MediaQuery.of(context).size.width * 1.1, margin: EdgeInsets.only( top: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 0.23 : MediaQuery.of(context).size.width * 0.13), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(45), topRight: Radius.circular(45)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: MediaQuery.of(context).size.width * 0.4, //MediaQuery.of(context).size.width * 0.005, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Colors.white, //Color(0xffED1C24), btnIcon: Icon(DriverApp.location_1, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Color(0xffED1C24)), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); }, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Color(0xFF5EA34A), ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Color(0xffFFA540), ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors .white, //Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Theme.of(context).primaryColor, ), btnName: TranslationBase.of(context).call, btnFunction: () => launch("tel://" + item.mobileNumber), ), ], ), SizedBox( height: MediaQuery.of(context).size.width * 0.08, ), Container( margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( TranslationBase.of(context) .packageContent, style: TextStyle( fontWeight: FontWeight.w900, fontSize: 20), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.05, ), Padding( padding: const EdgeInsets.only(left: 10), child: Column( children: List.generate( item.itemsQuantitiesList != null ? item .itemsQuantitiesList.length : 0, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( child: SecondaryButton( label: TranslationBase.of(context).clientReached, onTap: () { showDeliveryOptions(model); }, ), ), ], ), ), CustomerBriefCard( itemId: item.orderID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn, longitude: item.longitude, latitude: item.latitude, ), ], ), ], ), ], ), ), ), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase.of(context).delivered; break; case 4: orderStatusText = TranslationBase.of(context).deliveredAccepted; break; case 5: orderStatusText = TranslationBase.of(context).deliveredRejected; break; case 6: orderStatusText = TranslationBase.of(context).canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model, ); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel( deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file diff --git a/lib/pages/orders/deliverd_orders_page.dart b/lib/pages/orders/deliverd_orders_page.dart index db4119f..c9c0fbe 100644 --- a/lib/pages/orders/deliverd_orders_page.dart +++ b/lib/pages/orders/deliverd_orders_page.dart @@ -1,11 +1,11 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; -import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:driverapp/widgets/data_display/circle-container.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; import '../base/base_view.dart'; @@ -22,15 +22,20 @@ class _DeliverdOrdersPageState extends State { builder: (BuildContext context, OrdersViewModel model, Widget child) => AppScaffold( isShowAppBar: true, - appBarTitle: TranslationBase.of(context).yourDeliveryQue, + appBarTitle: 'Delivered List', titleColor: Colors.black, body: Column( children: [ + SizedBox( + height: 20, + ), Expanded( child: ListView.builder( shrinkWrap: true, scrollDirection: Axis.vertical, - itemCount: model.orders == null ? 0 : model.orders.length, + itemCount: model.deliverdOrders == null + ? 0 + : model.deliverdOrders.length, itemBuilder: (BuildContext context, int index) { return Padding( padding: EdgeInsets.symmetric(horizontal: 12.2), @@ -83,14 +88,17 @@ class _DeliverdOrdersPageState extends State { Padding( padding: EdgeInsets.only(top: 20.0), child: Text( - model.orders[index].firstName + + model.deliverdOrders[index].firstName + ' ' + model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), + style: TextStyle( + fontSize: 18.0, + color: Hexcolor("#343333"), + fontWeight: FontWeight.bold), ), ), Text( - model.orders[index].mobileNumber, + model.deliverdOrders[index].mobileNumber, style: TextStyle( color: Color(0xff30B7B9), fontWeight: FontWeight.w600, @@ -99,7 +107,8 @@ class _DeliverdOrdersPageState extends State { ), Expanded( child: Text( - model.orders[index].orderID.toString(), + model.deliverdOrders[index].orderID + .toString(), style: TextStyle( fontSize: 18.0, fontWeight: FontWeight.w400, @@ -112,11 +121,11 @@ class _DeliverdOrdersPageState extends State { Padding( padding: EdgeInsets.all(8.0), child: CircleContainer( - borderWidth: 0.8, child: Text( - model.orders[index].distanceInKilometers + model.deliverdOrders[index] + .distanceInKilometers .toString() + - ' K.m\naway', + '\nK.m\naway', style: TextStyle( color: Color(0xff42B6AD), fontWeight: FontWeight.w800, @@ -127,13 +136,13 @@ class _DeliverdOrdersPageState extends State { ], ), ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - InformationPage(model.orders[index]))); - }, +// onTap: () { +// Navigator.push( +// context, +// MaterialPageRoute( +// builder: (context) => +// InformationPage(model.orders[index]))); +// }, ), ); }, diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index 50eb090..20d7d31 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -1,11 +1,13 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; +import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:driverapp/widgets/data_display/circle-container.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:driverapp/uitl/translations_delegate_base.dart'; +import 'package:hexcolor/hexcolor.dart'; + import '../base/base_view.dart'; class OrdersListScreen extends StatefulWidget { @@ -25,6 +27,9 @@ class _OrdersListScreenState extends State { titleColor: Colors.black, body: Column( children: [ + SizedBox( + height: 20, + ), Expanded( child: ListView.builder( shrinkWrap: true, @@ -85,7 +90,10 @@ class _OrdersListScreenState extends State { model.orders[index].firstName + ' ' + model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), + style: TextStyle( + fontSize: 18.0, + color: Hexcolor("#343333"), + fontWeight: FontWeight.bold), ), ), Text( @@ -111,7 +119,6 @@ class _OrdersListScreenState extends State { Padding( padding: EdgeInsets.all(8.0), child: CircleContainer( - borderWidth: 0.8, child: Text( model.orders[index].distanceInKilometers .toString() + diff --git a/lib/pages/splash_screen_page.dart b/lib/pages/splash_screen_page.dart new file mode 100644 index 0000000..038b982 --- /dev/null +++ b/lib/pages/splash_screen_page.dart @@ -0,0 +1,150 @@ +import 'dart:async'; + +import 'package:driverapp/app-icons/driver_app_icons.dart'; +import 'package:driverapp/core/viewModels/project_view_model.dart'; +import 'package:driverapp/root_page.dart'; +import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; + +class SplashScreenPage extends StatefulWidget { + @override + _SplashScreenPageState createState() => _SplashScreenPageState(); +} + +class _SplashScreenPageState extends State { + startTime() async { + var _duration = new Duration(seconds: 1); + return new Timer(_duration, navigationPage); + } + + @override + void initState() { + super.initState(); + startTime(); + } + + @override + Widget build(BuildContext context) { + ProjectViewModel projectViewModel = Provider.of(context); + + return AppScaffold( + isShowAppBar: false, + appBarColor: Color(0xff30B7B9), + body: SingleChildScrollView( + child: Center( + child: Column( +// mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FractionallySizedBox( + widthFactor: 0.80, + child: Column( + children: [ + SizedBox( + height: 200, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Icon( + DriverApp.logo, + size: 110, + color: Colors.white, + ), + margin: EdgeInsets.only( + right: projectViewModel.isArabic + ? 0 + : MediaQuery.of(context).size.width * 0.15, + left: !projectViewModel.isArabic + ? 0 + : MediaQuery.of(context).size.width * 0.15), + ), + ], + ), + SizedBox( + height: 20, + ), + Column( + children: [ + Text( + "Driver", + style: TextStyle( + fontSize: 70, + fontWeight: FontWeight.bold, + color: Colors.white), + ), + Text( + "Delivery", + style: TextStyle( + fontSize: 50, + letterSpacing: 1, + color: Colors.white), + ), + Text( + "APP", + style: TextStyle( + fontSize: 53, + letterSpacing: 53, + color: Colors.white, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox( + height: 280, + ) + ], + ), + ), + Center( + child: FractionallySizedBox( + widthFactor: 0.80, + child: Column( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.symmetric(horizontal: 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + child: Center( + child: Text( + "Powered by Cloud Solutions", + style: TextStyle( + fontSize: 13, color: Colors.white), + ), + ), + ), + SizedBox( + height: 10, + ) + ], + ), + ), + ], + ), + ], + ), + ), + ), + ], + ), + ), + ), + ); + } + + void navigationPage() { + Navigator.pushReplacement( + context, + MaterialPageRoute( + builder: (context) => RootPage(), + ), + ); + } +} diff --git a/lib/widgets/bottom_sheet/action_sheet_button.dart b/lib/widgets/bottom_sheet/action_sheet_button.dart index f7d53f5..5521a7e 100644 --- a/lib/widgets/bottom_sheet/action_sheet_button.dart +++ b/lib/widgets/bottom_sheet/action_sheet_button.dart @@ -63,7 +63,8 @@ class ActionSheetButton extends StatelessWidget { padding: EdgeInsets.only(top: 5.0), child: Text( label, - style: TextStyle(fontSize: 22.0, + style: TextStyle( + fontSize: 22.0, fontFamily: "Metropolis-Bold", color: Hexcolor("##1A1818")), ), diff --git a/lib/widgets/data_display/circle-container.dart b/lib/widgets/data_display/circle-container.dart index 02efbdf..071de37 100644 --- a/lib/widgets/data_display/circle-container.dart +++ b/lib/widgets/data_display/circle-container.dart @@ -6,7 +6,7 @@ class CircleContainer extends StatelessWidget { {this.child, this.color = Colors.white, this.borderColor, - this.borderWidth = 2.0, + this.borderWidth = 1.5, this.onTap}); final Widget child; diff --git a/lib/widgets/data_display/dialog/custom_dialog.dart b/lib/widgets/data_display/dialog/custom_dialog.dart index afd1a3b..68fd481 100644 --- a/lib/widgets/data_display/dialog/custom_dialog.dart +++ b/lib/widgets/data_display/dialog/custom_dialog.dart @@ -22,7 +22,7 @@ class CustomDialog extends StatelessWidget { builder: (_, model, w) => Center( child: Container( height: SizeConfig.isPortrait - ? MediaQuery.of(context).size.height * 0.43 + ? MediaQuery.of(context).size.height * 0.49 : MediaQuery.of(context).size.height * 0.90, width: MediaQuery.of(context).size.width * 0.95, child: Dialog( @@ -58,9 +58,7 @@ class CustomDialog extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.end, children: [ Texts( - TranslationBase - .of(context) - .areYouSure, + TranslationBase.of(context).areYouSure, color: Colors.black, fontSize: 20, ), @@ -72,21 +70,18 @@ class CustomDialog extends StatelessWidget { child: Column( children: [ SecondaryButton( - label: TranslationBase - .of(context) - .confirm, + label: TranslationBase.of(context).confirm, loading: model.state == ViewState.BusyLocal, onTap: () { model.setState(ViewState.BusyLocal); callService(); }, - ), SizedBox( + ), + SizedBox( height: 10, ), SecondaryButton( - label: TranslationBase - .of(context) - .canceled, + label: TranslationBase.of(context).canceled, onTap: () { model.hideBottomSheet(); Navigator.of(context).pop(); @@ -95,7 +90,6 @@ class CustomDialog extends StatelessWidget { ], ), ), - ], ), ) diff --git a/lib/widgets/delivery/customer_brief_card.dart b/lib/widgets/delivery/customer_brief_card.dart index 9e39e7f..af08d68 100644 --- a/lib/widgets/delivery/customer_brief_card.dart +++ b/lib/widgets/delivery/customer_brief_card.dart @@ -1,6 +1,6 @@ import 'package:driverapp/widgets/data_display/circle-container.dart'; import 'package:flutter/material.dart'; - +import 'package:driverapp/config/size_config.dart'; import '../../uitl/date_uitl.dart'; import '../../uitl/translations_delegate_base.dart'; @@ -36,9 +36,9 @@ class CustomerBriefCard extends StatelessWidget { return Center( child: Container( width: MediaQuery.of(context).orientation == Orientation.landscape - ? 580 - : 370, - height: 270, + ? SizeConfig.widthMultiplier * 125.0 + : SizeConfig.widthMultiplier * 90.0, + height: 290, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( @@ -76,7 +76,6 @@ class CustomerBriefCard extends StatelessWidget { child: Padding( padding: EdgeInsets.all(8.0), child: CircleContainer( - borderWidth: 0.9, child: Text( '0 K.m\naway', style: TextStyle( diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index b4cdec7..de00fca 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -33,7 +33,8 @@ class AppScaffold extends StatelessWidget { Widget build(BuildContext context) { AppGlobal.context = context; return SafeArea( - bottom: false, +// top: false, +// bottom: false, child: Scaffold( backgroundColor: appBarColor ?? Theme.of(context).scaffoldBackgroundColor, @@ -43,8 +44,8 @@ class AppScaffold extends StatelessWidget { backgroundColor: Theme.of(context).appBarTheme.color, textTheme: TextTheme( headline6: TextStyle( - color: titleColor ?? Colors.white, - fontWeight: FontWeight.bold), + color: titleColor ?? Colors.white, + fontWeight: FontWeight.bold), ), title: Text(appBarTitle.toUpperCase()), leading: Builder( diff --git a/lib/widgets/others/rounded_container.dart b/lib/widgets/others/rounded_container.dart index 93dc6cc..3bdcab9 100644 --- a/lib/widgets/others/rounded_container.dart +++ b/lib/widgets/others/rounded_container.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; class RoundedContainer extends StatefulWidget { final double width; @@ -16,6 +17,7 @@ class RoundedContainer extends StatefulWidget { final double bottomLeft; final Widget child; final double borderWidth; + final bool showShadow; RoundedContainer( {@required this.child, @@ -32,12 +34,14 @@ class RoundedContainer extends StatefulWidget { this.topRight = 0, this.bottomRight = 0, this.bottomLeft = 0, - this.borderWidth = 1}); + this.borderWidth = 1, + this.showShadow = true}); @override _RoundedContainerState createState() => _RoundedContainerState(); } + class _RoundedContainerState extends State { @override Widget build(BuildContext context) { @@ -45,36 +49,40 @@ class _RoundedContainerState extends State { width: widget.width, height: widget.height, margin: EdgeInsets.all(widget.margin), - decoration: widget.showBorder == true - ? BoxDecoration( - color: Theme.of(context).primaryColor, - border: Border.all( - color: widget.borderColor, width: widget.borderWidth), - borderRadius: widget.customCornerRaduis - ? BorderRadius.only( - topLeft: Radius.circular(widget.topLeft), - topRight: Radius.circular(widget.topRight), - bottomRight: Radius.circular(widget.bottomRight), - bottomLeft: Radius.circular(widget.bottomLeft)) - : BorderRadius.circular(widget.raduis), - boxShadow: [ - BoxShadow( - color: Colors.grey.withOpacity(0.1), - spreadRadius: 10, - blurRadius: 5, - offset: Offset(0, 5), // changes position of shadow - ), - ]) - : null, + decoration: + BoxDecoration( + color: Theme + .of(context) + .primaryColor, + + border: widget.showBorder == true ? Border.all( + color: widget.borderColor, width: widget.borderWidth) : null, + borderRadius: widget.customCornerRaduis + ? BorderRadius.only( + topLeft: Radius.circular(widget.topLeft), + topRight: Radius.circular(widget.topRight), + bottomRight: Radius.circular(widget.bottomRight), + bottomLeft: Radius.circular(widget.bottomLeft)) + : BorderRadius.circular(widget.raduis), + + boxShadow: widget.showShadow ? [ + BoxShadow( + color: Hexcolor("#DBE5E6"), + spreadRadius: 15, + blurRadius: 15, + offset: Offset(0, 7), // changes position of shadow + ), + ] : []) + , child: Card( margin: EdgeInsets.all(0), shape: RoundedRectangleBorder( borderRadius: widget.customCornerRaduis ? BorderRadius.only( - topLeft: Radius.circular(widget.topLeft), - topRight: Radius.circular(widget.topRight), - bottomRight: Radius.circular(widget.bottomRight), - bottomLeft: Radius.circular(widget.bottomLeft)) + topLeft: Radius.circular(widget.topLeft), + topRight: Radius.circular(widget.topRight), + bottomRight: Radius.circular(widget.bottomRight), + bottomLeft: Radius.circular(widget.bottomLeft)) : BorderRadius.circular(widget.raduis), ), color: widget.backgroundColor, diff --git a/pubspec.yaml b/pubspec.yaml index 778cf11..193eabc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,6 +78,8 @@ dependencies: + + dev_dependencies: flutter_test: sdk: flutter