Cell.dart 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/widgets.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. class Cell extends StatelessWidget {
  5. const Cell({
  6. Key? key,
  7. this.header,
  8. required this.child,
  9. this.footer,
  10. this.margin,
  11. }) : super(key: key);
  12. final Widget? header;
  13. final Widget child;
  14. final Widget? footer;
  15. final EdgeInsetsGeometry? margin;
  16. @override
  17. Widget build(BuildContext context) {
  18. return Container(
  19. margin: margin,
  20. padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 0.0),
  21. decoration: const BoxDecoration(
  22. border: Border(
  23. bottom: BorderSide(width: 1.0, color: Color(0x1F000000)),
  24. )),
  25. child: Row(
  26. children: [
  27. if (null != header)
  28. SizedBox(
  29. width: 53.w,
  30. child: Container(
  31. decoration: const BoxDecoration(
  32. border: Border(
  33. right: BorderSide(width: 1, color: Color(0xFF333333)))),
  34. child: header,
  35. ),
  36. ),
  37. Expanded(
  38. child: child,
  39. ),
  40. if (null != footer)
  41. ConstrainedBox(
  42. constraints: BoxConstraints(),
  43. child: footer,
  44. )
  45. ],
  46. ),
  47. );
  48. }
  49. }