Merge branch 'undelivered_packages' into 'master'

Undelivered packages

See merge request Cloud_Solution/driver-app!116
barcode_scanner
Elham 5 years ago
commit cc3173d269

@ -8,19 +8,19 @@ class AuthenticatedUser {
bool active;
String createdOn;
int createdBy;
Null editedOn;
Null editedBy;
dynamic editedOn;
dynamic editedBy;
String mobileNumber;
int realRoleID;
AuthenticatedUser(
{this.iD,
this.userID,
this.password,
this.userName,
this.roleID,
this.name,
this.active,
this.userID,
this.password,
this.userName,
this.roleID,
this.name,
this.active,
this.createdOn,
this.createdBy,
this.editedOn,

@ -22,7 +22,8 @@ class OrdersService extends BaseService {
List<PendingOrdersRes> get nextOrdersList => _nextOrdersList;
bool isOrderInserted;
bool isOrderStatusUpdated;
bool isGetPendingOrdersServices = false;
bool isGetDeliveredOrdersServices = false;
DeliverdOrderModel _requestGetDeliveredOrders = DeliverdOrderModel(
searchKey: "",
pageSize: 0,
@ -33,7 +34,9 @@ class OrdersService extends BaseService {
Future getPendingOrders() async {
LocationData loc = await Utils.getLocation();
if (user != null) {
isGetPendingOrdersServices = true;
}
if (loc != null) {
PendingOrders _requestGetPendingOrders = PendingOrders(
searchKey: "",
@ -127,6 +130,9 @@ class OrdersService extends BaseService {
latitude: loc.latitude.toString(),
longitude: loc.longitude.toString(),
);
if (user != null) {
isGetDeliveredOrdersServices = true;
}
if (loc != null) {
hasError = false;
try {

@ -20,17 +20,22 @@ class OrdersViewModel extends BaseViewModel {
List<PendingOrdersRes> get nextOrdersList => _ordersService.nextOrdersList;
bool isBottomSheetAppear = false;
bool get isGetPendingOrdersServices =>
_ordersService.isGetPendingOrdersServices;
bool get isGetDeliveredOrdersServices =>
_ordersService.isGetDeliveredOrdersServices;
Future getPendingOrders() async {
setState(ViewState.Busy);
await _ordersService.getPendingOrders();
if (_ordersService.hasError) {
error = _ordersService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
}
Future getDeliverdOrders() async {
Future getDeliveredOrders() async {
setState(ViewState.Busy);
await _ordersService.getDeliveredList();
if (_ordersService.hasError) {

@ -19,21 +19,21 @@ class LoginPage extends StatelessWidget {
ProjectViewModel projectViewModel;
AuthenticationViewModel authenticationViewModel;
login() async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
}
}
}
@override
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(
@ -44,59 +44,59 @@ class LoginPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: 40,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.logo,
size: 70,
color: Theme.of(context).primaryColor,
),
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: <Widget>[
Text(
"Driver",
style: TextStyle(
fontSize: 50, fontWeight: FontWeight.bold),
),
Text(
"Delivery",
style: TextStyle(fontSize: 36, letterSpacing: 1),
),
Text(
"APP",
style: TextStyle(
fontSize: 33,
letterSpacing: 33,
fontWeight: FontWeight.w400),
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: 40,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.logo,
size: 70,
color: Theme.of(context).primaryColor,
),
],
),
SizedBox(
height: 30,
),
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: <Widget>[
Text(
"Driver",
style: TextStyle(
fontSize: 50, fontWeight: FontWeight.bold),
),
Text(
"Delivery",
style: TextStyle(fontSize: 36, letterSpacing: 1),
),
Text(
"APP",
style: TextStyle(
fontSize: 33,
letterSpacing: 33,
fontWeight: FontWeight.w400),
),
],
),
SizedBox(
height: 30,
),
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
@ -143,47 +143,48 @@ class LoginPage extends StatelessWidget {
// : Colors.transparent),
// ],
// ),
SizedBox(
height: 10,
),
Form(
key: loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterCredentialsMsg,
style: TextStyle(
fontSize: 13, color: Colors.grey),
),
SizedBox(
height: 10,
),
Form(
key: loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterCredentialsMsg,
style: TextStyle(
fontSize: 13, color: Colors.grey),
),
SizedBox(
height: 10,
)
],
),
),
SizedBox(
height: 10,
)
],
),
SizedBox(
height: 10,
),
Container(
child: TextFields(
hintText: TranslationBase.of(context).enterId,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
.pleaseEnterYourID;
}
return null;
},
),
SizedBox(
height: 10,
),
Container(
child: TextFields(
hintText: TranslationBase.of(context).enterId,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
.pleaseEnterYourID;
}
return null;
},
onSaved: (value) {
loginRequest.userID = int.parse(value.trim());
},
@ -196,7 +197,7 @@ class LoginPage extends StatelessWidget {
child: TextFields(
borderRadiusValue: 6,
hintText:
TranslationBase.of(context).enterPassword,
TranslationBase.of(context).enterPassword,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
@ -228,15 +229,15 @@ class LoginPage extends StatelessWidget {
],
),
),
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.all(10),

@ -52,9 +52,18 @@ class _DashboardScreenState extends State<DashboardScreen> {
Widget build(BuildContext context) {
int orderId;
return BaseView<OrdersViewModel>(
onModelReady: (model) => model.getPendingOrders(),
onModelReady: (model) async {
if (!model.isGetPendingOrdersServices) {
await model.getPendingOrders();
}
if (!model.isGetDeliveredOrdersServices) {
await model.getDeliveredOrders();
}
},
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
AppScaffold(
baseViewModel: model,
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).orientation == Orientation.landscape
@ -149,93 +158,105 @@ class _DashboardScreenState extends State<DashboardScreen> {
borderRadius: BorderRadius.circular(15.0),
gradient: LINEAR_GRADIENT,
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.all(2.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
TranslationBase.of(context).youHave,
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig.textMultiplier *
2.2
: SizeConfig.textMultiplier *
1.3,
),
),
Text(
'5',
style: TextStyle(
child: InkWell(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
OrdersListScreen())),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.all(2.0),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
TranslationBase.of(context)
.youHave,
style: TextStyle(
color: Colors.white,
fontSize:
SizeConfig.textMultiplier *
3.0),
),
Text(
TranslationBase.of(context)
.undeliveredPackages,
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig.textMultiplier *
2.2
: SizeConfig.textMultiplier *
1.3,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig
.textMultiplier *
2.2
: SizeConfig
.textMultiplier *
1.3,
),
),
Text(
model.orders.length.toString(),
style: TextStyle(
color: Colors.white,
fontSize: SizeConfig
.textMultiplier *
3.0),
),
)
],
Text(
TranslationBase.of(context)
.undeliveredPackages,
style: TextStyle(
color: Colors.white,
fontSize: MediaQuery.of(context)
.orientation ==
Orientation.landscape
? SizeConfig
.textMultiplier *
2.2
: SizeConfig
.textMultiplier *
1.3,
),
)
],
),
),
),
),
Padding(
padding: EdgeInsets.only(right: 9.5),
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: Colors.white10,
shape: BoxShape.circle),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/closed_box.png',
height: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.height *
0.09
: MediaQuery.of(context)
.size
.height *
0.20,
width: MediaQuery.of(context)
.size
.width *
0.20,
scale: 0.9,
fit: BoxFit.contain,
),
],
Padding(
padding: EdgeInsets.only(right: 9.5),
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
color: Colors.white10,
shape: BoxShape.circle),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/closed_box.png',
height: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context)
.size
.height *
0.09
: MediaQuery.of(context)
.size
.height *
0.20,
width: MediaQuery.of(context)
.size
.width *
0.20,
scale: 0.9,
fit: BoxFit.contain,
),
],
),
),
),
),
],
],
),
),
),
)
@ -291,7 +312,8 @@ class _DashboardScreenState extends State<DashboardScreen> {
),
),
Text(
'3',
model.deliverdOrders.length
.toString(),
style: TextStyle(
color: Colors.white,
fontSize: SizeConfig
@ -511,7 +533,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
scrollDirection: Axis.vertical,
itemCount: model.orders == null
? 0
: model.orders.length < 3 ? model.orders.length : 3,
: model.orders.length < 3
? model.orders.length
: 3,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 0.2),

@ -218,34 +218,35 @@ class InformationPage extends StatelessWidget {
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: () {},
),
//TODO: return it back when it needed
// 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,

@ -17,7 +17,7 @@ class _DeliverdOrdersPageState extends State<DeliverdOrdersPage> {
@override
Widget build(BuildContext context) {
return BaseView<OrdersViewModel>(
onModelReady: (model) => model.getDeliverdOrders(),
// onModelReady: (model) => model.getDeliveredOrders(),
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: true,

@ -1,21 +1,33 @@
import 'dart:async';
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/viewModels/orders_view_model.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';
import '../locator.dart';
class SplashScreenPage extends StatefulWidget {
@override
_SplashScreenPageState createState() => _SplashScreenPageState();
}
class _SplashScreenPageState extends State<SplashScreenPage> {
OrdersViewModel _ordersViewModel = locator<OrdersViewModel>();
// AuthenticationService _authenticationService =
// locator<AuthenticationService>();
startTime() async {
var _duration = new Duration(seconds: 5);
return new Timer(_duration, navigationPage);
// if (_authenticationService.isLogin) {
await _ordersViewModel.getPendingOrders();
await _ordersViewModel.getDeliveredOrders();
// }
navigationPage();
// var _duration = new Duration(seconds: 5);
// return new Timer(_duration, navigationPage);
}
@override
@ -24,6 +36,8 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
startTime();
}
//
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
@ -54,7 +68,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 200
: 50,
),
@ -65,7 +79,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
child: Icon(
DriverApp.logo,
size: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 120
: 70,
color: Colors.white,
@ -85,7 +99,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 20
: 15,
),
@ -95,7 +109,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
"Driver",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 70
: 35,
fontWeight: FontWeight.bold,
@ -105,7 +119,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
"Delivery",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 50
: 25,
letterSpacing: 1,
@ -114,15 +128,19 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
Text(
"APP",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
fontSize: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 53
: 21,
letterSpacing:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 53
: 27,
MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 53
: 27,
color: Colors.white,
fontWeight: FontWeight.w400),
),
@ -130,7 +148,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 100
: 50,
)
@ -162,7 +180,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
Orientation.portrait
? 10
: 5,
)

@ -25,7 +25,7 @@ class NetworkBaseView extends StatelessWidget {
return child;
break;
case ViewState.Busy:
return Expanded(child: AppCircularProgressIndicator());
return AppCircularProgressIndicator();
break;
case ViewState.Error:
return Center(

Loading…
Cancel
Save