-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
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.found in release: 3.24Found to occur in 3.24Found to occur in 3.24found in release: 3.25Found to occur in 3.25Found to occur in 3.25frameworkflutter/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 onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team
Description
Steps to reproduce
- Run code example
- Expand any node and try to collapse it
- Collapse node
- Try expand node again
Expected results
Tree node collapses and expands again
Actual results
Tree node does not expand because it is removed
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'),
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'),
],
),
TreeSliverNode<String>(
'Third',
expanded: true,
children: <TreeSliverNode<String>>[
TreeSliverNode<String>('gamma'),
TreeSliverNode<String>('delta'),
TreeSliverNode<String>('epsilon'),
],
),
TreeSliverNode<String>('Fourth'),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('TreeSliver Demo'),
),
body: CustomScrollView(
slivers: <Widget>[
TreeSliver<String>(
tree: _tree,
controller: controller,
toggleAnimationStyle: AnimationStyle(
duration: const Duration(milliseconds: 0),
curve: Curves.easeInOut,
),
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
Gravacao.de.Tela.2024-08-21.as.18.59.25.mov
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[!] Flutter (Channel [user-branch], 3.25.0-1.0.pre.67, on macOS 14.6 23G80 darwin-arm64, locale pt-BR)
! Flutter version 3.25.0-1.0.pre.67 on channel [user-branch] at /Users/mairramersilva/Projects/op/flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
! Upstream repository https://github.com/Mairramer/flutter.git is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to https://github.com/Mairramer/flutter.git to dismiss this error.
• Framework revision e95462d83b (9 minutes ago), 2024-08-21 18:54:19 -0300
• Engine revision b94e009703
• Dart version 3.6.0 (build 3.6.0-164.0.dev)
• DevTools version 2.39.0-dev.15
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/mairramersilva/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /Users/mairramersilva/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/mairramersilva/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15C500b
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] IntelliJ IDEA Community Edition (version 2023.3.4)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.92.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.95.20240801
[✓] Connected device (3 available)
• macOS (desktop) • macos • darwin-arm64 • macOS 14.6 23G80 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 14.6 23G80 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 128.0.6613.84
[✓] Network resources
• All expected network resources are available.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.found in release: 3.24Found to occur in 3.24Found to occur in 3.24found in release: 3.25Found to occur in 3.25Found to occur in 3.25frameworkflutter/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 onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamOwned by Framework teamtriaged-frameworkTriaged by Framework teamTriaged by Framework team