dynamic_treeview
동적 부모/자식 관계를 사용하여 구축할 수 있는 동적 트리뷰입니다. 수평 및 수직 스크롤을 지원하는 무제한 카테고리/하위 카테고리 목록을 지원합니다.
동적 부모/자식 관계를 사용하여 구축할 수 있는 동적 트리뷰
{"sdk":"flutter"}{"sdk":"flutter"}아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
A Dynamic treeview that can be build using dynamic parent/child relationship. It supports indefinite category/subcategory lists with horizontal and vertical scrolling
In your flutter project add the dependency:
dependencies:
...
dynamic_treeview: 1.0.0+2
import 'package:dynamic_treeview/dynamic_treeview.dart';
Since DynamicTreeView is build using data having parent/child relationship,
you must create a class model that implements BaseModel and overrides the method
like getParentId(), getId() and getTitle() and return appropriate values to make it work.
The method getExtraData() has also been added just in-case if any extra data is needed when child/parent is tapped.
DynamicTreeView(
data: getData(), // pass here List<BaseModel>
config: Config(
parentTextStyle:
TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
rootId: "1",
parentPaddingEdgeInsets:
EdgeInsets.only(left: 16, top: 0, bottom: 0)),
onTap: (m) {
//action on tap
},
width: MediaQuery.of(context).size.width,
)
data - List<BaseData> .TreeView will be build based on this data.This is a required field
config - Various Configuration options
onTap - Callback when tapped on parent/child widget
parentTextStyle - Parent tile TextStyle
parentPaddingEdgeInsets - Parent tile padding
childrenTextStyle - Child tile TextStyle
childrenPaddingEdgeInsets - Children tile padding
Check the Config class in dynamic_treeview.dart file for details.
Please check example for details.
alt text
alt text