- edited description
NodeExpander Size 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.size
not 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)
-
reporter -
reporter by the way ,on https://pub.dev/packages/flutter_treeview the version still is
flutter_treeview: ^0.9.0+1
not the 1.0.0+1 null_safety can you update the new version to pub.dev ?
-
- changed status to resolved
Fixes issue #33. Fixed NodeExpander size issue Fixes issue
#29. Updated code to use proper hover color→ <<cset 5c022ed945d5>>
-
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
- Log in to comment