flexible_tree_view 0.0.5 copy "flexible_tree_view: ^0.0.5" to clipboard
flexible_tree_view: ^0.0.5 copied to clipboard

A highly flexible tree view on flutter.

Features #

  • Expand / Collapse the tree nodes;
  • Show lines of parent -> child nodes;
  • High flexible to custom node widget

Getting tarted #

dependencies:
    flexible_tree_view: ^0.0.5

Screen shot #

Usage #

import 'package:flexible_tree_view/flexible_tree_view.dart';

FlexibleTreeView<String>(
	nodes: [
		TreeNode<String>(
			data: 'Cities', 
			expanded: true, 
			children: [
				TreeNode<String>(data: 'Beijing'), 
				TreeNode<String>(data: 'Shanghai'),
				TreeNode<String>(data: 'Tokyo'),
				TreeNode<String>(data: 'Paris')
			]
		)
	],
	nodeItemBuilder: (context, node) {
		return Padding(
			padding: const EdgeInsets.symmetric(vertical: 8),
			child: Row(
				children: [
				node.hasNodes
					? IconButton(
						iconSize: 12,
						splashRadius: 16,
						padding: EdgeInsets.zero,
						constraints:
							BoxConstraints.tight(Size(30, 30)),
						icon: Icon(node.expanded
							? Icons.remove
							: Icons.add),
						onPressed: () {
							node.expanded = !node.expanded;
						},
						)
					: const SizedBox(
						width: 12,
						),
				Text(
					node.data,
					style: TextStyle(
					fontSize: 12,
					color: Colors.black,
					),
					overflow: TextOverflow.ellipsis,
				)
				],
			));
	},
)

License #

See LICENSE

9
likes
120
pub points
67%
popularity

Publisher

verified publisherdev.apptoy.cc

A highly flexible tree view on flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, ulid

More

Packages that depend on flexible_tree_view