import 'package:flutter/material.dart';
import 'package:hl_lieferservice/feature/delivery/detail/presentation/article/article_list_item.dart';
import 'package:hl_lieferservice/model/article.dart';

class ArticleList extends StatefulWidget {
  const ArticleList({
    super.key,
    required this.articles,
    required this.deliveryId,
  });

  final List<Article> articles;
  final String deliveryId;

  @override
  State<StatefulWidget> createState() => _ArticleListState();
}

class _ArticleListState extends State<ArticleList> {
  @override
  Widget build(BuildContext context) {
    return ListView.separated(
      shrinkWrap: true,
      physics: NeverScrollableScrollPhysics(),
      itemBuilder:
          (context, index) => ArticleListItem(
            article: widget.articles[index],
            deliveryId: widget.deliveryId,
          ),
      separatorBuilder: (context, index) => const Divider(height: 0),
      itemCount: widget.articles.length,
    );
  }
}
