tp7309 / flutter_sticky_and_expandable_list

粘性头部与分组列表Sliver实现 Build a grouped list, which support expand/collapse section and sticky headers, support use it with sliver widget.
MIT License
140 stars 29 forks source link

type 'List<Widget?>' is not a subtype of type 'List<Widget>' in type cast #28

Closed rpungin closed 3 years ago

rpungin commented 3 years ago

Get this error on line 260 of sliver_expandable_list.dart

  ///By default, build a Column widget for layout all children's size.
  static Widget buildDefaultContent(
      BuildContext context, ExpandableSectionContainerInfo containerInfo) {
    var childDelegate = containerInfo.childDelegate!;
    var children = List<Widget?>.generate(childDelegate.childCount!,
        (index) => childDelegate.builder(context, index));
    return Column(
      children: children as List<Widget>, //line 260
    );
  }
rpungin commented 3 years ago

This is the stack trace:

Screen Shot 2021-03-27 at 3 26 38 PM
rpungin commented 3 years ago

This is the build method of my widget that uses ExpandableListView

    return ExpandableListView(
        builder: SliverExpandableChildDelegate<GameSummary, GamesListSection>(
            sectionList: sectionList,
            headerBuilder: (context, sectionIndex, index) =>
                Text(sectionList[sectionIndex].title),
            itemBuilder: (context, sectionIndex, itemIndex, index) {
              GameSummary gameSummary =
                  sectionList[sectionIndex].items[itemIndex];
              return GameSummaryWidget(
                gameSummary,
                onTap: (gameId) {},
              );
            }));
tp7309 commented 3 years ago

I has pushed a new version1.0.0-nullsafety.1.