From dcedc989e18641426a093b5c8fd70ad459b99ef2 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 26 Aug 2020 08:19:53 +0300 Subject: [PATCH] updates --- lib/config/localized_values.dart | 24 ++- .../pending_orders/pending_orders_model.dart | 26 +-- lib/pages/dashboard/dashboard_screen.dart | 177 ++++++++++-------- lib/pages/orders/pending_orders_page.dart | 168 +++++++++-------- lib/uitl/translations_delegate_base.dart | 18 +- 5 files changed, 234 insertions(+), 179 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5cfdfbe..2d54262 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -11,7 +11,7 @@ const Map> localizedValues = { 'services': {'en': 'SERVICES', 'ar': 'الخدمات'}, 'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'}, 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, - 'booking':{'en': 'Booking','ar':'حجز'}, + 'booking': {'en': 'Booking', 'ar': 'حجز'}, 'enterId': {'en': 'User Name', 'ar': 'اسم المستخدم'}, 'pleaseEnterYourID': { 'en': 'Please enter your ', @@ -26,13 +26,19 @@ const Map> localizedValues = { 'en': 'Please insert username and password to login', 'ar': 'الرجاء إدخال اسم المستخدم وكلمة المرور لتسجيل الدخول' }, - 'forgotPassword': { - 'en': 'Forgot Password?', - 'ar': 'هل نسيت كلمة المرور ؟' + 'forgotPassword': {'en': 'Forgot Password?', 'ar': 'هل نسيت كلمة المرور ؟'}, + 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, + 'haveGreatDay': {'en': 'have a great day ,', 'ar': 'أتمنى لك يوما جميلا '}, + 'youHave': {'en': 'You Have', 'ar': 'يوجد لديك'}, + 'deliveredPackages': {'en': 'Delivered Packages', 'ar': 'الطرود المسلمة'}, + 'seeAll': {'en': 'See All', 'ar': 'اظهار الكل'}, + 'nearestDropOffs': {'en': 'nearest drop-offs', 'ar': 'أقرب نقطة إنزال'}, + 'undeliveredPackages': { + 'en': 'Undelivered Packages', + 'ar': 'الطرود التي لم يتم تسليمها' }, - 'login': { - 'en': 'Login', - 'ar': 'تسجيل الدخول' - } - + 'away': {'en': 'away', 'ar': 'بعيدا'}, + 'scan': {'en': 'Scan', 'ar': 'مسح'}, + 'scan2': {'en': 'away', 'ar': 'بعيدا'}, + 'scanDb': {'en': 'away', 'ar': 'بعيدا'}, }; diff --git a/lib/core/model/pending_orders/pending_orders_model.dart b/lib/core/model/pending_orders/pending_orders_model.dart index c2ef9e3..b6dfc6e 100644 --- a/lib/core/model/pending_orders/pending_orders_model.dart +++ b/lib/core/model/pending_orders/pending_orders_model.dart @@ -11,18 +11,21 @@ class PendingOrders { String firstName; String lastName; String mobileNumber; + int distanceInKilometers; - PendingOrders( - {this.driverID, - this.searchKey, - this.pageSize, - this.pageIndex, - this.tokenID, - this.userID, - this.mobileNo, - this.firstName, - this.lastName, - this.mobileNumber}); + PendingOrders({ + this.driverID, + this.searchKey, + this.pageSize, + this.pageIndex, + this.tokenID, + this.userID, + this.mobileNo, + this.firstName, + this.lastName, + this.mobileNumber, + this.distanceInKilometers, + }); PendingOrders.fromJson(Map json) { driverID = json['DriverID']; @@ -35,6 +38,7 @@ class PendingOrders { firstName = json['FirstName']; lastName = json['LastName']; mobileNumber = json['MobileNumber']; + distanceInKilometers = json['DistanceInKilometers']; } Map toJson() { diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index b9a81c4..5a00639 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart'; +import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; class DashboardScreen extends StatefulWidget { @override @@ -15,12 +16,12 @@ class DashboardScreen extends StatefulWidget { class _DashboardScreenState extends State { @override Widget build(BuildContext context) { + int orderId; return BaseView( onModelReady: (model) => model.getPendingOrders(), builder: (BuildContext context, PendingOrdersViewModel model, Widget child) => - Scaffold( - backgroundColor: Color(0xffF4F9FA), + AppScaffold( body: Column( // mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -210,7 +211,6 @@ class _DashboardScreenState extends State { 0.10, width: MediaQuery.of(context).size.width * 0.20, - scale: 0.9, fit: BoxFit.cover, ), ], @@ -328,98 +328,113 @@ class _DashboardScreenState extends State { ], ), ), - Column( - children: [ - ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: //model.orders == null ? 0 : model.orders.length, - 3, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), - child: RoundedContainer( - height: MediaQuery.of(context).size.height * 0.108, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(left: 22.0), - child: Image.asset( - 'assets/images/location.png'), - ) - ], - ), - ), - if (model.orders.length != 0) + Expanded( + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: //model.orders == null ? 0 : model.orders.length, + 3, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: InkWell( + child: RoundedContainer( + height: MediaQuery.of(context).size.height * 0.108, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Expanded( - flex: 3, + flex: 1, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - 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), - ), - Expanded( - child: Text( - 'Olaya ST, Behind kfc next to king ', - style: - TextStyle(color: Colors.black45), + Padding( + padding: EdgeInsets.only(left: 22.0), + child: Image.asset( + 'assets/images/location.png', + height: MediaQuery.of(context) + .size + .height * + 0.10, + width: MediaQuery.of(context) + .size + .width * + 0.09, ), ) ], ), ), - Padding( - padding: EdgeInsets.all(10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: CircleAvatar( - backgroundColor: Colors.black45, - radius: 28.0, + if (model.orders.length != 0) + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + 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), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ,Olaya ST ', + style: TextStyle( + color: Colors.black45), + ), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 12.5, - fontWeight: FontWeight.w600), + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: + const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: + FontWeight.w600), + ), ), ), ), - ), - ) - ], + ) + ], + ), ), - ), - ], + ], + ), ), - ), - ); - }) - ], + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + )), + ); + }), ) ], ), diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index 9544fa6..1060bf0 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -27,96 +27,112 @@ class _OrdersListScreenState extends State { ), body: Column( children: [ - Text( - 'Nearest', - style: TextStyle(color: Color(0xff30B7B9), fontSize: 18.0), + Center( + child: Text( + 'Nearest', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 18.0, + fontWeight: FontWeight.w400), + ), ), - ListView.builder( - itemCount: model.orders == null ? 0 : model.orders.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), - child: RoundedContainer( - height: MediaQuery.of(context).size.height * 0.11, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(left: 22.0), - child: - Image.asset('assets/images/location.png'), - ) - ], - ), - ), - if (model.orders.length != 0) + Expanded( + child: ListView.builder( + itemCount: model.orders == null ? 0 : model.orders.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: RoundedContainer( + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.107 + : MediaQuery.of(context).size.height * 0.18, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Expanded( - flex: 3, + flex: 1, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - 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), - ), - Expanded( - child: Text( - 'Olaya ST, Behind kfc next to king ', - style: TextStyle(color: Colors.black45), + Padding( + padding: EdgeInsets.only(left: 22.0), + child: Image.asset( + 'assets/images/location.png', + height: + MediaQuery.of(context).size.height * + 0.101, ), - ) + ), ], ), ), - Padding( - padding: EdgeInsets.all(10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: CircleAvatar( - backgroundColor: Colors.black45, - radius: 28.0, + if (model.orders.length != 0) + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + 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), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ', + style: TextStyle(color: Colors.black45), + ), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 12.5, - fontWeight: FontWeight.w600), + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), + ), ), ), ), - ), - ) - ], + ) + ], + ), ), - ), - ], + ], + ), ), - ), - ); - }), + ); + }), + ), ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 400292e..b497c1a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -49,9 +49,23 @@ class TranslationBase { String get english => localizedValues['english'][locale.languageCode]; String get arabic => localizedValues['arabic'][locale.languageCode]; - String get enterCredentialsMsg => localizedValues['enterCredentialsMsg'][locale.languageCode]; - String get forgotPassword => localizedValues['forgotPassword'][locale.languageCode]; + String get enterCredentialsMsg => + localizedValues['enterCredentialsMsg'][locale.languageCode]; + String get forgotPassword => + localizedValues['forgotPassword'][locale.languageCode]; String get login => localizedValues['login'][locale.languageCode]; + String get haveGreatDay => + localizedValues['haveGreatDay'][locale.languageCode]; + String get youHave => localizedValues['youHave'][locale.languageCode]; + String get deliveredPackages => + localizedValues['deliveredPackages'][locale.languageCode]; + String get seeAll => localizedValues['seeAll'][locale.languageCode]; + String get nearestDropOffs => + localizedValues['nearestDropOffs'][locale.languageCode]; + String get undeliveredPackages => + localizedValues['undeliveredPackages'][locale.languageCode]; + String get away => localizedValues['away'][locale.languageCode]; + String get scan => localizedValues['scan'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {