Merge branch 'development' into 'master'

Development

See merge request Cloud_Solution/driver-app!72
logout_function
Mohammad Aljammal 5 years ago
commit 1364cb081c

@ -28,6 +28,10 @@ PODS:
- Flutter
- local_auth (0.0.1):
- Flutter
- location (0.0.1):
- Flutter
- location_web (0.0.1):
- Flutter
- map_launcher (0.0.1):
- Flutter
- maps_launcher (0.0.1):
@ -71,6 +75,8 @@ DEPENDENCIES:
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- local_auth (from `.symlinks/plugins/local_auth/ios`)
- location (from `.symlinks/plugins/location/ios`)
- location_web (from `.symlinks/plugins/location_web/ios`)
- map_launcher (from `.symlinks/plugins/map_launcher/ios`)
- maps_launcher (from `.symlinks/plugins/maps_launcher/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
@ -118,6 +124,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker/ios"
local_auth:
:path: ".symlinks/plugins/local_auth/ios"
location:
:path: ".symlinks/plugins/location/ios"
location_web:
:path: ".symlinks/plugins/location_web/ios"
map_launcher:
:path: ".symlinks/plugins/map_launcher/ios"
maps_launcher:
@ -157,6 +167,8 @@ SPEC CHECKSUMS:
image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
location_web: b94e7433cfe28c0f7c8923c2ee482824b32e55a7
map_launcher: e325db1261d029ff33e08e03baccffe09593ffea
maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb

@ -242,6 +242,7 @@
"${BUILT_PRODUCTS_DIR}/image_cropper/image_cropper.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
"${BUILT_PRODUCTS_DIR}/local_auth/local_auth.framework",
"${BUILT_PRODUCTS_DIR}/location/location.framework",
"${BUILT_PRODUCTS_DIR}/map_launcher/map_launcher.framework",
"${BUILT_PRODUCTS_DIR}/maps_launcher/maps_launcher.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
@ -264,6 +265,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_cropper.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/location.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/map_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/maps_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",

@ -41,5 +41,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSLocationAlwaysUsageDescription</key>
<string>Needed to access location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Needed to access location</string>
</dict>
</plist>

@ -10,6 +10,8 @@ class PendingOrders {
String lastName;
String mobileNumber;
int distanceInKilometers;
String longitude;
String latitude;
PendingOrders({
this.driverID,
@ -23,6 +25,8 @@ class PendingOrders {
this.lastName,
this.mobileNumber,
this.distanceInKilometers,
this.longitude,
this.latitude,
});
PendingOrders.fromJson(Map<String, dynamic> json) {
@ -48,6 +52,9 @@ class PendingOrders {
data['TokenID'] = this.tokenID;
data['UserID'] = this.userID;
data['MobileNo'] = this.mobileNo;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
return data;
}
}

@ -23,6 +23,8 @@ class OrdersService extends BaseService {
searchKey: "",
pageSize: 0,
pageIndex: 0,
latitude: "24.640000",
longitude: "46.753000",
);
DeliverdOrderModel _requestGetDeliverdOrders = DeliverdOrderModel(
searchKey: "",

@ -69,7 +69,10 @@ class AuthenticationViewModel with ChangeNotifier {
isError = true;
notifyListeners();
} else {
sharedPref.setObject(
isLoading = false;
isError = false;
isLogin = true;
await sharedPref.setObject(
USER_PROFILE, _authenticationService.authenticatedUser);
sharedPref.setString(TOKEN, _authenticationService.token);
user = _authenticationService.authenticatedUser;

@ -3,7 +3,6 @@ import 'package:get_it/get_it.dart';
import 'core/service/authentication_service.dart';
import 'core/service/hospital_service.dart';
import 'core/service/orders_service.dart';
import 'core/viewModels/authentication_view_model.dart';
import 'core/viewModels/hospital_view_model.dart';
import 'core/viewModels/orders_view_model.dart';
@ -18,6 +17,6 @@ void setupLocator() {
/// View Model
locator.registerFactory(() => HospitalViewModel());
locator.registerFactory(() => AuthenticationViewModel());
// locator.registerFactory(() => AuthenticationViewModel());
locator.registerFactory(() => OrdersViewModel());
}

@ -2,11 +2,9 @@ import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/model/authentication/login_request.dart';
import 'package:driverapp/core/viewModels/authentication_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/pages/dashboard/dashboard_screen.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:driverapp/widgets/input/text_field.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
@ -25,16 +23,27 @@ class LoginPage extends StatelessWidget {
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
authenticationViewModel = Provider.of(context);
login() async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
}
}
}
return AnimatedSwitcher(
duration: Duration(microseconds: 350),
child: AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
child: AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
@ -237,7 +246,7 @@ class LoginPage extends StatelessWidget {
SecondaryButton(
label: TranslationBase.of(context).login,
onTap: () {
login(context);
login();
},
disabled: authenticationViewModel.isLoading,
loading: authenticationViewModel.isLoading,
@ -255,17 +264,4 @@ class LoginPage extends StatelessWidget {
);
}
login(BuildContext context) async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
} else {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => DashboardScreen()));
}
}
}
}

@ -6,6 +6,7 @@ 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/pending_orders_page.dart';
import 'package:driverapp/pages/setting/setting.dart';
import 'package:driverapp/uitl/app_toast.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
@ -90,7 +91,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: SafeArea(
child: Column(
children: <Widget>[
CircleAvatar(
InkWell(
child:CircleAvatar(
radius: 25.5,
backgroundColor: Color(0xff30B7B9),
child: CircleAvatar(
@ -99,8 +101,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Image.asset(
'assets/images/driver.png',
fit: BoxFit.contain,
),
),),
),
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
SettingPage(driverName:_authenticationViewModel.user.userName, driverID:_authenticationViewModel.user.userID)));
},
),
],
),
@ -588,7 +597,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
child: Text(
model.orders[index].distanceInKilometers
.toString() +
' K.m\naway',
'\nK.m\naway',
style: TextStyle(
color: Color(0xff42B6AD),
fontWeight: FontWeight.w800,

@ -9,6 +9,7 @@ import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/delivery/customer_brief_card.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:location/location.dart';
import '../../uitl/translations_delegate_base.dart';
import '../../widgets/others/app_scaffold_widget.dart';
@ -23,39 +24,41 @@ class DeliveryConfirmedPage extends StatelessWidget {
return BaseView<OrdersViewModel>(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarColor: Theme.of(context).primaryColor,
arrowColor: Colors.white,
titleColor: Colors.white,
body: SafeArea(
child: Container(
color: Theme.of(context).primaryColor,
child: ListView(
children: <Widget>[
Stack(
appBarColor: Theme.of(context).primaryColor,
arrowColor: Colors.white,
titleColor: Colors.white,
body: SafeArea(
child: Container(
color: Theme.of(context).primaryColor,
child: ListView(
children: <Widget>[
Stack(
children: <Widget>[
Column(
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.7,
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.12,
),
decoration: BoxDecoration(
color: Colors.white10, shape: BoxShape.circle),
child: Column(
children: <Widget>[
Icon(
Icons.check_circle,
color: Colors.white,
size: 75,
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.03,
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.7,
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.12,
),
decoration: BoxDecoration(
color: Colors.white10,
shape: BoxShape.circle),
child: Column(
children: <Widget>[
Icon(
Icons.check_circle,
color: Colors.white,
size: 75,
),
SizedBox(
height:
MediaQuery.of(context).size.width *
0.03,
),
Text(
TranslationBase.of(context).deliveryInfo,
@ -131,34 +134,38 @@ class DeliveryConfirmedPage extends StatelessWidget {
),
Container(
margin: EdgeInsets.all(10),
child: SecondaryButton(
label: TranslationBase.of(context).nextDelivery,
child: SecondaryButton(
label: TranslationBase
.of(context)
.nextDelivery,
loading: model.state == ViewState.BusyLocal,
onTap: () {
getNextOrder(context, model);
},),
),
],
getNextOrder(context, model);},
),
),
],
),
),
),
],
],
),
),
),
Container(
margin: EdgeInsets.only(
Container(
margin: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.6,
),
child: CustomerBriefCard(
itemId: item.orderID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
showDistance: false,
deliveryTime: item.orderCreatedOn),
),
child: CustomerBriefCard(
itemId: item.orderID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
showDistance: false,
deliveryTime: item.orderCreatedOn),
),
],
),
],),
],
),
],
),
),
),
),
@ -166,11 +173,15 @@ class DeliveryConfirmedPage extends StatelessWidget {
}
getNextOrder(BuildContext context, OrdersViewModel model) async {
model.setState(ViewState.BusyLocal);
LocationData loc = await Utils.getLocation();
NextOrderRequestModel nextOrderRequestModel = NextOrderRequestModel(
pageIndex: 0,
pageSize: 0,
latitude: "46.621730",
longitude: "24.797682",
latitude: loc.latitude.toString(),
//"46.621730",
longitude: loc.longitude.toString(),
//"24.797682",
searchKey: "");
await model.nextOrder(nextOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {

File diff suppressed because one or more lines are too long

@ -115,7 +115,7 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
child: Text(
model.orders[index].distanceInKilometers
.toString() +
' K.m\naway',
'\nK.m\naway',
style: TextStyle(
color: Color(0xff42B6AD),
fontWeight: FontWeight.w800,

@ -0,0 +1,163 @@
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class SettingPage extends StatelessWidget {
final String driverName;//_authenticationViewModel.user.userName
final int driverID;
SettingPage({this.driverName, this.driverID});
@override
Widget build(BuildContext context) {
return AppScaffold(
isShowAppBar: true,
appBarColor: Color(0xff30B7B9),
arrowColor: Colors.white,
titleColor: Colors.white,
body: SingleChildScrollView(
child: Column(
children: <Widget>[
Container(
width: double.infinity,
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width * 0.7,
child: CircleAvatar(
radius: 25.5,
backgroundColor: Theme.of(context).primaryColor,
child: CircleAvatar(
backgroundColor: Theme.of(context).primaryColor,
maxRadius: 200.0,
child: Image.asset(
'assets/images/driver.png',
height: MediaQuery.of(context).size.width * 1 ,
width: MediaQuery.of(context).size.width * 1,
fit: BoxFit.contain,
),
),
),
),
SizedBox(height: MediaQuery.of(context).size.width *0.05,),
Container(
child: Text(
driverName,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
),
SizedBox(height: MediaQuery.of(context).size.width *0.05,),
Container(
child: Text(
'ID: ${driverID.toString()}',
style: TextStyle(
fontSize: 20,
color: Colors.white
),
),
),
],
),
),
SizedBox(height: MediaQuery.of(context).size.width *0.1,),
Container(
margin: EdgeInsets.only(left: 35),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
Icons.input,
size: 40,
color: Colors.white,
),
SizedBox(width: MediaQuery.of(context).size.width *0.05,),
Text(
TranslationBase.of(context).logout,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.width *0.05,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
],
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
Icons.settings,
size: 40,
color: Colors.white,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.05,
),
Text(
TranslationBase.of(context).settings,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: 10.0,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
],
),
),
],
),
),
],
),
),
);
}
}

@ -1,5 +1,6 @@
import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart';
import 'package:location/location.dart';
import 'app_shared_preferences.dart';
import 'app_toast.dart';
@ -42,4 +43,10 @@ class Utils {
static hideKeyboard(BuildContext context) {
FocusScope.of(context).unfocus();
}
static getLocation() async {
Location location = new Location();
LocationData currentLocation = await location.getLocation();
return currentLocation;
}
}

@ -26,8 +26,8 @@ class CircleContainer extends StatelessWidget {
color: color,
border: Border.all(
color: borderColor ?? Hexcolor("#707070"), width: borderWidth)),
height: 60,
width: 60,
height: 80,
width: 80,
),
);
}

@ -1,3 +1,4 @@
import 'package:driverapp/widgets/data_display/circle-container.dart';
import 'package:flutter/material.dart';
import '../../uitl/date_uitl.dart';
@ -16,25 +17,27 @@ class CustomerBriefCard extends StatelessWidget {
final double latitude;
final bool showDistance;
CustomerBriefCard(
{this.itemId,
this.time,
this.customerFirstName,
this.customerLastName,
this.mobileNo,
this.direction,
this.totalPayment,
this.deliveryTime,
this.longitude,
this.latitude,
this.showDistance = true,
});
CustomerBriefCard({
this.itemId,
this.time,
this.customerFirstName,
this.customerLastName,
this.mobileNo,
this.direction,
this.totalPayment,
this.deliveryTime,
this.longitude,
this.latitude,
this.showDistance = true,
});
@override
Widget build(BuildContext context) {
return Center(
child: Container(
width: 350,
width: MediaQuery.of(context).orientation == Orientation.landscape
? 580
: 370,
height: 270,
decoration: BoxDecoration(
color: Colors.white,
@ -63,46 +66,45 @@ class CustomerBriefCard extends StatelessWidget {
flex: 3,
child: Text(
'ID: ${itemId}',
style: TextStyle(color: Color(0xFFADACAD)),
style: TextStyle(
color: Color(0xFFADACAD),
fontWeight: FontWeight.w800,
fontSize: 17.5),
),
),
Visibility(
visible: showDistance,
child: Expanded(
child: CircleAvatar(
backgroundColor: Colors.black45,
radius: 28.0,
child: CircleAvatar(
backgroundColor: Colors.white,
maxRadius: 26.1,
child: Padding(
padding: const EdgeInsets.only(left: 3),
child: Text(
'3 K.m \n away',
style: TextStyle(
color: Color(0xff30B7B9),
fontSize: 12.5,
fontWeight: FontWeight.w600),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(8.0),
child: CircleContainer(
borderWidth: 0.9,
child: Text(
'0 K.m\naway',
style: TextStyle(
color: Color(0xff42B6AD),
fontWeight: FontWeight.w800,
fontStyle: FontStyle.normal),
),
),
),
),
],
),
SizedBox(height: MediaQuery.of(context).size.width * 0.02,),
SizedBox(
height: MediaQuery.of(context).size.width * 0.02,
),
Text(
'${customerFirstName} ${customerLastName}',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w900),
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.019,
),
SizedBox(height: MediaQuery.of(context).size.width * 0.019,),
Text(
mobileNo,
style: TextStyle(color: Color(0xFF50BDC5)),
),
SizedBox(
height:MediaQuery.of(context).size.width*0.005,
height: MediaQuery.of(context).size.width * 0.005,
),
// Text(
// 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277',
@ -143,13 +145,13 @@ class CustomerBriefCard extends StatelessWidget {
child: Text(
totalPayment.toString(),
textAlign: TextAlign.end,
style: TextStyle(fontWeight: FontWeight.w600),
style: TextStyle(fontWeight: FontWeight.w400),
),
),
],
),
SizedBox(
height: MediaQuery.of(context).size.width*0.03,
height: MediaQuery.of(context).size.width * 0.03,
),
Row(
children: <Widget>[
@ -164,7 +166,7 @@ class CustomerBriefCard extends StatelessWidget {
child: Text(
'${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(deliveryTime))} ${(DateUtil.convertStringToHours(deliveryTime))}',
textAlign: TextAlign.end,
style: TextStyle(fontWeight: FontWeight.w600)),
style: TextStyle(fontWeight: FontWeight.w400)),
),
],
)

@ -12,25 +12,19 @@ class DeliveryInfoButton extends StatelessWidget {
Widget build(BuildContext context) {
print(btnColor);
return Padding(
padding: EdgeInsets.all(8.0),
padding: MediaQuery.of(context).orientation == Orientation.portrait
? EdgeInsets.all(4.0)
: EdgeInsets.all(7.0),
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery
.of(context)
.size
.width * 0.14,
width: MediaQuery
.of(context)
.size
.width * 0.165, // specific value
child:
InkWell(
child: btnIcon,
height: MediaQuery.of(context).size.width * 0.14,
width: MediaQuery.of(context).size.width * 0.165, // specific value
child: InkWell(
child: btnIcon,
onTap: btnFunction,
),
),
Text(
btnName,
style: TextStyle(
@ -42,4 +36,4 @@ class DeliveryInfoButton extends StatelessWidget {
),
);
}
}
}

@ -67,9 +67,14 @@ dependencies:
# Qr code Scanner
barcode_scan: ^3.0.1
#mape
# map
map_launcher: ^0.12.0
# location
location: ^3.0.2

Loading…
Cancel
Save