selection_tree_view 1.0.3 copy "selection_tree_view: ^1.0.3" to clipboard
selection_tree_view: ^1.0.3 copied to clipboard

A Flutter package providing a customizable and interactive tree view with selection capabilities.

Selection Tree View #

Pub Version Pub Points

A Flutter package providing a customizable and interactive tree view with selection capabilities.

Screenshots #

[] []

Features #

  • Hierarchical data display
  • Expandable/collapsible buttons
  • Customizable button appearance

Getting Started #

To use the SelectionTreeView widget in your Flutter project, follow these steps:

flutter pub add selection_tree_view

Usage #

Here's a basic example of how to use the SelectionTreeView widget:

import 'package:flutter/material.dart';
import 'package:selection_tree_view/models/mock_data_model.dart';
import 'package:selection_tree_view/screens/selection_tree_view.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Selection Tree View',
      home: Scaffold(
        appBar: AppBar(title: Text('Selection Tree View')),
        body: SelectionTreeView(
          rootNodes: MockDataModel.mockTreeData(),
          onSelectNode: (rootNodes, nodeSelected) {},
          treeRowDecoration: (node, index) {
            return BoxDecoration(
              color: index % 2 == 0 ? Colors.grey.shade100 : Colors.white,
            );
          },
          // prefixIconBuilder: (node) {
          //   return node.children.isEmpty
          //       ? SizedBox()
          //       : Icon(Icons.arrow_drop_up);
          // },
          // treeConfiguration: TreeConfiguration(
          //   showCheckbox: true,
          //   animatePrefixIcon: false,
          // ),
          // titleBuilder: (title) {
          //   return Text(
          //     title,
          //     style: TextStyle(
          //       color: Colors.black,
          //       fontWeight: FontWeight.bold,
          //       fontSize: 12,
          //     ),
          //     maxLines: 1,
          //     overflow: TextOverflow.ellipsis,
          //   );
          // },
        ),
      ),
    );
  }
}

Customization #

The SelectionTreeView widget offers various customization options:

  • treeConfiguration (TreeConfiguration):
    • titleStyle (TextStyle): Node title style.
    • nodeHeight (double): Row height.
    • prefixIcon (Widget): Default prefix icon.
    • animatedDuration (Duration): Animation speed.
    • showCheckbox (bool): Show checkboxes.
    • animatePrefixIcon (bool): Animate prefix icon.
  • titleBuilder (Widget Function(String title)): Custom title widget.
  • prefixIconBuilder (Widget Function(TreeNode node)): Custom prefix icon widget.
  • treeRowDecoration (BoxDecoration Function(TreeNode node, int index)): Row decoration.

For more advanced customization, refer to the API documentation.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

2
likes
0
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package providing a customizable and interactive tree view with selection capabilities.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

equatable, flutter, flutter_bloc

More

Packages that depend on selection_tree_view