open:flutter-reorderables

reorderables

_buildSection() {
  // 선택한 pantry 에 대해 admin 권한을 가졌는가?
  var pantryUserEdge = _pantryStore.pantryUserEdgeList
      .firstWhereOrNull((e) => e.userId == _settingStore.user?.objectId);

  if (pantryUserEdge == null ||
      pantryUserEdge.authority < AuthorityConst.admin) {
    return [];
  }

  return [
    SliverToBoxAdapter(
      child: SectionTitle(
        text: 'Section',
      ),
    ),
    Observer(
      builder: (ctx) {
        return ReorderableSliverList(
          // delegate: ReorderableSliverChildListDelegate(sectionWidget),
          delegate: ReorderableSliverChildBuilderDelegate(
              (BuildContext context, int index) {
            var section = _pantryStore.sectionList[index];
            return SectionRow(section: section);
          }, childCount: _pantryStore.sectionList.length),
          onReorder: (int oldIndex, int newIndex) {
            _pantryStore.sectionReorder(oldIndex, newIndex);
          },
        );
      },
    )
  ];
}

  • open/flutter-reorderables.txt
  • 마지막으로 수정됨: 2021/06/27 11:33
  • 저자 127.0.0.1