import 'package:flutter/material.dart';

class PlaceholderView extends StatelessWidget {
  final IconData icon;
  final String text;
  final Widget? button;
  const PlaceholderView({
    super.key,
    required this.icon,
    required this.text,
    this.button,
  });

  @override
  Widget build(BuildContext context) => CustomScrollView(
    physics: const AlwaysScrollableScrollPhysics(),
    slivers: [
      SliverFillRemaining(
        child: Center(
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Padding(
                  padding: const EdgeInsets.all(30),
                  child: Icon(icon, size: 60),
                ),
                Text(
                  text,
                  style: const TextStyle(fontSize: 20),
                  textAlign: TextAlign.center,
                ),
                const SizedBox(height: 30),
                ?button,
              ],
            ),
          ),
        ),
      ),
    ],
  );
}
