DefLayout.dart 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. class DefLayout extends StatelessWidget {
  4. Widget head;
  5. List<Widget> children;
  6. DefLayout({Key? key, required this.head, required this.children})
  7. : super(key: key);
  8. static double headHeight = 214.w;
  9. static double offset = 20.w;
  10. static Widget card(
  11. {required double top,
  12. required Widget child,
  13. double? height,
  14. EdgeInsetsGeometry? padding}) {
  15. final _border = 20.w;
  16. return Container(
  17. margin: EdgeInsets.only(top: top),
  18. padding: padding,
  19. height: height,
  20. clipBehavior: Clip.hardEdge,
  21. decoration: BoxDecoration(
  22. color: Colors.white,
  23. borderRadius: BorderRadius.vertical(top: Radius.circular(_border))),
  24. child: child,
  25. );
  26. }
  27. @override
  28. Widget build(BuildContext context) {
  29. final width = MediaQuery.of(context).size.width;
  30. return Stack(
  31. children: [
  32. SizedBox(
  33. width: width,
  34. height: headHeight,
  35. child: head,
  36. ),
  37. ...children,
  38. ],
  39. );
  40. }
  41. }