CarsCard.dart 5.3KB

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