detail.dart 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import 'package:farmer_client/pages/machinery/widgets/DefLayout.dart';
  2. import 'package:farmer_client/pages/machinery/widgets/RoundButton.dart';
  3. import 'package:flutter/widgets.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import 'package:farmer_client/widgets/ExtendContentList.dart';
  7. import 'package:farmer_client/models/entities/ExtendContent.dart';
  8. import '../../widgets/summary.dart';
  9. Widget page({ required BuildContext context, VoidCallback? handleClick}) {
  10. final _offset = 20.w;
  11. final width = MediaQuery.of(context).size.width;
  12. final _bannerHeight = 250.w;
  13. final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
  14. final list = <ExtendContent>[
  15. ExtendContent.simple(content: img, contentType: "image" ),
  16. ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
  17. ExtendContent.simple(content: img, contentType: "image" ),
  18. ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
  19. ExtendContent.simple(content: img, contentType: "image" ),
  20. ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
  21. ExtendContent.simple(content: img, contentType: "image" ),
  22. ];
  23. return DefLayout(
  24. head: Image.network(img, fit: BoxFit.cover),
  25. children: [
  26. DefLayout.card(
  27. top: DefLayout.headHeight - DefLayout.offset,
  28. child: _content(context, list, handleClick),
  29. )
  30. ]
  31. );
  32. }
  33. Widget _content(BuildContext context, List<ExtendContent> list, VoidCallback? handleClick) {
  34. final _border = 20.w;
  35. return Container(
  36. padding: EdgeInsets.only(top: 40.w, left: 15.w, right: 15.w, bottom: 20.w),
  37. decoration: BoxDecoration(
  38. color: Colors.white,
  39. borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
  40. ),
  41. child: Column(
  42. children: [
  43. summary(),
  44. _sectionHead('农机详情'),
  45. ExtendContentList(list: list),
  46. SizedBox(height: 20.w,),
  47. RoundButton(text: "预约", onPressed: handleClick,)
  48. ],
  49. ),
  50. );
  51. }
  52. Widget _sectionHead(String title) {
  53. Widget img = SizedBox(
  54. width: 16.w,
  55. height: 16.w,
  56. child: Image.asset('images/decorate.png'),
  57. );
  58. return Container(
  59. padding: EdgeInsets.fromLTRB(0, 20.w, 0, 20.w),
  60. child: Row(
  61. mainAxisAlignment: MainAxisAlignment.center,
  62. children: [
  63. img,
  64. SizedBox(width: 20.w),
  65. Text(title, style: TextStyle(fontSize: 16.sp, color: const Color(0xFF222222), fontWeight: FontWeight.w500),),
  66. SizedBox(width: 20.w),
  67. img,
  68. ],
  69. ),
  70. );
  71. }