Tahaan / expandable_tree_menu

Flutter Widget allowing you to easily create a tree-structure "menu" from a recursive list of data nodes
BSD 3-Clause "New" or "Revised" License
1 stars 2 forks source link

Black Line #3

Open marioprego opened 3 months ago

marioprego commented 3 months ago

Hi, Can you help me remove the black line that appears in the header and footer when expanding a menu?

Thank you.

juanpsama commented 2 months ago

Hi, I was able to solve that problem by modifying the package, every node in the tree is actually a ExpansionTile widget, and ExpansionTile receives a "shape" parameter to modify how the border actually looks, so if you pass a Border object to it you can make it look whatever you want, I remove all borders by passing an empty Border() object to shape, and for my case look acceptable, maybe you can also match the color of those lines with the background to make them imperceptible, here is my code

@override
  Widget build(BuildContext context) {
    return Material(
      // color: Colors.transparent,
      child: Container(
        margin: widget.submenuMargin,
        decoration: widget.submenuDecoration,
        child: ExpansionTile(
          collapsedBackgroundColor: widget.submenuClosedColor,
          backgroundColor: widget.submenuOpenColor,
          onExpansionChanged: toggleState,
          shape: Border(),
          iconColor: widget.openTwistyColor,
          controlAffinity: ListTileControlAffinity.leading,
          collapsedIconColor: widget.closedTwistyColor,
          initiallyExpanded: widget.defaultState == TwistyState.open,
          tilePadding: EdgeInsets.zero,
          childrenPadding: EdgeInsets.only(left: widget.childIndent),
          title: CustomExpandableNode(
            onSelect: () {
               widget.onSelect!(widget.node.value);
            },
            child: widget.nodeBuilder(context, widget.node.value),
          ),
          children: [
            // _ThinDivider(),
            Container(
              decoration: widget.childrenDecoration,
              margin: widget.childrenMargin,
              child: CustomExpandableTree<T>(
                twistyPosition: widget.twistyPosition,
                initiallyExpanded: widget.defaultState == TwistyState.open,
                childIndent: widget.childIndent,
                nodes: widget.subNodes,
                nodeBuilder: widget.nodeBuilder,
                onSelect: widget.onSelect,
                onExpand: widget.onExpand,
                onEmptyNode: widget.onEmptyNode,
                openTwistyColor: widget.openTwistyColor,
                closedTwistyColor: widget.closedTwistyColor,
                openTwisty: widget.openTwisty,
                closedTwisty: widget.closedTwisty,
                childrenDecoration: widget.childrenDecoration,
                submenuDecoration: widget.submenuDecoration,
                submenuMargin: widget.submenuMargin,
                childrenMargin: widget.childrenMargin,
                submenuClosedColor: widget.submenuClosedColor,
                submenuOpenColor: widget.submenuOpenColor,
              ),
            ),
          ],
        ),
      ),
    );
  } 

This in the SubTreeWrapper widget at the file lib/src/nodes.dart, this code have some other changes to the original one but the thing you should focus in is the shape: Border() parameter