DefLayout.dart 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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}): super(key: key);
  7. static double headHeight = 214.w;
  8. static double offset = 20.w;
  9. static Widget card({required double top, required Widget child, double? height, EdgeInsetsGeometry? padding}) {
  10. final _border = 20.w;
  11. return Container(
  12. margin: EdgeInsets.only(top: top),
  13. padding: padding,
  14. height: height,
  15. clipBehavior: Clip.hardEdge,
  16. decoration: BoxDecoration(
  17. color: Colors.white,
  18. borderRadius: BorderRadius.vertical(top: Radius.circular(_border))
  19. ),
  20. child: child,
  21. );
  22. }
  23. @override
  24. Widget build(BuildContext context) {
  25. final width = MediaQuery.of(context).size.width;
  26. return Stack(
  27. children: [
  28. SizedBox(
  29. width: width,
  30. height: headHeight,
  31. child: head,
  32. ),
  33. ...children,
  34. ],
  35. );
  36. }
  37. }