import 'package:flutter/material.dart';

import '../../../../constants/api_urls.dart';
import '../../data/models/news.dart';

class NewsGridItem extends StatelessWidget {
  const NewsGridItem({required this.news, super.key});

  final News news;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: (news.teaserImage == null) ? Colors.black : Colors.transparent,
      child: FadeInImage.assetNetwork(
        image: news.teaserImage != null
            ? news.teaserImage?.imageVariants!['16x9-512'] ??
                TagesschauApiUrls.logoImage
            : TagesschauApiUrls.logoImage,
        fit: BoxFit.cover,
        placeholder: 'assets/img/image_placeholder.png',
      ),
    );
  }
}
