|
|
|
|
@ -5,10 +5,13 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
|
|
|
|
|
|
class OrderInfoCard extends StatelessWidget {
|
|
|
|
|
const OrderInfoCard({Key key, this.order, this.onTap}) : super(key: key);
|
|
|
|
|
const OrderInfoCard(
|
|
|
|
|
{Key key, this.order, this.onTap, this.showStatus = false})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
|
|
final dynamic order;
|
|
|
|
|
final Function onTap;
|
|
|
|
|
final bool showStatus;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -18,77 +21,120 @@ class OrderInfoCard extends StatelessWidget {
|
|
|
|
|
showShadow: true,
|
|
|
|
|
raduis: 25.0,
|
|
|
|
|
height: MediaQuery.of(context).orientation == Orientation.portrait
|
|
|
|
|
? MediaQuery.of(context).size.height * 0.120
|
|
|
|
|
: MediaQuery.of(context).size.height * 0.209,
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 1,
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(left: 15.0, top: 14.0),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/location.png',
|
|
|
|
|
height: MediaQuery.of(context).orientation ==
|
|
|
|
|
Orientation.portrait
|
|
|
|
|
? MediaQuery.of(context).size.height * 0.06
|
|
|
|
|
: MediaQuery.of(context).size.height * 0.11,
|
|
|
|
|
width: MediaQuery.of(context).orientation ==
|
|
|
|
|
Orientation.portrait
|
|
|
|
|
? MediaQuery.of(context).size.width * 0.05
|
|
|
|
|
: MediaQuery.of(context).size.width * 0.09,
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
flex: 5,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
? MediaQuery.of(context).size.height *
|
|
|
|
|
(showStatus ? 0.190 : 0.140)
|
|
|
|
|
: MediaQuery.of(context).size.height *
|
|
|
|
|
(showStatus ? 0.299 : 0.269),
|
|
|
|
|
child: FractionallySizedBox(
|
|
|
|
|
widthFactor: 0.98,
|
|
|
|
|
child: ListView(
|
|
|
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 20.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
Utils.formatStringToPascalCase(
|
|
|
|
|
order.firstName + ' ' + order.lastName),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 18.0,
|
|
|
|
|
color: Hexcolor("#343333"),
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
order.mobileNumber,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Color(0xff30B7B9),
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
EdgeInsets.only(left: 15.0, top: 14.0),
|
|
|
|
|
child: Image.asset(
|
|
|
|
|
'assets/images/location.png',
|
|
|
|
|
height: MediaQuery.of(context)
|
|
|
|
|
.orientation ==
|
|
|
|
|
Orientation.portrait
|
|
|
|
|
? MediaQuery.of(context).size.height *
|
|
|
|
|
0.06
|
|
|
|
|
: MediaQuery.of(context).size.height *
|
|
|
|
|
0.11,
|
|
|
|
|
width: MediaQuery.of(context).orientation ==
|
|
|
|
|
Orientation.portrait
|
|
|
|
|
? MediaQuery.of(context).size.width *
|
|
|
|
|
0.05
|
|
|
|
|
: MediaQuery.of(context).size.width *
|
|
|
|
|
0.09,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 13,
|
|
|
|
|
),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.only(top: 20.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
Utils.formatStringToPascalCase(
|
|
|
|
|
order.firstName +
|
|
|
|
|
' ' +
|
|
|
|
|
order.lastName),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 18.0,
|
|
|
|
|
color: Hexcolor("#343333"),
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
order.mobileNumber,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Color(0xff30B7B9),
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
order.orderID.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
letterSpacing: 8.0),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Text(
|
|
|
|
|
order.orderID.toString(),
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
|
letterSpacing: 8.0),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: DistanceInKilometers(
|
|
|
|
|
distanceInKilometers: order.distanceInKilometers,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.all(8.0),
|
|
|
|
|
child: DistanceInKilometers(
|
|
|
|
|
distanceInKilometers: order.distanceInKilometers,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
if (showStatus)
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
margin: EdgeInsets.only(bottom: 8, left: 20),
|
|
|
|
|
color: order.statusID == 2 ? Colors.green : Colors.red,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(5.0),
|
|
|
|
|
child: Text(
|
|
|
|
|
order.description,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
fontSize: 15.0,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|