import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class Cell extends StatelessWidget {
  const Cell({
    Key? key,
    this.header,
    required this.child,
    this.footer,
    this.margin,
  }) : super(key: key);

  final Widget? header;
  final Widget child;
  final Widget? footer;
  final EdgeInsetsGeometry? margin;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: margin,
      padding: EdgeInsets.symmetric(vertical: 10.h, horizontal: 0.0),
      decoration: const BoxDecoration(
          border: Border(
        bottom: BorderSide(width: 1.0, color: Color(0x1F000000)),
      )),
      child: Row(
        children: [
          if (null != header)
            SizedBox(
              width: 53.w,
              child: Container(
                decoration: const BoxDecoration(
                    border: Border(
                        right: BorderSide(width: 1, color: Color(0xFF333333)))),
                child: header,
              ),
            ),
          Expanded(
            child: child,
          ),
          if (null != footer)
            ConstrainedBox(
              constraints: BoxConstraints(maxWidth: 100.w),
              child: footer,
            )
        ],
      ),
    );
  }
}