如何在flutter中使用自定义节标题实现水平列表视图?

时间:2019-07-01 04:57:51

标签: flutter dart horizontallistview

要知道如何使用自定义栏标题实现此水平列表视图,我知道列表视图数据也是动态 就像这张图片一样

list view with custom sections header

我想将水平列表视图划分为带有“文本”小部件和位于其相应部分上方的“分隔线”的部分。

this image what I have implemented so far

列表视图小部件

 Flexible(
              child: Container(
                height: 200,
                child: ListView.builder(
                  itemBuilder: comingMoviesItemBuilder,
                  scrollDirection: Axis.horizontal,
                  itemCount: comingMovies.length,
                ),
              ),
            ),

项目生成器功能

Widget comingMoviesItemBuilder(context, index) {
    return ImageCardButton(
      image: '$kImageApiURL${comingMovies[index].posterPath}',
      heroTag: 'coming_poster_$index',
      onPressed: () {
        print(comingMovies[index].posterPath);
        Navigator.pushNamed(context, SingleMovieScreen.id,
            arguments: SingleMovieScreenArguments(heroTag: 'coming_poster_$index',movie: comingMovies[index]));
      },
    );
  }

部分标题窗口小部件

Flexible(
      child: Padding(
        padding: EdgeInsets.only(right: 10),
        child: Row(
          children: <Widget>[
            Text(
              title,
              style: TextStyle(letterSpacing: 5),
            ),
            Expanded(
              child: Container(
                height: 1.0,
                color: Color(0xFFEEEEEE),
              ),
            ),
          ],
        ),
      ),
    );

..

0 个答案:

没有答案