NodeExpander Size issue

Issue #33 open
xsm123 created an issue

tree_node.dart

  Widget _buildNodeExpander() {
    TreeView? _treeView = TreeView.of(context);
    TreeViewTheme _theme = _treeView!.theme;
    return widget.node.isParent
        ? GestureDetector(
            onTap: () => _handleExpand(),
            child: _TreeNodeExpander(
              speed: (_controller.duration ?? Duration.zero),
              expanded: widget.node.expanded,
              themeData: _theme.expanderTheme,
            ),
          )
        : Container(
            width: 10,
          );
  }

when the node is a parent ,there has a Expand icon (set by treeViewTheme size 20),

TreeViewTheme treeViewTheme = TreeViewTheme(
    expanderTheme: ExpanderThemeData(
      type: ExpanderType.caret,
      modifier: ExpanderModifier.none,
      position: ExpanderPosition.start,
      color: MColors.userNavColor,
      size: 20,
    )
  );

when the node is a child ,there has no Expand icon (set by _buildNodeExpander() size 10)

my issue is the parent and child padding left issue,not the same size

as simple fix just use width: _theme.expanderTheme.sizenot a const size 10

Widget _buildNodeExpander() {
    TreeView? _treeView = TreeView.of(context);
    TreeViewTheme _theme = _treeView!.theme;
    return widget.node.isParent
        ? GestureDetector(
            onTap: () => _handleExpand(),
            child: _TreeNodeExpander(
              speed: (_controller.duration ?? Duration.zero),
              expanded: widget.node.expanded,
              themeData: _theme.expanderTheme,
            ),
          )
        : Container(
            width: _theme.expanderTheme.size,
          );
  }

Comments (4)

  1. xsm123 reporter
    • changed status to open
    //tree_node.dart line::114
      Widget _buildNodeExpander() {
        TreeView? _treeView = TreeView.of(context);
        assert(_treeView != null, 'TreeView must exist in context');
        TreeViewTheme _theme = _treeView!.theme;
        return widget.node.isParent
            ? GestureDetector(
                onTap: () => _handleExpand(),
                child: _TreeNodeExpander(
                  speed: _controller.duration!,
                  expanded: widget.node.expanded,
                  themeData: _theme.expanderTheme,
                ),
              )
            : Container(width: _theme.expanderTheme.size);
      }
    

    Container(width: _theme.expanderTheme.size);

    //tree_node.dart line::432
     return Container(
          width: widget.themeData.size + 2,
          height: widget.themeData.size + 2,
          alignment: Alignment.center,
          decoration: BoxDecoration(
            shape: _shapeBorder,
            border: _borderWidth == 0
                ? null
                : Border.all(
                    width: _borderWidth,
                    color: widget.themeData.color ?? Colors.black,
                  ),
            color: _backColor,
          ),
    

    After actual test find out , Should be Container(width: _theme.expanderTheme.size+2);

    It could be expander used 2px

  2. Log in to comment