mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-12-02 15:25:04 +00:00
expansion only on clicking icon
This commit is contained in:
@ -1,45 +1,35 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:syncrow_web/common/custom_expansion_tile.dart';
|
||||
|
||||
class CommunityTile extends StatefulWidget {
|
||||
class CommunityTile extends StatelessWidget {
|
||||
final String title;
|
||||
final List<Widget>? children;
|
||||
final bool initiallyExpanded;
|
||||
final bool isExpanded;
|
||||
final bool isSelected;
|
||||
final Function(String, bool) onExpansionChanged;
|
||||
final Function() onItemSelected;
|
||||
|
||||
const CommunityTile({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.initiallyExpanded,
|
||||
required this.isExpanded,
|
||||
required this.onExpansionChanged,
|
||||
required this.onItemSelected,
|
||||
required this.isSelected,
|
||||
this.children,
|
||||
});
|
||||
|
||||
@override
|
||||
_CommunityTileState createState() => _CommunityTileState();
|
||||
}
|
||||
|
||||
class _CommunityTileState extends State<CommunityTile> {
|
||||
late bool _isExpanded;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isExpanded = widget.initiallyExpanded;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomExpansionTile(
|
||||
title: widget.title,
|
||||
initiallyExpanded: _isExpanded,
|
||||
title: title,
|
||||
initiallyExpanded: isExpanded,
|
||||
isSelected: isSelected,
|
||||
onExpansionChanged: (bool expanded) {
|
||||
setState(() {
|
||||
_isExpanded = expanded;
|
||||
});
|
||||
widget.onExpansionChanged(widget.title, expanded);
|
||||
onExpansionChanged(title, expanded);
|
||||
},
|
||||
children: widget.children ?? [],
|
||||
onItemSelected: onItemSelected,
|
||||
children: children ?? [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user