import 'package:farmer_client/utils/processStatus.dart'; import 'package:farmer_client/widgets/Bold.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import '../models/entities/OrderInfoModel.dart'; import 'package:intl/intl.dart'; import 'LinearGradientText.dart'; class TextCell extends StatelessWidget { String title; String? value; TextCell({Key? key, required this.title, this.value}) : super(key: key); @override Widget build(BuildContext context) { return RichText( text: TextSpan(children: [ TextSpan( text: title, style: TextStyle( color: const Color(0xff666666), fontSize: 16.sp, fontWeight: FontWeight.bold)), TextSpan( text: value, style: TextStyle( color: const Color(0xff222222), fontSize: 16.sp, fontWeight: FontWeight.bold)), ]), ); } } class OrderListCard extends StatelessWidget { final OrderInfoModel item; late ProcessSign processSign; OrderListCard({Key? key, required this.item}) : super(key: key) { processSign = getProcessSign(getProcessStatus(item)); } @override Widget build(BuildContext context) { return Container( width: 375.w, margin: EdgeInsets.only(bottom: 20.h), padding: EdgeInsets.symmetric(vertical: 30.h, horizontal: 15.w), decoration: const BoxDecoration(color: Colors.white, boxShadow: [ BoxShadow( color: Colors.black12, offset: Offset(0.0, 15.0), //阴影xy轴偏移量 blurRadius: 15.0, //阴影模糊程度 spreadRadius: 1.0 //阴影扩散程度 ) ]), child: Row( children: [ Container( margin: EdgeInsets.only(right: 15.w), width: 17.w, height: 320.h, child: const Image( image: AssetImage('images/ordersLeft.png'), ), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 313.w, margin: EdgeInsets.only(bottom: 20.h), padding: EdgeInsets.only(bottom: 20.h), decoration: const BoxDecoration( border: Border( bottom: BorderSide( width: 0.5, color: Color(0x20000000), ), ), ), child: GestureDetector( child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ TextCell(title: '订单编号:', value: item.orderNo), Bold( text: "详情 >>", fontSize: 16.sp, color: const Color(0xff222222), ), ], ), onTap: () { Get.toNamed('/orderPageInfo', arguments: { 'orderId': item.orderId, 'title': processSign.label, 'styleColor': processSign.color }); }, ), ), Padding( padding: EdgeInsets.only(bottom: 30.h), child: TextCell(title: '农机名称:', value: item.machineryName), ), Padding( padding: EdgeInsets.only(bottom: 30.h), child: TextCell(title: '作业面积:', value: item.amount.toString()), ), Padding( padding: EdgeInsets.only(bottom: 30.h), child: TextCell( title: '需求时间:', value: DateFormat("yyyy-MM-dd").format( DateTime.parse(item.appointmentDate.toString()))), ), TextCell( title: '下单时间:', value: DateFormat("yyyy-MM-dd") .format(DateTime.parse(item.createDate.toString())), ), Container( margin: EdgeInsets.only(top: 22.h), padding: EdgeInsets.only(top: 30.h), decoration: const BoxDecoration( border: Border( top: BorderSide( width: 0.5, color: Color(0x20000000), ), ), ), width: 313.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ RichText( text: TextSpan( children: [ TextSpan( text: '订单状态:', style: TextStyle( color: const Color(0xff666666), fontSize: 16.sp, fontWeight: FontWeight.bold), ), TextSpan( text: processSign.label, style: TextStyle( color: processSign.color, fontSize: 16.sp, fontWeight: FontWeight.bold), ), ], ), ), Row( children: [ Text( '费用:', style: TextStyle( color: const Color(0xff666666), fontSize: 16.sp, fontWeight: FontWeight.bold), ), LinearGradientText( colors: const [ Color(0xFFFA7878), Color(0xFFB61515), ], child: RichText( text: TextSpan( children: [ TextSpan( text: ((item.charges ?? 0) / 100).toString(), style: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.bold, ), ), TextSpan( text: "元", style: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.bold, ), ), ], ), ), ), ], ), ], ), ), ], ), ], ), ); } }