summary.dart 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. import 'dart:ui' as ui;
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:farmer_client/widgets/LinearGradientText.dart';
  5. import '../../../models/entities/CardInfo.dart';
  6. Widget summary({required CardInfo item, required String km}) {
  7. return Column(
  8. children: [
  9. _title(item: item),
  10. SizedBox(
  11. height: 20.w,
  12. ),
  13. _desc(item: item, km: km),
  14. SizedBox(
  15. height: 20.w,
  16. ),
  17. _detail(item: item),
  18. SizedBox(
  19. height: 20.w,
  20. ),
  21. ],
  22. );
  23. }
  24. Widget _title({required CardInfo item}) {
  25. return Row(
  26. children: [
  27. Expanded(
  28. child: Text(item.name.toString(),
  29. style: TextStyle(
  30. color: const Color(0xFF222222),
  31. fontSize: 18.sp,
  32. fontWeight: FontWeight.bold,
  33. )),
  34. flex: 1),
  35. Container(
  36. width: 100.w,
  37. alignment: Alignment.centerRight,
  38. child: LinearGradientText(
  39. colors: const <Color>[
  40. Color(0xFFFA7878),
  41. Color(0xFFB61515),
  42. ],
  43. child: RichText(
  44. text: TextSpan(children: <InlineSpan>[
  45. TextSpan(
  46. text: ((item.price ?? 0) / 100).toString(),
  47. style: TextStyle(
  48. fontSize: 22.sp,
  49. fontWeight: FontWeight.bold,
  50. )),
  51. TextSpan(
  52. text: "元/",
  53. style: TextStyle(
  54. fontSize: 22.sp,
  55. fontWeight: FontWeight.bold,
  56. )),
  57. TextSpan(
  58. text: "亩",
  59. style: TextStyle(
  60. fontSize: 12.sp,
  61. fontWeight: FontWeight.bold,
  62. )),
  63. ]),
  64. ),
  65. ),
  66. )
  67. ],
  68. );
  69. }
  70. Widget _desc({required CardInfo item, required String km}) {
  71. return Row(
  72. children: [
  73. Icon(
  74. Icons.location_on_outlined,
  75. size: 16.sp,
  76. ),
  77. Expanded(
  78. flex: 1,
  79. child: Text(
  80. "距离当前位置$km >>",
  81. style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),
  82. ),
  83. ),
  84. ],
  85. );
  86. }
  87. Widget _detail({required CardInfo item}) {
  88. return Container(
  89. alignment: Alignment.centerLeft,
  90. child: Text(
  91. item.orgName.toString(),
  92. style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),
  93. ),
  94. );
  95. }