CarsCard.dart 6.3KB

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