mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-14 17:25:50 +00:00
fixed re-rendering of community widget
This commit is contained in:
45
lib/pages/spaces_management/widgets/space_tile_widget.dart
Normal file
45
lib/pages/spaces_management/widgets/space_tile_widget.dart
Normal 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 ?? [],
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user