Giter VIP home page Giter VIP logo

dynamic_treeview's Introduction

dynamic_treeview - A flutter package

A Dynamic treeview that can be build using dynamic parent/child relationship. It supports indefinite category/subcategory lists with horizontal and vertical scrolling

Getting Started

In your flutter project add the dependency:

    dependencies:
        ...
        dynamic_treeview: 1.0.0+2

Import package

import 'package:dynamic_treeview/dynamic_treeview.dart';

BaseModel implementation

    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.

Sample Usage

    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,
    )

Constructor parameters

    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

Configuration parameters

    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.

Sample code

Please check example for details.

Screenshots

Full Screen

alt text

Drawer

alt text

MIT LICENSE

I spent weeks of my time developing this package. I really hope this saves you loads of time and i'd be glad to hear your feedback.Let me know if you find any bugs/issues.Thanks.

dynamic_treeview's People

Contributors

thangmam avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.