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 HealthTrackerMenuCard extends StatelessWidget {
  final String label;
  final Color textColor;
  final Color backgroundColor;
  final String svgIcon;
  final double? iconSize;
  final Color? iconColor;
  final Color iconBgColor;

  const HealthTrackerMenuCard({
    super.key,
    required this.label,
    required this.textColor,
    required this.backgroundColor,
    required this.svgIcon,
    required this.iconBgColor,
    this.iconSize,
    this.iconColor,
  });

  @override
  Widget build(BuildContext context) {
    final iconS = iconSize ?? 22.w;
    return Container(
      decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
        color: backgroundColor,
        borderRadius: 20.r,
        hasShadow: false
      ),
      padding: EdgeInsets.all(16.w),
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Container(
            decoration: RoundedRectangleBorder().toSmoothCornerDecoration(
              color: iconBgColor,
              borderRadius: 10.r
            ),
            height: 40.w,
            width: 40.w,
            child: Utils.buildSvgWithAssets(
              icon: svgIcon,
              fit: BoxFit.none,
              height: iconS,
              width: iconS,
              applyThemeColor: false,
              iconColor: iconColor,
            ),
          ),
          SizedBox(width: 12.w),
          Expanded(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                label.toText14(color: textColor, isBold: true),
              ],
            ),
          ),
          SizedBox(width: 12.w),
          Transform.flip(
            flipX: getIt.get<AppState>().isArabic(),
            child: Utils.buildSvgWithAssets(
              icon: AppAssets.arrowRight,
              width: 24.w,
              height: 24.h,
              fit: BoxFit.contain,
              iconColor: AppColors.textColor,
            ),
          ),
        ],
      ),
    );
  }
}

