import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
import 'package:mohem_flutter_app/models/my_documents/employee_documents_list_model.dart';
import 'package:sizer/sizer.dart';

class MyDocumentItem extends StatelessWidget {
  EmployeeDocumentsList document;
  final Color color;
  final bool isNotInDetailView;

  MyDocumentItem(this.document, this.color, {Key? key,this.isNotInDetailView = true}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        color: document.eNTITLEDTOAPPLYFLAG != 'Y' ? Colors.grey.shade300 : Colors.white,
        borderRadius: BorderRadius.circular(10),
        boxShadow: [
          BoxShadow(
            color: const Color(0xff000000).withOpacity(.05),
            blurRadius: 26,
            offset: const Offset(0, -3),
          ),
        ],
      ),
      child: ClipRRect(
        borderRadius: BorderRadius.circular(10.0),
        child: Stack(
          children: [
            Positioned(
              top: -35,
              child: Container(
                width: 45,
                height: 45,
                transform: Matrix4.rotationZ(0.8),
                color: color,
              ),
            ),
            Row(
              crossAxisAlignment: CrossAxisAlignment.end,
              mainAxisSize: MainAxisSize.min,
              children: [
                Row(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    SvgPicture.asset('assets/images/document.svg').paddingOnly(top: 6),
                    12.width,
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        document.dOCUMENTTYPENAME!.toText16(),
                        document.dOCUMENTSTATUS!.toText10(color: color),
                      ],
                    ).expanded,
                  ],
                ).expanded,
                if (isNotInDetailView)
                  const Icon(
                    Icons.arrow_forward,
                    size: 20,
                    color: Color(0xff2E303A),
                  )
              ],
            ).paddingOnly(top: 14, bottom: 18, right: 14, left: 24),
          ],
        ),
      ),
    );
  }
}
