You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
169 lines
7.9 KiB
Dart
169 lines
7.9 KiB
Dart
import 'package:driverapp/core/viewModels/orders_view_model.dart';
|
|
import 'package:driverapp/pages/delivery/information_page.dart';
|
|
import 'package:driverapp/widgets/others/rounded_container.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../base/base_view.dart';
|
|
|
|
class OrdersListScreen extends StatefulWidget {
|
|
@override
|
|
_OrdersListScreenState createState() => _OrdersListScreenState();
|
|
}
|
|
|
|
class _OrdersListScreenState extends State<OrdersListScreen> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<OrdersViewModel>(
|
|
onModelReady: (model) => model.getPendingOrders(),
|
|
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
|
|
Scaffold(
|
|
appBar: AppBar(
|
|
centerTitle: true,
|
|
backgroundColor: Color(0xffF4F9FA),
|
|
title: Text(
|
|
'Your Delivery Que',
|
|
),
|
|
),
|
|
body: Column(
|
|
children: <Widget>[
|
|
Center(
|
|
child: Text(
|
|
'Nearest',
|
|
style: TextStyle(
|
|
color: Color(0xff30B7B9),
|
|
fontSize: 18.0,
|
|
fontWeight: FontWeight.w400),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: ListView.builder(
|
|
itemCount: model.orders == null ? 0 : model.orders.length,
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return InkWell(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context, MaterialPageRoute(
|
|
builder: (context) =>
|
|
InformationPage(model.orders[index])));
|
|
},
|
|
child: 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: <Widget>[
|
|
Expanded(
|
|
flex: 1,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment
|
|
.center,
|
|
children: <Widget>[
|
|
Padding(
|
|
padding: EdgeInsets.only(left: 22.0),
|
|
child: Image.asset(
|
|
'assets/images/location.png',
|
|
height:
|
|
MediaQuery
|
|
.of(context)
|
|
.size
|
|
.height *
|
|
0.101,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (model.orders.length != 0)
|
|
Expanded(
|
|
flex: 3,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment
|
|
.start,
|
|
children: <Widget>[
|
|
Padding(
|
|
padding: EdgeInsets.only(top: 10.0),
|
|
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: <Widget>[
|
|
Expanded(
|
|
child: CircleAvatar(
|
|
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),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|