import 'package:flutter/material.dart'; import 'package:syncrow_web/common/custom_expansion_tile.dart'; class CommunityTile extends StatefulWidget { final String title; final List? children; final bool initiallyExpanded; final Function(String, bool) onExpansionChanged; const CommunityTile({ super.key, required this.title, required this.initiallyExpanded, required this.onExpansionChanged, this.children, }); @override _CommunityTileState createState() => _CommunityTileState(); } class _CommunityTileState extends State { late bool _isExpanded; @override void initState() { super.initState(); _isExpanded = widget.initiallyExpanded; } @override Widget build(BuildContext context) { return CustomExpansionTile( title: widget.title, initiallyExpanded: _isExpanded, onExpansionChanged: (bool expanded) { setState(() { _isExpanded = expanded; }); widget.onExpansionChanged(widget.title, expanded); }, children: widget.children ?? [], ); } }