fixed re-rendering of community widget

This commit is contained in:
hannathkadher
2024-10-08 20:37:04 +04:00
parent 1156af9b8e
commit 33712b7690
4 changed files with 90 additions and 30 deletions

View File

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:syncrow_web/common/custom_expansion_tile.dart';
class SpaceTile extends StatefulWidget {
final String title;
final bool initiallyExpanded;
final ValueChanged<bool> onExpansionChanged;
final List<Widget>? children;
const SpaceTile({
Key? key,
required this.title,
required this.initiallyExpanded,
required this.onExpansionChanged,
this.children,
}) : super(key: key);
@override
_SpaceTileState createState() => _SpaceTileState();
}
class _SpaceTileState extends State<SpaceTile> {
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(expanded);
},
children: widget.children ?? [],
);
}
}