FLUTTER ECOSYSTEM

renefloor/side_header_list_view

带有粘性标题的 ListView,类似于 Android 联系人页面

side_header_list_view 项目封面
Stars
205
Forks
26
最近推送(UTC)
2021年3月12日
项目状态
未归档
Rene Floor GitHub avatar
GITHUB User

Rene Floor ↗

Amersfoort, The Netherlands
语言DartObjective-CJava

此仓库发布的插件

使用的依赖

依赖清单 3 项
  • flutter{"sdk":"flutter"}
  • meta^1.1.6
  • test开发依赖^1.3.0

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

展开 / 收起项目 README

side_header_list_view

pub package Donate

Listview with sticky headers like the Android contact page

alt text

Usage

  new SideHeaderListView(
    // Set how many items the list has
    itemCount: items.length,
    
    // Set the height of the item widgets. For now this has to be a fixed height
    itemExtend: 150.0,
    
    // Set the header builder, this needs to return the widget for the side header
    headerBuilder: (BuildContext context, int index){
      return new HeaderWidget(items[index].startDate);
    },
    
    // Set the item builder, this is everything in the row without the header
    itemBuilder: (BuildContext context, int index){
      return new ListItem(items[index]);
    },
    
    // HasSameHeader will be used to know whether the header has to be shown for a position 
    hasSameHeader: (int a, int b){
      return items[a].day == items[b].day;
    },
  );