import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:tm_app/view_models/notification_view_model.dart';

import 'notification_card.dart';

class NotificationAllTab extends StatelessWidget {
  const NotificationAllTab({this.scrollController, super.key});

  final ScrollController? scrollController;

  @override
  Widget build(BuildContext context) {
    final viewModel = context.watch<NotificationViewModel>();
    final notifications =
        viewModel.allNotificationResponse?.data ?? [];

    return ListView.builder(
      controller: scrollController,
      itemCount: notifications.length,
      itemBuilder: (context, index) {
        final notification = notifications[index];
        return Padding(
          padding: const EdgeInsets.only(bottom: 16.0),
          child: NotificationCard(notification: notification),
        );
      },
    );
  }
}
