import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:taafee_mobile/features/card/data_layer/model/card_images.dart';

import '../../../../common/const/const.dart';

class CardImageWidget extends StatelessWidget {
  final CardImages cardImages;
  const CardImageWidget(
      {super.key, required this.cardImages, this.width, this.height});
  final double? width;
  final double? height;
  @override
  Widget build(BuildContext context) {
    return Container(
      width: width ?? Get.width * .3,
      height: height ?? 63,
      margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(8),
        image: DecorationImage(
            image: CachedNetworkImageProvider(
              Domain.domain + cardImages.url.substring(6),
            ),
            fit: BoxFit.cover),
      ),
    );
  }
}
