import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:get/get.dart'; import 'package:intl/intl.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../../Helper/Constants/Colorconstants.dart'; import '../../../Helper/utility.dart'; import '../../../Model/Response/Orders/Getorderresponse.dart'; class OrderDetailsView extends StatelessWidget { final OrderDetails data; OrderDetailsView({Key? key, required this.data}) : super(key: key); final GlobalKey _scaffoldKey = GlobalKey(); @override Widget build(BuildContext context) { return Scaffold( key: _scaffoldKey, backgroundColor: Colors.grey[100], appBar:AppBar( leading: InkWell( onTap: () { Get.back(); }, child: Icon( Icons.reply, color: ColorConstants.secondaryColor, size: 28, )), title:const Text("Order Details"), backgroundColor: ColorConstants.primaryColor, ), body: SizedBox( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child:Padding( padding: const EdgeInsets.all(6.0), child: SizedBox( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child: Column( children: [ const SizedBox( height: 10, ), Container( color: ColorConstants.secondaryColor, margin: const EdgeInsets.only(left: 5,right: 5), // surfaceTintColor:ColorConstants.secondaryColor , // elevation: 0, // surfaceTintColor:ColorConstants.secondaryColor , // elevation: 0, child: SizedBox( height: 95, child: Stack( children: [ Row( children: [ Container( decoration: BoxDecoration( color: ColorConstants.primaryColor1, // borderRadius: const BorderRadius.only(topLeft: Radius.circular(10),bottomLeft: Radius.circular(10)), shape: BoxShape.rectangle), width: 75, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Container( padding: const EdgeInsets.symmetric( horizontal: 15, vertical: 10), decoration: BoxDecoration( color: Colors.white70, borderRadius: BorderRadius.circular(5), shape: BoxShape.rectangle), child: Column( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( // '10', DateFormat("dd").format(DateFormat("yyyy-MM-dd", "en_US").parse(data.orderdate!)), style: TextStyle( fontSize: 14, color: Colors.grey[700],fontWeight: FontWeight.w600), ), const SizedBox(height: 4,), Text( // 'Apr', DateFormat("MMM").format(DateFormat("yyyy-MM-dd", "en_US").parse(data.orderdate!)), style: TextStyle( fontSize: 14, height: 1, color: Colors.grey[700], fontWeight: FontWeight.w600), ), ], ), ), const SizedBox( height: 6, ), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center, children: [ Text( // '11.31AM', DateFormat("hh.mm a").format(DateFormat("yyyy-MM-ddTHH:mm:ss", "en_US").parse(data.orderdate!)), style: TextStyle( fontSize: 11, color: Colors.grey[700], fontWeight: FontWeight.w600), ), ], ), ], ), ), const SizedBox( width: 12, ), Expanded( flex: 3, child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Row( children: [ const Icon( Icons.person, color: Colors.black45, size: 18, ), const SizedBox( width: 5, ), Text( '${data.tenantname}', style: TextStyle( fontSize: 15, color: Colors.grey[500], fontWeight: FontWeight.w600), ), ], ), Row( crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.start, children: [ const Icon( Icons.receipt, color: Colors.black45, size: 18, ), const SizedBox( width: 5, ), Text( '${data.orderid}', style: const TextStyle( fontSize: 13, color: Colors.black54, fontWeight: FontWeight.w600), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.start, children: [ const Icon( Icons.phone, color: Colors.black45, size: 18, ), const SizedBox( width: 5, ), InkWell( onTap: () { launch( ('tel://${data.tenantcontactno}')); }, child: Text( '${data.tenantcontactno}', style: const TextStyle( fontSize: 13, color: Colors.black54, fontWeight: FontWeight.w600), ), ), ], ), ], )), ], ), // Positioned( // top: 5, // right: 5, // child: Icon( // Icons.payment_outlined, // color:data.paymentstatus==0?Colors.green:Colors.red, // ), // ), ], ), ), ), const SizedBox( height: 10, ), Card( color: Colors.red[100]!.withAlpha(100), // Utility.getLightColors(data!.locationname!) // .withAlpha(100), elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(13), ), child: SizedBox( height: 150, width: MediaQuery.of(context).size.width, child: Row( children: [ Expanded( flex: 2, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [ const SizedBox( height: 15, ), Container( height: 40, width: 40, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.white, ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ FaIcon( FontAwesomeIcons.mapMarkerAlt, size: 22, color: Colors.green, ), ], ), ), const Spacer(), // Text( // 'Pickup', // style: TextStyle( // color: Colors.black87, // fontWeight: FontWeight.bold, // fontSize: 15), // ), Container( height: 40, width: 40, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.white, ), child:InkWell( onTap: () { Utility.openMap( double.parse(data .pickuplat!), double.parse(data .pickuplong!) ); }, child: Icon( Icons .assistant_direction_rounded, size: 30, color: ColorConstants .primaryColor, ), ), ), const SizedBox( height: 10, ), ], ), ), Expanded( flex: 14, child: Padding( padding: const EdgeInsets.all(5.0), child: Card( elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), child: Row( children: [ Expanded( flex: 9, child: Padding( padding: const EdgeInsets.only( left: 10), child: Column( children: [ Expanded( flex: 3, child: Row( children: [ Expanded( flex: 7, child: Column( crossAxisAlignment: CrossAxisAlignment .start, mainAxisAlignment: MainAxisAlignment .start, children: [ // const SizedBox( // height: 15, // ), Expanded( flex: 3, child: Row( children: [ const Icon( Icons .business, size: 14, color: Colors.black38, ), const SizedBox( width: 4, ), Text( // "Nearle Demo", data.pickupcustomer??'', style: const TextStyle( color: Colors.black87, fontSize: 15), ) ], ), ), // const SizedBox( // height: 10, // ), Expanded( flex: 3, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ const Icon( Icons .location_on_rounded, size: 14, color: Colors.black38, ), const SizedBox( width: 4, ), Flexible( child: Text( // "R.S. Puram, Coimbatore, Tamil Nadu, India", " ${data.pickupaddress!}", style: const TextStyle( color: Colors.black87, overflow: TextOverflow.ellipsis, fontSize: 13, ), maxLines: 2, ), ), const SizedBox( width: 5, ), ], ), ), // const SizedBox( // height: 15, // ), Expanded( flex: 2, child: InkWell( onTap: (){ Utility.openPhoneCallApp( data.pickupcontactno! ); }, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ const Icon( Icons .phone, size: 14, color: Colors.black38, ), const SizedBox( width: 4, ), Text( // "+918838304677", data.pickupcontactno??'', style: const TextStyle( color: Colors.black87, fontSize: 13), ) ], ), ), ), // SizedBox(height: 10,) ], ), ), ], )), // Expanded( // flex: 2, // child: Row( // children: [ // Icon( // Icons // .confirmation_num, // size: 18, // color: Colors // .black38, // ), // SizedBox( // width: 4, // ), // Text( // "ORD-6464654", // // data!.orderid!, // style: TextStyle( // color: Colors // .black87, // fontWeight: // FontWeight // .bold, // fontSize: 15), // ), // ], // ), // ), ], ), ), ), // Expanded( // flex: 3, // child: Column( // mainAxisAlignment: // MainAxisAlignment.start, // crossAxisAlignment: // CrossAxisAlignment.center, // children: [ // const SizedBox( // height: 35, // ), // // Container( // // height: 50, // // child: Image.asset(AssetConstants.PickupIcon,)), // // Spacer(), // Container( // height: 45, // width: 45, // decoration: const BoxDecoration( // shape: BoxShape.circle, // color: Colors.white, // ), // child:InkWell( // onTap: () { // Utility.openMap( // double.parse(data // .pickuplat!), // double.parse(data // .pickuplong!) // ); // }, // child: Icon( // Icons // .assistant_direction_rounded, // size: 35, // color: ColorConstants // .primaryColor, // ), // ), // // ), // // // const SizedBox( // height: 15, // ), // ], // ), // ) ], ), ), ), ), ], ), ), ), Card( color: Colors.red[100]!.withAlpha(100), // Utility.getLightColors(data!.locationname!) // .withAlpha(100), elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(13), ), child: SizedBox( height: 150, width: MediaQuery.of(context).size.width, child: Row( children: [ Expanded( flex: 2, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [ const SizedBox( height: 15, ), Container( height: 40, width: 40, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.white, ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ FaIcon( FontAwesomeIcons.mapMarkerAlt, size: 22, color: Colors.red, ), ], ), ), const Spacer(), // Text( // 'Drop', // style: TextStyle( // color: Colors.black87, // fontWeight: FontWeight.bold, // fontSize: 17), // ), Container( height: 40, width: 40, decoration: const BoxDecoration( shape: BoxShape.circle, color: Colors.white, ), child:InkWell( onTap: () { Utility.openMap( // 11.0051058,76.9509126 double.parse( data.deliverylat!), double.parse(data .deliverylong!) ); }, child: Icon( Icons .assistant_direction_rounded, size: 30, color: ColorConstants .primaryColor, ), ), ), const SizedBox( height: 10, ), ], ), ), Expanded( flex: 14, child: Padding( padding: const EdgeInsets.all(5.0), child: Card( elevation: 0, shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(10), ), child: Row( children: [ Expanded( flex: 9, child: Padding( padding: const EdgeInsets.only( left: 10), child: Column( children: [ Expanded( flex: 5, child: Row( children: [ Expanded( flex: 7, child: Column( crossAxisAlignment: CrossAxisAlignment .start, mainAxisAlignment: MainAxisAlignment .start, children: [ // const SizedBox( // height: 15, // ), Expanded( flex: 3, child: Row( children: [ const Icon( Icons .person, size: 14, color: Colors.black38, ), const SizedBox( width: 4, ), Expanded( child: Text( "${data.deliverycustomer}", style: const TextStyle( color: Colors.black87, fontSize: 15), maxLines: 1, overflow: TextOverflow.ellipsis, ), ), const SizedBox(width: 5,) ], ), ), // const SizedBox( // height: 10, // ), Expanded( flex: 3, child: Row( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ const Icon( Icons .location_on_rounded, size: 14, color: Colors.black38, ), const SizedBox( width: 4, ), Flexible( child: Text( "${data.deliveryaddress}", style: const TextStyle( color: Colors.black87, overflow: TextOverflow.ellipsis, fontSize: 13), maxLines: 2, ), ), const SizedBox( width: 5, ), ], ), ), // const SizedBox( // height: // 15, // ), Expanded( flex: 2, child: InkWell( onTap: (){ Utility.openPhoneCallApp( data.deliverycontactno!); }, child: Row( children: [ const Icon( Icons .phone, size: 16, color: Colors.black38, ), const SizedBox( width: 4, ), Text( "${data.deliverycontactno}", style: const TextStyle( color: Colors.black87, fontSize: 13), ) ], ), ), ) ], ), ), ], )), // Expanded( // flex: 2, // child: Container()), ], ), ), ), // Expanded( // flex: 3, // child: Column( // mainAxisAlignment: // MainAxisAlignment.start, // crossAxisAlignment: // CrossAxisAlignment.center, // children: [ // const SizedBox( // height: 35, // ), // // Container( // // height: 50, // // child: Image.asset(AssetConstants.DropIcon,)), // Container( // height: 45, // width: 45, // decoration: const BoxDecoration( // shape: BoxShape.circle, // color: Colors.white, // ), // child:InkWell( // onTap: () { // Utility.openMap( // // 11.0051058,76.9509126 // double.parse( // data.deliverylat!), // double.parse(data // .deliverylong!) // ); // }, // child: Icon( // Icons // .assistant_direction_rounded, // size: 35, // color: ColorConstants // .primaryColor, // ), // ), // // ), // // const SizedBox( // height: 15, // ), // ], // ), // ) ], ), ), ), ), ], ), ), ), // Expanded( // flex: 2, // child: Card( // color:Colors.red[100]!.withAlpha(100), // // Utility.getLightColors( // // data!.locationname!) // // .withAlpha(100), // elevation: 0, // shape: RoundedRectangleBorder( // borderRadius: BorderRadius.circular(13), // ), // child: SizedBox( // height: 170, // width: MediaQuery.of(context).size.width, // child: Row( // children: [ // Expanded( // flex: 2, // child: Column( // mainAxisAlignment: // MainAxisAlignment.start, // crossAxisAlignment: // CrossAxisAlignment.end, // children: [ // const SizedBox( // height: 15, // ), // Container( // height: 49, // width: 45, // decoration: const BoxDecoration( // shape: BoxShape.circle, // color: Colors.white, // ), // child: const Column( // mainAxisAlignment: // MainAxisAlignment // .center, // children: [ // // Padding(padding: EdgeInsets.all(3)), // Text( // "₹", // style: TextStyle( // fontWeight: // FontWeight.bold, // color: Colors.black, // fontSize: 34), // ), // ], // ), // ), // ], // ), // ), // Expanded( // flex: 12, // child: Padding( // padding: // const EdgeInsets.all(5.0), // child: Card( // elevation: 0, // shape: RoundedRectangleBorder( // borderRadius: // BorderRadius.circular(10), // ), // child: Row( // children: [ // Expanded( // flex: 9, // child: Padding( // padding: // const EdgeInsets // .only(left: 10), // child: Column( // children: [ // Expanded( // flex: 3, // child: Row( // children: [ // Expanded( // flex: 7, // child: // Column( // crossAxisAlignment: // CrossAxisAlignment.start, // mainAxisAlignment: // MainAxisAlignment.start, // children: [ // const SizedBox( // height: // 13, // ), // Row( // children: [ // const Icon( // Icons.location_on_rounded, // size: 14, // color: Colors.black38, // ), // const SizedBox( // width: 4, // ), // Flexible( // child: Text( // "${controller.distanceKm??0} kms", // style: const TextStyle(color: Colors.black87, overflow: TextOverflow.ellipsis, fontSize: 15), // ), // ) // ], // ), // const SizedBox( // height: // 5, // ), // Row( // children: [ // // const Text( // "₹", // style: TextStyle( // // fontWeight: FontWeight.bold, // color: Colors.black, // fontSize: 18), // ), // const SizedBox( // width: 5, // ), // Text( // "", // // "${data.orderamount}", // // style: const TextStyle(color: Colors.black87, fontSize: 15), // ) // ], // ) // ], // ), // ), // ], // )), // ], // ), // ), // ), // ], // ), // ), // ), // ), // ], // ), // ), // ), // ), ], ), ), ), ), ); } }