detail.dart 3.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
  11. final list = <ExtendContent>[
  12. ExtendContent.simple(content: img, contentType: "image" ),
  13. ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
  14. ExtendContent.simple(content: img, contentType: "image" ),
  15. ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
  16. ExtendContent.simple(content: img, contentType: "image" ),
  17. ExtendContent.simple(content: "有时,你可能想要创建一个水平滑动(而不是竖直滑动)的列表。 ListView widget 本身就支持水平列表的创建。我们将会使用标准的 ListView 构造方法,通过指定 scrollDirection 的值为水平方向,来覆盖默认的竖直方向。", contentType: "text" ),
  18. ExtendContent.simple(content: img, contentType: "image" ),
  19. ];
  20. return DefLayout(
  21. head: Image.network(img, fit: BoxFit.cover),
  22. children: [
  23. DefLayout.card(
  24. top: DefLayout.headHeight - DefLayout.offset,
  25. padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
  26. child: _content(context, list, handleClick),
  27. )
  28. ]
  29. );
  30. }
  31. Widget _content(BuildContext context, List<ExtendContent> list, VoidCallback? handleClick) {
  32. return Column(
  33. children: [
  34. summary(),
  35. _sectionHead('农机详情'),
  36. ExtendContentList(list: list),
  37. SizedBox(height: 20.w,),
  38. RoundButton(text: "预约", onPressed: handleClick,)
  39. ],
  40. );
  41. }
  42. Widget _sectionHead(String title) {
  43. Widget img = SizedBox(
  44. width: 16.w,
  45. height: 16.w,
  46. child: Image.asset('images/decorate.png'),
  47. );
  48. return Container(
  49. padding: EdgeInsets.fromLTRB(0, 20.w, 0, 20.w),
  50. child: Row(
  51. mainAxisAlignment: MainAxisAlignment.center,
  52. children: [
  53. img,
  54. SizedBox(width: 20.w),
  55. Text(title, style: TextStyle(fontSize: 16.sp, color: const Color(0xFF222222), fontWeight: FontWeight.w500),),
  56. SizedBox(width: 20.w),
  57. img,
  58. ],
  59. ),
  60. );
  61. }