import 'package:flutter/material.dart';

enum SizeAxis { width, height }

class CardImage extends StatelessWidget {
  const CardImage({super.key, required this.image, this.padding, this.size});

  final ImageProvider<Object> image;
  final EdgeInsets? padding;

  final Map<SizeAxis, double>? size;

  @override
  Widget build(BuildContext context) {
    return Padding(
        padding: padding ?? const EdgeInsets.fromLTRB(0, 0, 0, 0),
        child: Container(
          width: size?[SizeAxis.width] ?? 60,
          height: size?[SizeAxis.height] ?? 60,
          decoration: BoxDecoration(
            image: DecorationImage(
              fit: BoxFit.cover,
              image: image,
              onError: (error, stackTrace) => AssetImage('assets/images/placeholder.jpg')
              // color: Colors.blue,
            ),
            borderRadius: BorderRadius.all(Radius.elliptical(8, 8)),
          ),
        ));
  }
}
