import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:taafee_mobile/common/const/const.dart';
import 'package:taafee_mobile/common/extensions/widget_extension.dart';
import 'package:taafee_mobile/common/widgets/text.dart';
import 'package:taafee_mobile/features/card/data_layer/model/card_images.dart';
import 'package:taafee_mobile/features/card/data_layer/model/card_model.dart';

class ImageWidget extends StatelessWidget {
  final int numberOfImages;
  final CardImages cardImages;
  const ImageWidget({super.key, required this.numberOfImages, required this.cardImages});

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.symmetric(horizontal: 5),
      width: Get.width * .2,
      height: Get.width * .2,
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(10),
        image: DecorationImage(
          image: CachedNetworkImageProvider(Domain.domain + cardImages.url.substring(6)),
          // image: AssetImage("assets/images/download.jpg"),
          fit: BoxFit.cover,
        ),
      ),
      child: numberOfImages > 4
          ? BoldTextWidget(
              "+$numberOfImages",
              fontSize: 24,
              color: Colors.white,
            ).center()
          : Container(),
    );
  }
}
