Repository navigation
Closed
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Steps to reproduce
- Run the following code
- Expand/collapse First node
- Expand/collapse Second node
Expected results
Expanding/Collapsing animation and style are consistent and clear for every node
Actual results
For First node children are rendering above node while expanding/collapsing. See attached video.
Code sample
Code sample
import 'package:flutter/material.dart';
/// Flutter code sample for [TreeSliver].
void main() => runApp(const TreeSliverExampleApp());
class TreeSliverExampleApp extends StatelessWidget {
const TreeSliverExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(home: TreeSliverExample());
}
}
class TreeSliverExample extends StatefulWidget {
const TreeSliverExample({super.key});
@override
State<TreeSliverExample> createState() => _TreeSliverExampleState();
}
class _TreeSliverExampleState extends State<TreeSliverExample> {
TreeSliverNode<String>? _selectedNode;
final TreeSliverController controller = TreeSliverController();
final List<TreeSliverNode<String>> _tree = <TreeSliverNode<String>>[
TreeSliverNode<String>(
'First',
children: <TreeSliverNode<String>>[
TreeSliverNode<String>(
'alpha',
children: <TreeSliverNode<String>>[
TreeSliverNode<String>('uno'),
TreeSliverNode<String>('dos'),
TreeSliverNode<String>('tres'),
],
),
TreeSliverNode<String>('beta'),
TreeSliverNode<String>('kappa'),
],
),
TreeSliverNode<String>(
'Second',
children: <TreeSliverNode<String>>[
TreeSliverNode<String>(
'alpha',
children: <TreeSliverNode<String>>[
TreeSliverNode<String>('uno'),
TreeSliverNode<String>('dos'),
TreeSliverNode<String>('tres'),
],
),
TreeSliverNode<String>('beta'),
TreeSliverNode<String>('kappa'),
],
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('TreeSliver Demo')),
body: CustomScrollView(
slivers: <Widget>[
TreeSliver<String>(
toggleAnimationStyle: AnimationStyle(
duration: Duration(seconds: 1),
reverseDuration: Duration(seconds: 1),
),
tree: _tree,
controller: controller,
treeNodeBuilder:
(
BuildContext context,
TreeSliverNode<Object?> node,
AnimationStyle animationStyle,
) {
Widget child = GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
setState(() {
controller.toggleNode(node);
_selectedNode = node as TreeSliverNode<String>;
});
},
child: TreeSliver.defaultTreeNodeBuilder(
context,
node,
animationStyle,
),
);
if (_selectedNode == node as TreeSliverNode<String>) {
child = ColoredBox(
color: Colors.purple[100]!,
child: child,
);
}
return child;
},
),
],
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
Screen_Recording_20260622_145847.mp4
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[Paste your output here]Reacted by Jakob Krause
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listf: scrollingViewports, list views, slivers, etc.Viewports, list views, slivers, etc.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Activity
mbcorona commentedon Jun 22, 2026
Thanks for the clear repro and video. Routing to the framework team for further investigation
Shunt22 commentedon Jun 23, 2026
I've made some investigation. Looks like this issue is in this line.
https://github.com/flutter/flutter/blob/stable/packages/flutter/lib/src/rendering/sliver_tree.dart#L375
Not sure yet why there is a check for
parentIndex == 0. Removing this check fixes the issue.jordancarson1231-arch commentedon Jun 23, 2026
Fix TreeSliver first node clipping during expand/collapse animation (f…
Fix TreeSliver first node clipping during expand/collapse animation (f…
github-actions commentedon Aug 12, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.