CarsCard.dart 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. // class CarItem {
  8. // late String name;
  9. // late num? price;
  10. // late num? distance;
  11. // CarItem({required this.name, this.price, this.distance});
  12. // }
  13. class CarsCard extends StatelessWidget {
  14. // final CarItem item;
  15. // const CarsCard({
  16. // Key? key,
  17. // required this.item,
  18. // }) : super(key: key);
  19. @override
  20. Widget build(BuildContext context) {
  21. return Container(
  22. margin: EdgeInsets.fromLTRB(0, 20, 0, 20),
  23. decoration: BoxDecoration(
  24. color: Color(0xfff2f2f2),
  25. ),
  26. width: 345.w,
  27. // height: 389.h,
  28. child: Column(
  29. children: [
  30. Image.network(
  31. "http://yz-shigongli.oss-accelerate.aliyuncs.com/2022-03/1648094119154-7b280bbf63105a8e90299e2d79c8c6ee.jpeg",
  32. width: 345.w,
  33. height: 230.h,
  34. fit: BoxFit.cover,
  35. ),
  36. Container(
  37. padding: EdgeInsets.fromLTRB(15, 20, 0, 0),
  38. child: Row(
  39. crossAxisAlignment: CrossAxisAlignment.start,
  40. verticalDirection: VerticalDirection.up,
  41. children: <Widget>[
  42. Container(
  43. child: Text(
  44. '联合收割机GB01235-0B',
  45. style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
  46. ),
  47. ),
  48. ],
  49. ),
  50. ),
  51. Container(
  52. padding: const EdgeInsets.fromLTRB(19, 0, 0, 0),
  53. child: Row(
  54. crossAxisAlignment: CrossAxisAlignment.start,
  55. verticalDirection: VerticalDirection.up,
  56. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  57. children: <Widget>[
  58. Container(
  59. child: RichText(
  60. text: const TextSpan(children: <InlineSpan>[
  61. TextSpan(
  62. text: '8555元/',
  63. style: TextStyle(
  64. color: Color(0xffce3800),
  65. fontSize: 22,
  66. fontWeight: FontWeight.bold)),
  67. TextSpan(
  68. text: '公顷',
  69. style: TextStyle(
  70. color: Color(0xffce3800),
  71. fontSize: 10,
  72. fontWeight: FontWeight.bold)),
  73. ]),
  74. ),
  75. ),
  76. Align(
  77. widthFactor: 1.2,
  78. heightFactor: 1.2,
  79. alignment: Alignment(1.2, -5),
  80. child: Container(
  81. margin: EdgeInsets.only(right: 13),
  82. width: 86.w, //+6
  83. height: 44.h, //+10
  84. child: ElevatedButton(
  85. onPressed: () {
  86. Get.to(OrderConfirmation());
  87. print('点我去预约');
  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. },
  142. )
  143. ],
  144. )),
  145. ],
  146. )),
  147. ],
  148. ),
  149. );
  150. }
  151. }