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/widget_extensions.dart';
import 'package:hmg_patient_app_new/theme/colors.dart' show AppColors;
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';

class FacilitySelectionItem extends StatelessWidget {
  final String svgPath;
  final String title;
  final String subTitle;

  const FacilitySelectionItem(
      {super.key,
      required this.svgPath,
      required this.subTitle,
      required this.title});

  @override
  Widget build(BuildContext context) {
    AppState appState = getIt.get<AppState>();
    return Container(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
        color: AppColors.whiteColor,
        borderRadius: 20.h,
        hasShadow: false,
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
      Utils.buildSvgWithAssets(
      icon:  svgPath,
        width: 32,
        height: 32,
        fit: BoxFit.contain,
      ),
          SizedBox(height: 16,),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              info,
              Transform.flip(
                flipX: appState.isArabic(),
                child: Utils.buildSvgWithAssets(
                  icon: AppAssets.forward_arrow_icon_small,
                  iconColor: AppColors.blackColor,
                  width: 18,
                  height: 13,
                  fit: BoxFit.contain,
                ),
              ),
            ],
          )
        ],
      ).paddingAll(16.h),
    );
  }
  

 Widget get info => Column(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Align(
            alignment: Alignment.centerLeft,
            child: Text(
              title,
              style: TextStyle(
                fontSize: 16.h,
                fontWeight: FontWeight.w600,
                color: AppColors.blackColor,
              ),
            ),
          ),
          Align(
            alignment: Alignment.centerLeft,
            child: Text(
              subTitle,
              style: TextStyle(
                fontSize: 12.h,
                fontWeight: FontWeight.w600,
                color: AppColors.greyTextColor,
              ),
            ),
          ),
        ],
      );
}
