flutter_tree 1.0.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 73

Flutter Tree #

GitHub stars pub package test

example

Install #

dependencies:
  flutter_tree: ^1.0.0

Uasge #

TreeNode #

TreeNode(
  title: Text('This is a title!'),
  children: [
    TreeNode(
      title: Text('This is a title!'),
      children: <Widget>[
        TreeNode(title: Text('This is a title!')),
        TreeNode(
          title: Text('This is a title!'),
          children: <Widget>[
            TreeNode(title: Text('This is a title!')),
            TreeNode(title: Text('This is a title!')),
            TreeNode(title: Text('This is a title!')),
          ],
        ),
        TreeNode(title: Text('This is a title!')),
        TreeNode(title: Text('This is a title!')),
        TreeNode(
          title: Text('This is a title!'),
          children: <Widget>[
            TreeNode(title: Text('This is a title!')),
            TreeNode(title: Text('This is a title!')),
            TreeNode(title: Text('This is a title!')),
          ],
        ),
      ],
    ),
  ],
)

TreeView #

TreeView(
  data: treeData,
  titleOnTap: () {
    print('title');
  },
  leadingOnTap: () {
    print('leading');
  },
  trailingOnTap: () {
    print('trailing');
  },
)

Config #

TreeNode #

propertytypedefaultdescriptionrequired
levelint0Item indent levelfalse
expanedbooleanfalseItem is expanedfalse
offsetLeftdouble24.0Item padding leftfalse
childrendoubleList<Widget>Children widget[]
titleWidgetText('Title')Title Widgetfalse
leadingWidgetIconButton()Leading widgetfalse
trailingWidgetIconButton()Trailing widgetfalse
titleOnTapFuctionnullTitle tap callbackfalse
leadingOnTapFuctionnullLeading tap callbackfalse
trailingOnTapFuctionnullTrailing tap Callbackfalse

TreeView #

propertytypedefaultdescriptionrequired
dataList<Map<String, dynamic>>nullTree datatrue
titleKeystringtitleTitle key in mapfalse
leadingKeystringleadingLeading key in mapfalse
expanedKeystringexpanedExpaned key in mapfalse
childrenKeystringchildrenChildren key in mapfalse
offsetLeftdouble24.0Item padding leftfalse
titleOnTapFuctionnullTitle tap callbackfalse
leadingOnTapFuctionnullLeading tap callbackfalse
trailingOnTapFuctionnullTrailing tap Callbackfalse

Contribute #

  1. Fork it (https://github.com/xrr2016/flutter_tree.git)
  2. Create your feature branch (git checkout -b feature/foo)
  3. Commit your changes (git commit -am 'Add some foo')
  4. Push to the branch (git push origin feature/foo)
  5. Create a new Pull Request

License #

MIT

[1.0.0] - 2020.05.17 #

  • Version 1.0.0 release! 🚀

[0.1.0] - 2020.03.14 #

  • flutter tree widget ralease! 👏

example/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_tree/flutter_tree.dart';

import 'tree_data.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Tree example',
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(title: Text('Flutter Tree')),
        // body: TreeView(
        //   data: treeData,
        //   titleOnTap: () {
        //     print('title');
        //   },
        //   leadingOnTap: () {
        //     print('leading');
        //   },
        //   trailingOnTap: () {
        //     print('trailing');
        //   },
        // ),

        body: TreeNode(
          title: Text('This is a title!'),
          children: [
            TreeNode(
              title: Text('This is a title!'),
              children: <Widget>[
                TreeNode(title: Text('This is a title!')),
                TreeNode(
                  title: Text('This is a title!'),
                  children: <Widget>[
                    TreeNode(title: Text('This is a title!')),
                    TreeNode(title: Text('This is a title!')),
                    TreeNode(title: Text('This is a title!')),
                  ],
                ),
                TreeNode(title: Text('This is a title!')),
                TreeNode(title: Text('This is a title!')),
                TreeNode(
                  title: Text('This is a title!'),
                  children: <Widget>[
                    TreeNode(title: Text('This is a title!')),
                    TreeNode(title: Text('This is a title!')),
                    TreeNode(title: Text('This is a title!')),
                  ],
                ),
              ],
            ),
          ],
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_tree: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_tree/flutter_tree.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
54
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
73
Learn more about scoring.

We analyzed this package on May 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.2
  • pana: 0.13.8-dev
  • Flutter: 1.17.1

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.3.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test