import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

import '../../core/constants/assets.dart';
import '../../core/theme/colors.dart';
import '../../core/utils/size_config.dart';

class TenderCard extends StatelessWidget {
  const TenderCard({
    required this.backgroundColor,
    required this.iconPath,
    required this.title,
    required this.amount,
    required this.textColor,
    required this.onTap,
    required this.enableTap,
    this.width,
    this.height,
    super.key,
  });

  final Color backgroundColor;
  final String iconPath;
  final String title;
  final String amount;
  final Color textColor;
  final VoidCallback onTap;
  final bool enableTap;
  final double? width;
  final double? height;

  @override
  Widget build(BuildContext context) {
    final directionality = Directionality.of(context);
    return InkWell(
      onTap: enableTap ? onTap : null,
      child: Container(
        width: width ?? 178.0.w(),
        height: height ?? 148.0.h(),
        padding: EdgeInsets.symmetric(horizontal: 16.0.w(), vertical: 12.0.h()),
        decoration: BoxDecoration(
          color: backgroundColor,
          borderRadius: BorderRadius.circular(8),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            SvgPicture.asset(iconPath, width: 32.0.w(), height: 32.0.h()),
            SizedBox(height: 4.0.h()),
            Text(
              title,
              style: TextStyle(
                fontSize: 16.0.sp(),
                fontWeight: FontWeight.bold,
                color: AppColors.grey80,
              ),
            ),
            const Spacer(),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Text(
                  amount,
                  style: TextStyle(
                    fontSize: 24.0.sp(),
                    fontWeight: FontWeight.bold,
                    color: textColor,
                  ),
                ),
                enableTap
                    ? SvgPicture.asset(
                      directionality == TextDirection.rtl
                          ? AssetsManager.leftArrow
                          : AssetsManager.arrowRight,
                      colorFilter: ColorFilter.mode(
                        AppColors.grey50,
                        BlendMode.srcIn,
                      ),
                    )
                    : const SizedBox(),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
