import 'package:flutter/material.dart';

import '../app/constant.dart';

typedef void MyFunction();

class PatientCard extends StatelessWidget {
  const PatientCard({
    super.key,
    required this.name,
    required this.noLab,
    this.note,
    this.onClick,
  });
  final String name;
  final String noLab;
  final String? note;
  final MyFunction? onClick;

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onClick,
      child: Container(
        padding: EdgeInsets.symmetric(
            horizontal: Constant.getActualX(context: context, x: 24),
            vertical: Constant.getActualY(context: context, y: 20)),
        margin: EdgeInsets.symmetric(
            vertical: Constant.getActualY(context: context, y: 4),
            horizontal: Constant.getActualX(context: context, x: 1)),
        // height: Constant.getActualY(context: context, y: 76),
        decoration: BoxDecoration(
            color: Colors.white,
            border: Border.all(color: Colors.grey, width: 0.1),
            boxShadow: [
              BoxShadow(
                color: Colors.grey.shade300,
                offset: const Offset(0.0, 1), //(x,y)
                blurRadius: 2,
              ),
            ],
            borderRadius: BorderRadius.circular(12)),
        child: Column(
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Expanded(
                  child: Text(
                    "Nomor lab",
                    style: Constant.caption1(context: context).copyWith(
                        fontWeight: FontWeight.w400,
                        color: Constant.textPrimary),
                  ),
                ),
                Expanded(
                  child: Text(
                    noLab,
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                    style: Constant.caption1(context: context).copyWith(
                        fontWeight: FontWeight.w400,
                        color: Constant.textPrimary),
                  ),
                )
              ],
            ),
            SizedBox(
              height: Constant.getActualY(context: context, y: 4),
            ),
            Row(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Expanded(
                  child: Text(
                    "Nama",
                    style: Constant.caption1(context: context).copyWith(
                        fontWeight: FontWeight.w400,
                        color: Constant.textPrimary),
                  ),
                ),
                Expanded(
                  child: Text(
                    name,
                    maxLines: 2,
                    overflow: TextOverflow.ellipsis,
                    style: Constant.caption1(context: context).copyWith(
                        fontWeight: FontWeight.w400,
                        color: Constant.textPrimary),
                  ),
                )
              ],
            ),
            if (note != null)
              SizedBox(
                height: Constant.getActualY(context: context, y: 4),
              ),
            if (note != null)
              Row(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Expanded(
                    child: Text(
                      "Catatan FO",
                      style: Constant.caption1(context: context).copyWith(
                          fontWeight: FontWeight.w400,
                          color: Constant.textPrimary),
                    ),
                  ),
                  Expanded(
                    child: Text(
                      note ?? "",
                      maxLines: 2,
                      overflow: TextOverflow.ellipsis,
                      style: Constant.caption1(context: context).copyWith(
                          fontWeight: FontWeight.w400,
                          color: Constant.textPrimary),
                    ),
                  )
                ],
              ),
          ],
        ),
      ),
    );
  }
}
