123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:get/get.dart';
  5. import 'package:get/get_core/src/get_main.dart';
  6. import '../pages/OrderConfirmation/index.dart';
  7. import '../pages/machinery/map/index.dart';
  8. // class CarItem {
  9. // late String name;
  10. // late num? price;
  11. // late num? distance;
  12. // CarItem({required this.name, this.price, this.distance});
  13. // }
  14. class CarsCard extends StatelessWidget {
  15. // final CarItem item;
  16. // const CarsCard({
  17. // Key? key,
  18. // required this.item,
  19. // }) : super(key: key);
  20. @override
  21. Widget build(BuildContext context) {
  22. return Container(
  23. margin: EdgeInsets.fromLTRB(0, 20, 0, 20),
  24. decoration: BoxDecoration(
  25. color: Color(0xfff2f2f2),
  26. ),
  27. width: 345.w,
  28. // height: 389.h,
  29. child: Column(
  30. children: [
  31. Image.network(
  32. "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",
  33. width: 345.w,
  34. height: 230.h,
  35. fit: BoxFit.cover,
  36. ),
  37. Container(
  38. padding: EdgeInsets.fromLTRB(15, 20, 0, 0),
  39. child: Row(
  40. crossAxisAlignment: CrossAxisAlignment.start,
  41. verticalDirection: VerticalDirection.up,
  42. children: <Widget>[
  43. Container(
  44. child: Text(
  45. '联合收割机GB01235-0B',
  46. style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
  47. ),
  48. ),
  49. ],
  50. ),
  51. ),
  52. Container(
  53. padding: const EdgeInsets.fromLTRB(19, 0, 0, 0),
  54. child: Row(
  55. crossAxisAlignment: CrossAxisAlignment.start,
  56. verticalDirection: VerticalDirection.up,
  57. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  58. children: <Widget>[
  59. Container(
  60. child: RichText(
  61. text: const TextSpan(children: <InlineSpan>[
  62. TextSpan(
  63. text: '8555元/',
  64. style: TextStyle(
  65. color: Color(0xffce3800),
  66. fontSize: 22,
  67. fontWeight: FontWeight.bold)),
  68. TextSpan(
  69. text: '公顷',
  70. style: TextStyle(
  71. color: Color(0xffce3800),
  72. fontSize: 10,
  73. fontWeight: FontWeight.bold)),
  74. ]),
  75. ),
  76. ),
  77. Align(
  78. widthFactor: 1.2,
  79. heightFactor: 1.2,
  80. alignment: Alignment(1.2, -5),
  81. child: Container(
  82. margin: EdgeInsets.only(right: 13),
  83. width: 86.w, //+6
  84. height: 44.h, //+10
  85. child: ElevatedButton(
  86. onPressed: () {
  87. Get.to(OrderConfirmation());
  88. },
  89. child: const Text(
  90. "预约",
  91. style: TextStyle(
  92. fontSize: 19,
  93. color: Colors.white,
  94. fontWeight: FontWeight.bold),
  95. ),
  96. style: ButtonStyle(
  97. backgroundColor:
  98. MaterialStateProperty.all(const Color(0xFFFF703B)),
  99. shape: MaterialStateProperty.all(
  100. const RoundedRectangleBorder(
  101. //这个0像素圆角style如果删掉的话,按钮会变成默认样式,自带圆角
  102. borderRadius:
  103. BorderRadius.all(Radius.circular(0)))),
  104. ),
  105. ),
  106. ),
  107. ),
  108. ],
  109. ),
  110. ),
  111. // 地址信息 进入地图
  112. Container(
  113. padding: EdgeInsets.fromLTRB(19, 20, 0, 10),
  114. child: Row(
  115. children: [
  116. Image.asset(
  117. "images/gpsImgae.png",
  118. width: 11.w,
  119. height: 13.h,
  120. fit: BoxFit.cover,
  121. ),
  122. Container(
  123. padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
  124. width: 300.w,
  125. child: Row(
  126. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  127. children: [
  128. Text(
  129. '距离当前位置2.6公里',
  130. style: TextStyle(
  131. fontSize: 15, fontWeight: FontWeight.bold),
  132. ),
  133. GestureDetector(
  134. child: Text(
  135. '进入地图 >>',
  136. style: TextStyle(
  137. fontSize: 15, fontWeight: FontWeight.bold),
  138. ),
  139. onTap: () {
  140. print('进入地图');
  141. Get.to(MachineryMapPage());
  142. },
  143. )
  144. ],
  145. )),
  146. ],
  147. )),
  148. ],
  149. ),
  150. );
  151. }
  152. }