Dashboaed page
parent
3aec62dceb
commit
5dc2756275
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 6.9 KiB |
File diff suppressed because one or more lines are too long
Binary file not shown.
@ -0,0 +1,51 @@
|
||||
import 'dart:ffi';
|
||||
|
||||
class PendingOrders {
|
||||
int driverID;
|
||||
String searchKey;
|
||||
int pageSize;
|
||||
int pageIndex;
|
||||
String tokenID;
|
||||
String userID;
|
||||
String mobileNo;
|
||||
String firstName;
|
||||
String lastName;
|
||||
String mobileNumber;
|
||||
|
||||
PendingOrders(
|
||||
{this.driverID,
|
||||
this.searchKey,
|
||||
this.pageSize,
|
||||
this.pageIndex,
|
||||
this.tokenID,
|
||||
this.userID,
|
||||
this.mobileNo,
|
||||
this.firstName,
|
||||
this.lastName,
|
||||
this.mobileNumber});
|
||||
|
||||
PendingOrders.fromJson(Map<String, dynamic> json) {
|
||||
driverID = json['DriverID'];
|
||||
searchKey = json['SearchKey'];
|
||||
pageSize = json['PageSize'];
|
||||
pageIndex = json['PageIndex'];
|
||||
tokenID = json['TokenID'];
|
||||
userID = json['UserID'];
|
||||
mobileNo = json['MobileNo'];
|
||||
firstName = json['FirstName'];
|
||||
lastName = json['LastName'];
|
||||
mobileNumber = json['MobileNumber'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['DriverID'] = this.driverID;
|
||||
data['SearchKey'] = this.searchKey;
|
||||
data['PageSize'] = this.pageSize;
|
||||
data['PageIndex'] = this.pageIndex;
|
||||
data['TokenID'] = this.tokenID;
|
||||
data['UserID'] = this.userID;
|
||||
data['MobileNo'] = this.mobileNo;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
import 'package:driverapp/config/config.dart';
|
||||
import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart';
|
||||
import 'package:driverapp/core/service/base_service.dart';
|
||||
|
||||
class PendingOrdersService extends BaseService {
|
||||
List<PendingOrders> _orders = List();
|
||||
List<PendingOrders> get orders => _orders;
|
||||
|
||||
PendingOrders _requestGetPendingOrders = PendingOrders(
|
||||
driverID: 1111,
|
||||
searchKey: "",
|
||||
pageSize: 0,
|
||||
pageIndex: 0,
|
||||
tokenID: "@dm!n",
|
||||
userID: "1111",
|
||||
mobileNo: "0541710575",
|
||||
);
|
||||
|
||||
Future getPendingOrders() async {
|
||||
await baseAppClient.post(GET_ALL_ORDERS,
|
||||
onSuccess: (dynamic response, int statusCode) {
|
||||
_orders.clear();
|
||||
response['PatientER_Delivery_GetAllOrderList'].forEach((order) {
|
||||
_orders.add(PendingOrders.fromJson(order));
|
||||
});
|
||||
}, onFailure: (String error, int statusCode) {
|
||||
hasError = true;
|
||||
super.error = error;
|
||||
}, body: _requestGetPendingOrders.toJson());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
import 'package:driverapp/core/enum/viewstate.dart';
|
||||
import 'package:driverapp/core/service/pending_orders_service.dart';
|
||||
import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart';
|
||||
import '../../locator.dart';
|
||||
import 'base_view_model.dart';
|
||||
|
||||
class PendingOrdersViewModel extends BaseViewModel {
|
||||
PendingOrdersService _pendingOrdersService = locator<PendingOrdersService>();
|
||||
|
||||
List<PendingOrders> get orders => _pendingOrdersService.orders;
|
||||
|
||||
Future getPendingOrders() async {
|
||||
setState(ViewState.Busy);
|
||||
await _pendingOrdersService.getPendingOrders();
|
||||
if (_pendingOrdersService.hasError) {
|
||||
error = _pendingOrdersService.error;
|
||||
setState(ViewState.Error);
|
||||
} else
|
||||
setState(ViewState.Idle);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,395 @@
|
||||
import 'package:driverapp/config/size_config.dart';
|
||||
import 'package:driverapp/core/viewModels/pending_orders_view_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../base/base_view.dart';
|
||||
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';
|
||||
|
||||
class DashboardScreen extends StatefulWidget {
|
||||
@override
|
||||
_DashboardScreenState createState() => _DashboardScreenState();
|
||||
}
|
||||
|
||||
class _DashboardScreenState extends State<DashboardScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PendingOrdersViewModel>(
|
||||
onModelReady: (model) => model.getPendingOrders(),
|
||||
builder:
|
||||
(BuildContext context, PendingOrdersViewModel model, Widget child) =>
|
||||
Scaffold(
|
||||
backgroundColor: Color(0xffF4F9FA),
|
||||
body: Column(
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Have a great day ,',
|
||||
style: TextStyle(fontSize: 12.5),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 4.5),
|
||||
child: Text(
|
||||
'Driver Name',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w400, fontSize: 25.0),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(16.0),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
CircleAvatar(
|
||||
radius: 25.5,
|
||||
backgroundColor: Color(0xff30B7B9),
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Color(0xff30B7B9),
|
||||
maxRadius: 26.0,
|
||||
child: Image.asset(
|
||||
'assets/images/driver.png',
|
||||
fit: BoxFit.contain,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.43,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xff17AFB8), Color(0xff49C1BC)]),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'You Have',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 10.0),
|
||||
),
|
||||
Text(
|
||||
'5',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 25.0),
|
||||
),
|
||||
Text(
|
||||
'Undelivered \n Packages',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 10.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(4.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 9.5),
|
||||
child: Image.asset(
|
||||
'assets/images/closed_box.png',
|
||||
height:
|
||||
MediaQuery.of(context).size.height *
|
||||
0.09,
|
||||
width:
|
||||
MediaQuery.of(context).size.width *
|
||||
0.20,
|
||||
//fit: BoxFit.cover,
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height * 0.15,
|
||||
width: MediaQuery.of(context).size.width * 0.43,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xff17AFB8), Color(0xff49C1BC)]),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'You Have',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 10.0),
|
||||
),
|
||||
Text(
|
||||
'25',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 25.0),
|
||||
),
|
||||
Text(
|
||||
'unWanted\n Packge',
|
||||
style: TextStyle(
|
||||
color: Colors.white, fontSize: 10.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(right: 9.5),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/open_box.png',
|
||||
height: MediaQuery.of(context).size.height *
|
||||
0.11,
|
||||
width: MediaQuery.of(context).size.width *
|
||||
0.24,
|
||||
scale: 0.9,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 12.0),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
child: Container(
|
||||
height: 140,
|
||||
width: 350,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(12.0),
|
||||
gradient: LinearGradient(colors: [
|
||||
Color(0xff48C0BC),
|
||||
Color(0xff17AFB8)
|
||||
])),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
'assets/images/qr_code.png',
|
||||
width:
|
||||
MediaQuery.of(context).size.width * 0.25,
|
||||
height:
|
||||
MediaQuery.of(context).size.height * 0.14,
|
||||
fit: BoxFit.fitHeight,
|
||||
)
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'SCAN',
|
||||
style: TextStyle(
|
||||
fontSize: 35.0, color: Colors.white),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 6.0),
|
||||
child: Text(
|
||||
'To add package to que ',
|
||||
style: TextStyle(
|
||||
fontSize: 12.0,
|
||||
color: Colors.white,
|
||||
letterSpacing: 0.5,
|
||||
wordSpacing: 5.5,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'Nearest Drop-Offs',
|
||||
style: TextStyle(
|
||||
fontSize: 21.0,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
InkWell(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'See All',
|
||||
style: TextStyle(fontSize: 14.5),
|
||||
),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 15.0,
|
||||
),
|
||||
],
|
||||
),
|
||||
onTap: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => OrdersListScreen()),
|
||||
)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: <Widget>[
|
||||
ListView.builder(
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.vertical,
|
||||
itemCount: //model.orders == null ? 0 : model.orders.length,
|
||||
2,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: RoundedContainer(
|
||||
height: SizeConfig.heightMultiplier * 10.5,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: <Widget>[
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 22.0),
|
||||
child: Image.asset(
|
||||
'assets/images/location.png'),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (model.orders.length != 0)
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
model.orders[index].firstName +
|
||||
' ' +
|
||||
model.orders[index].lastName,
|
||||
style: TextStyle(fontSize: 20.0),
|
||||
),
|
||||
Text(
|
||||
model.orders[index].mobileNumber,
|
||||
style: TextStyle(
|
||||
color: Color(0xff30B7B9),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 15.0),
|
||||
),
|
||||
Text(
|
||||
'Olaya ST, Behind kfc next to king-\ndom tower 2nd floor n.o 247',
|
||||
style: TextStyle(color: Colors.black45),
|
||||
)
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
CircleAvatar(
|
||||
backgroundColor: Colors.black45,
|
||||
radius: 30.0,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
maxRadius: 28.9,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
'3 K.m \n away',
|
||||
style: TextStyle(
|
||||
color: Color(0xff30B7B9),
|
||||
fontSize: 14.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
})
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:driverapp/config/size_config.dart';
|
||||
import 'package:driverapp/core/viewModels/pending_orders_view_model.dart';
|
||||
import '../base/base_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:driverapp/widgets/others/rounded_container.dart';
|
||||
|
||||
class OrdersListScreen extends StatefulWidget {
|
||||
@override
|
||||
_OrdersListScreenState createState() => _OrdersListScreenState();
|
||||
}
|
||||
|
||||
class _OrdersListScreenState extends State<OrdersListScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BaseView<PendingOrdersViewModel>(
|
||||
onModelReady: (model) => model.getPendingOrders(),
|
||||
builder:
|
||||
(BuildContext context, PendingOrdersViewModel model, Widget child) =>
|
||||
Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
backgroundColor: Color(0xffF4F9FA),
|
||||
title: Text(
|
||||
'Your Delivery Que',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class RoundedContainer extends StatefulWidget {
|
||||
final double width;
|
||||
final double height;
|
||||
final double raduis;
|
||||
final Color backgroundColor;
|
||||
final double margin;
|
||||
final double elevation;
|
||||
final bool showBorder;
|
||||
final Color borderColor;
|
||||
final bool customCornerRaduis;
|
||||
final double topLeft;
|
||||
final double bottomRight;
|
||||
final double topRight;
|
||||
final double bottomLeft;
|
||||
final Widget child;
|
||||
final double borderWidth;
|
||||
|
||||
RoundedContainer(
|
||||
{@required this.child,
|
||||
this.width,
|
||||
this.height,
|
||||
this.raduis = 10,
|
||||
this.backgroundColor = Colors.white,
|
||||
this.margin = 10,
|
||||
this.elevation = 1,
|
||||
this.showBorder = false,
|
||||
this.borderColor = Colors.red,
|
||||
this.customCornerRaduis = false,
|
||||
this.topLeft = 0,
|
||||
this.topRight = 0,
|
||||
this.bottomRight = 0,
|
||||
this.bottomLeft = 0,
|
||||
this.borderWidth = 1});
|
||||
|
||||
@override
|
||||
_RoundedContainerState createState() => _RoundedContainerState();
|
||||
}
|
||||
|
||||
class _RoundedContainerState extends State<RoundedContainer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
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,
|
||||
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))
|
||||
: BorderRadius.circular(widget.raduis),
|
||||
),
|
||||
color: widget.backgroundColor,
|
||||
child: widget.child,
|
||||
));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue