import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';

class LabRadCard extends StatelessWidget {
  LabRadCard({super.key, required this.icon, required this.labelText, required this.labOrderTests});

  String icon;
  String labelText;
  List<String> labOrderTests = [];

  @override
  Widget build(BuildContext context) {
    AppState appState = getIt.get<AppState>();
    return Container(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: false),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Row(
            children: [
              Utils.buildSvgWithAssets(
                icon: icon,
                width: 40.h,
                height: 40.h,
                fit: BoxFit.contain,
              ).toShimmer2(isShow: false, radius: 12.h),
              SizedBox(width: 8.h),
              labelText.toText14(isBold: true).toShimmer2(isShow: false, radius: 6.h, height: 32.h),
            ],
          ),
          SizedBox(height: 16.h),
          ListView.separated(
            scrollDirection: Axis.vertical,
            padding: EdgeInsets.zero,
            physics: NeverScrollableScrollPhysics(),
            shrinkWrap: true,
            itemBuilder: (cxt, index) {
              return labOrderTests[index].toText12(isBold: true, maxLine: 1).toShimmer2(isShow: false, radius: 6.h, height: 24.h, width: 120.h);
            },
            separatorBuilder: (cxt, index) => SizedBox(height: 8.h),
            itemCount: labOrderTests.length,
          ),
          SizedBox(height: 16.h),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              SizedBox.shrink(),
              Transform.flip(
                flipX: appState.isArabic() ? true : false,
                child: Utils.buildSvgWithAssets(icon: AppAssets.forward_arrow_icon, width: 15.h, height: 15.h, fit: BoxFit.contain, iconColor: AppColors.textColor)
                    .toShimmer2(isShow: false, radius: 12.h),
              ),
            ],
          )
        ],
      ).paddingAll(16.h),
    );
  }
}
