summary.dart 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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}) {
  7. return Column(
  8. children: [
  9. _title(item: item),
  10. SizedBox(height: 20.w,),
  11. _desc(item: item),
  12. SizedBox(height: 20.w,),
  13. _detail(item: item),
  14. SizedBox(height: 20.w,),
  15. ],
  16. );
  17. }
  18. Widget _title({required CardInfo item}) {
  19. return Row(
  20. children: [
  21. Expanded(
  22. child: Text(item.name.toString(),
  23. style: TextStyle(
  24. color: const Color(0xFF222222),
  25. fontSize: 18.sp,
  26. fontWeight: FontWeight.bold,
  27. )),
  28. flex: 1),
  29. Container(
  30. width: 100.w,
  31. alignment: Alignment.centerRight,
  32. child: LinearGradientText(
  33. colors: const <Color>[
  34. Color(0xFFFA7878),
  35. Color(0xFFB61515),
  36. ],
  37. child: RichText(
  38. text: TextSpan(
  39. children: <InlineSpan>[
  40. TextSpan(
  41. text: ((item.price??0)/100).toString(),
  42. style: TextStyle(
  43. fontSize: 22.sp,
  44. fontWeight: FontWeight.bold,
  45. )),
  46. TextSpan(
  47. text: "元/",
  48. style: TextStyle(
  49. fontSize: 22.sp,
  50. fontWeight: FontWeight.bold,
  51. )),
  52. TextSpan(
  53. text: "公顷",
  54. style: TextStyle(
  55. fontSize: 12.sp,
  56. fontWeight: FontWeight.bold,
  57. )),
  58. ]
  59. ),
  60. ),
  61. ),
  62. )
  63. ],
  64. );
  65. }
  66. Widget _desc({required CardInfo item}) {
  67. return Row(
  68. children: [
  69. Icon(Icons.location_on_outlined, size: 16.sp,),
  70. Expanded(
  71. flex: 1,
  72. child: Text("距离当前位置2.3公里 >>", style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
  73. ),
  74. ],
  75. );
  76. }
  77. Widget _detail({required CardInfo item}) {
  78. return Container(
  79. alignment: Alignment.centerLeft,
  80. child: Text(item.orgName.toString(), style: TextStyle(color: const Color(0xFF222222), fontSize: 15.sp),),
  81. );
  82. }