-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/packages
#7475Labels
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 onp: two_dimensional_scrollablesIssues pertaining to the two_dimensional_scrollables packageIssues pertaining to the two_dimensional_scrollables packager: 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
Sane error of 1D #153889
- Run code example
- Expand any node and try to collapse it
- Collapse node
- Try expand node again
Expected results
Expand/Collapse Tree node with right behavior
Actual results
Tree node expands/collapses with erratic behavior
Code sample
Code sample
import 'package:flutter/material.dart';
import 'package:two_dimensional_scrollables/two_dimensional_scrollables.dart';
/// Flutter code sample for [TreeView]
void main() => runApp(const TreeViewExampleApp());
class TreeViewExampleApp extends StatelessWidget {
const TreeViewExampleApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: TreeViewExample(),
);
}
}
class TreeViewExample extends StatefulWidget {
const TreeViewExample({super.key});
@override
State<TreeViewExample> createState() => _TreeViewExampleState();
}
class _TreeViewExampleState extends State<TreeViewExample> {
TreeViewNode<String>? _selectedNode;
final TreeViewController controller = TreeViewController();
final List<TreeViewNode<String>> _tree = <TreeViewNode<String>>[
TreeViewNode<String>('First'),
TreeViewNode<String>(
'Second',
children: <TreeViewNode<String>>[
TreeViewNode<String>(
'alpha',
children: <TreeViewNode<String>>[
TreeViewNode<String>('uno'),
TreeViewNode<String>('dos'),
TreeViewNode<String>('tres'),
],
),
TreeViewNode<String>('beta'),
TreeViewNode<String>('kappa'),
],
),
TreeViewNode<String>(
'Third',
expanded: true,
children: <TreeViewNode<String>>[
TreeViewNode<String>('gamma'),
TreeViewNode<String>('delta'),
TreeViewNode<String>('epsilon'),
],
),
TreeViewNode<String>('Fourth'),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('TreeView Demo'),
),
body: TreeView<String>(
tree: _tree,
controller: controller,
toggleAnimationStyle: AnimationStyle(
curve: Curves.easeInOut,
duration: Duration.zero,
),
treeNodeBuilder: (
BuildContext context,
TreeViewNode<Object?> node,
AnimationStyle animationStyle,
) {
Widget child = GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
setState(() {
controller.toggleNode(node);
_selectedNode = node as TreeViewNode<String>;
});
},
child: TreeView.defaultTreeNodeBuilder(
context,
node,
animationStyle,
),
);
if (_selectedNode == node as TreeViewNode<String>) {
child = ColoredBox(
color: Colors.purple[100]!,
child: child,
);
}
return child;
},
),
);
}
}
Screenshots or Video
Screenshots / Video demonstration
[Upload media here]
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.6 23G80 darwin-arm64, locale pt-BR)
• Flutter version 3.22.2 on channel stable at /Users/mairramersilva/fvm/versions/3.22.2
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 761747bfc5 (3 months ago), 2024-06-05 22:15:13 +0200
• Engine revision edd8546116
• Dart version 3.4.3
• DevTools version 2.34.3
[✓] 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.85
[✓] Network resources
• All expected network resources are available.
• No issues found!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 onp: two_dimensional_scrollablesIssues pertaining to the two_dimensional_scrollables packageIssues pertaining to the two_dimensional_scrollables packager: 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