detail.dart 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import 'package:flutter/widgets.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import '../../widgets/summary.dart';
  5. Widget page({ required BuildContext context, required Size appbarSize, required void Function() handleClick}) {
  6. final _offset = 20.w;
  7. final width = MediaQuery.of(context).size.width;
  8. final height = MediaQuery.of(context).size.height
  9. - appbarSize.height
  10. - MediaQuery.of(context).padding.top;
  11. final _bannerHeight = 250.w;
  12. final img = 'https://yz-websit.oss-cn-hangzhou.aliyuncs.com/xlk/index-icon19.jpg';
  13. return Stack(
  14. alignment: Alignment.topCenter,
  15. children: [
  16. // 第一个组件用来撑满全屏
  17. SizedBox(
  18. width: width,
  19. height: height,
  20. ),
  21. Positioned(
  22. left: 0,
  23. top: 0,
  24. child: SizedBox(
  25. height: _bannerHeight,
  26. child: _banner(img),
  27. ),
  28. ),
  29. Positioned(
  30. left: 0,
  31. top: _bannerHeight - _offset,
  32. child: _content(context),
  33. ),
  34. ],
  35. );
  36. }
  37. Widget _banner(String imgUrl) {
  38. return Image.network(imgUrl);
  39. }
  40. Widget _content(BuildContext context) {
  41. final _border = 20.w;
  42. return Container(
  43. width: MediaQuery.of(context).size.width,
  44. padding: EdgeInsets.only(top: 45.w, left: 15.w, right: 15.w, bottom: 20.w),
  45. decoration: BoxDecoration(
  46. color: Colors.white,
  47. borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
  48. ),
  49. child: Column(
  50. children: [
  51. summary(),
  52. ],
  53. ),
  54. );
  55. }