CarsCard.dart 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. print('点我去预约');
  89. },
  90. child: const Text(
  91. "预约",
  92. style: TextStyle(
  93. fontSize: 19,
  94. color: Colors.white,
  95. fontWeight: FontWeight.bold),
  96. ),
  97. style: ButtonStyle(
  98. backgroundColor:
  99. MaterialStateProperty.all(const Color(0xFFFF703B)),
  100. shape: MaterialStateProperty.all(
  101. const RoundedRectangleBorder(
  102. //这个0像素圆角style如果删掉的话,按钮会变成默认样式,自带圆角
  103. borderRadius:
  104. BorderRadius.all(Radius.circular(0)))),
  105. ),
  106. ),
  107. ),
  108. ),
  109. ],
  110. ),
  111. ),
  112. // 地址信息 进入地图
  113. Container(
  114. padding: EdgeInsets.fromLTRB(19, 20, 0, 10),
  115. child: Row(
  116. children: [
  117. Image.asset(
  118. "images/gpsImgae.png",
  119. width: 11.w,
  120. height: 13.h,
  121. fit: BoxFit.cover,
  122. ),
  123. Container(
  124. padding: EdgeInsets.fromLTRB(5, 0, 0, 0),
  125. width: 300.w,
  126. child: Row(
  127. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  128. children: [
  129. Text(
  130. '距离当前位置2.6公里',
  131. style: TextStyle(
  132. fontSize: 15, fontWeight: FontWeight.bold),
  133. ),
  134. GestureDetector(
  135. child: Text(
  136. '进入地图 >>',
  137. style: TextStyle(
  138. fontSize: 15, fontWeight: FontWeight.bold),
  139. ),
  140. onTap: () {
  141. print('进入地图');
  142. Get.to(MachineryMapPage());
  143. },
  144. )
  145. ],
  146. )),
  147. ],
  148. )),
  149. ],
  150. ),
  151. );
  152. }
  153. }