fixed generic type

This commit is contained in:
Vadim 2024-10-07 14:55:56 +02:00
parent 12abf99e2f
commit c05d4e80b8

View file

@ -8,12 +8,10 @@ typedef _WidgetBuilder<W, T extends Identifiable> = W Function(BuildContext cont
class ExpandableSectionList<T extends Identifiable> extends StatefulWidget { class ExpandableSectionList<T extends Identifiable> extends StatefulWidget {
final List<T> values; final List<T> values;
final VoidCallback onSectionTitleTap; final VoidCallback onSectionTitleTap;
final ExpandableSectionListItem Function(BuildContext context, int index) builder;
final _WidgetBuilder<List<Widget>, T> contentBuilder; final _WidgetBuilder<List<Widget>, T> contentBuilder;
final _WidgetBuilder<List<IconButton>, T> actionsBuilder; final _WidgetBuilder<List<IconButton>, T> actionsBuilder;
const ExpandableSectionList({ const ExpandableSectionList({
required this.builder,
required this.values, required this.values,
required this.onSectionTitleTap, required this.onSectionTitleTap,
required this.contentBuilder, required this.contentBuilder,
@ -22,10 +20,10 @@ class ExpandableSectionList<T extends Identifiable> extends StatefulWidget {
}); });
@override @override
State<ExpandableSectionList> createState() => _ExpandableSectionListState(); State<ExpandableSectionList> createState() => _ExpandableSectionListState<T>();
} }
class _ExpandableSectionListState extends State<ExpandableSectionList> { class _ExpandableSectionListState<T extends Identifiable> extends State<ExpandableSectionList<T>> {
final Map<String, GlobalKey<ExpandableSectionListItemState>> keysMap = {}; final Map<String, GlobalKey<ExpandableSectionListItemState>> keysMap = {};
@override @override