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.6 KiB
Dart
169 lines
7.6 KiB
Dart
import 'package:driverapp/uitl/utils.dart';
|
|
import 'package:driverapp/widgets/delivery/distance_in_kilometers.dart';
|
|
import 'package:driverapp/widgets/others/rounded_container.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:hexcolor/hexcolor.dart';
|
|
|
|
class OrderInfoCard extends StatelessWidget {
|
|
const OrderInfoCard(
|
|
{Key key, this.order, this.onTap, this.showStatus = false, this.isActiveToDeliver = false})
|
|
: super(key: key);
|
|
|
|
final dynamic order;
|
|
final Function onTap;
|
|
final bool showStatus;
|
|
final bool isActiveToDeliver;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
child:
|
|
Container(
|
|
child: RoundedContainer(
|
|
showShadow: true,
|
|
raduis: 25.0,
|
|
height: MediaQuery.of(context).orientation == Orientation.portrait
|
|
? MediaQuery.of(context).size.height * (showStatus ? 0.22 : 0.160)
|
|
: MediaQuery.of(context).size.height *
|
|
(showStatus ? 0.359 : 0.269),
|
|
child: FractionallySizedBox(
|
|
widthFactor: 0.98,
|
|
child: Stack(
|
|
children:[
|
|
if(isActiveToDeliver)
|
|
Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: Align(
|
|
alignment: Alignment.bottomRight,
|
|
child:Image.asset(
|
|
'assets/images/check.png',
|
|
height: 20,
|
|
width: 20,
|
|
),
|
|
),
|
|
),
|
|
Column(
|
|
// mainAxisAlignment: MainAxisAlignment.start,
|
|
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: <Widget>[
|
|
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),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
Padding(
|
|
padding: EdgeInsets.all(8.0),
|
|
child: DistanceInKilometers(
|
|
distanceInKilometers: order.distanceInKilometers,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
if (showStatus)
|
|
Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(bottom: 12, left: 10),
|
|
child: RoundedContainer(
|
|
margin: 4,
|
|
showShadow: false,
|
|
backgroundColor:
|
|
order.statusID == 2 ? Colors.green : Colors.red,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: 5, horizontal: 15),
|
|
child: Text(
|
|
order.description,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
fontSize: 15.0,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
]),
|
|
),
|
|
),
|
|
),
|
|
onTap: () {
|
|
onTap();
|
|
},
|
|
);
|
|
}
|
|
}
|