import 'package:flutter/material.dart';
import 'package:syncrow_web/common/widgets/custom_expansion_tile.dart';

class CommunityTile extends StatelessWidget {
  final String title;
  final List<Widget>? children;
  final bool isExpanded;
  final bool isSelected;
  final void Function(String, bool isExpanded) onExpansionChanged;
  final void Function() onItemSelected;

  const CommunityTile({
    super.key,
    required this.title,
    required this.isExpanded,
    required this.onExpansionChanged,
    required this.onItemSelected,
    required this.isSelected,
    this.children,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
        padding: const EdgeInsets.all(8.0),
        child: CustomExpansionTile(
          title: title,
          initiallyExpanded: isExpanded,
          isSelected: isSelected,
          onExpansionChanged: (bool expanded) {
            onExpansionChanged(title, expanded);
          },
          onItemSelected: onItemSelected,
          children: children ?? [],
        ));
  }
}
