import 'package:flutter/material.dart';
import 'package:flutter_animate/flutter_animate.dart';

class StaggeredList extends StatelessWidget {
  final List<Widget> children;
  final double interval;
  final Duration duration;
  final Curve curve;

  const StaggeredList({
    super.key,
    required this.children,
    this.interval = 50, // milliseconds
    this.duration = const Duration(milliseconds: 300),
    this.curve = Curves.easeOut,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: children
          .animate(interval: Duration(milliseconds: interval.toInt()))
          .fadeIn(duration: duration, curve: curve)
          .slideY(begin: 0.1, end: 0, duration: duration, curve: curve),
    );
  }
}
