import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:get/get_core/src/get_main.dart'; import '../pages/OrderConfirmation/index.dart'; import '../pages/machinery/map/index.dart'; // class CarItem { // late String name; // late num? price; // late num? distance; // CarItem({required this.name, this.price, this.distance}); // } class CarsCard extends StatelessWidget { // final CarItem item; // const CarsCard({ // Key? key, // required this.item, // }) : super(key: key); @override Widget build(BuildContext context) { return Container( margin: EdgeInsets.fromLTRB(0, 20, 0, 20), decoration: BoxDecoration( color: Color(0xfff2f2f2), ), width: 345.w, // height: 389.h, child: Column( children: [ Image.network( "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg", width: 345.w, height: 230.h, fit: BoxFit.cover, ), Container( padding: EdgeInsets.fromLTRB(15, 20, 0, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, verticalDirection: VerticalDirection.up, children: [ Container( child: Text( '联合收割机GB01235-0B', style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), ), ), ], ), ), Container( padding: const EdgeInsets.fromLTRB(19, 0, 0, 0), child: Row( crossAxisAlignment: CrossAxisAlignment.start, verticalDirection: VerticalDirection.up, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Container( child: RichText( text: const TextSpan(children: [ TextSpan( text: '8555元/', style: TextStyle( color: Color(0xffce3800), fontSize: 22, fontWeight: FontWeight.bold)), TextSpan( text: '公顷', style: TextStyle( color: Color(0xffce3800), fontSize: 10, fontWeight: FontWeight.bold)), ]), ), ), Align( widthFactor: 1.2, heightFactor: 1.2, alignment: Alignment(1.2, -5), child: Container( margin: EdgeInsets.only(right: 13), width: 86.w, //+6 height: 44.h, //+10 child: ElevatedButton( onPressed: () { Get.to(OrderConfirmation()); print('点我去预约'); }, child: const Text( "预约", style: TextStyle( fontSize: 19, color: Colors.white, fontWeight: FontWeight.bold), ), style: ButtonStyle( backgroundColor: MaterialStateProperty.all(const Color(0xFFFF703B)), shape: MaterialStateProperty.all( const RoundedRectangleBorder( //这个0像素圆角style如果删掉的话,按钮会变成默认样式,自带圆角 borderRadius: BorderRadius.all(Radius.circular(0)))), ), ), ), ), ], ), ), // 地址信息 进入地图 Container( padding: EdgeInsets.fromLTRB(19, 20, 0, 10), child: Row( children: [ Image.asset( "images/gpsImgae.png", width: 11.w, height: 13.h, fit: BoxFit.cover, ), Container( padding: EdgeInsets.fromLTRB(5, 0, 0, 0), width: 300.w, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( '距离当前位置2.6公里', style: TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), GestureDetector( child: Text( '进入地图 >>', style: TextStyle( fontSize: 15, fontWeight: FontWeight.bold), ), onTap: () { print('进入地图'); Get.to(MachineryMapPage()); }, ) ], )), ], )), ], ), ); } }