Repository navigation
[two_dimensional_scrollables] TreeView Widget blanks when closing last parent #149182
Copy link
Copy link
Closed
flutter/packages
#9103Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopfound in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23Found to occur in 3.23has 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 packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: 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 teamwaiting for PR to land (fixed)A fix is in flightA fix is in flight
Description
Steps to reproduce
- Open a TreeView such that all Elements exceeds screensize height
- Scroll down to the latest Item. This Item should be a parent of other items
- Open the item and then close it.
Failure is also reproducable with the given example from the library.
Tested on Linux and Windows
Expected results
The item should close normally.
Actual results
The whole tree disappears and i get the following exception. After scrolling up and down the tree reappears.
The following _TypeError was thrown during paint():
Null check operator used on a null value
The relevant error-causing widget was:
TreeView<WorkPackage> TreeView:file:///<projectpathfile>
When the exception was thrown, this was the stack:
#0 RenderTreeViewport._paintRows (package:two_dimensional_scrollables/src/tree_view/render_tree.dart:594:8)
#1 RenderTreeViewport.paint.<anonymous closure> (package:two_dimensional_scrollables/src/tree_view/render_tree.dart:422:13)
#2 PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:486:12)
#3 PaintingContext.pushClipRect (package:flutter/src/rendering/object.dart:546:7)
#4 RenderTreeViewport.paint (package:two_dimensional_scrollables/src/tree_view/render_tree.dart:417:57)
#5 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:3239:7)
#6 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:166:11)
#7 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:109:5)Code sample
Code sample
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'custom_tree.dart';
import 'simple_tree.dart';
/// The page containing the interactive controls that modify the sample
/// TreeView.
class TreeExplorer extends StatefulWidget {
/// Creates a screen that demonstrates the TreeView widget in varying
/// configurations.
const TreeExplorer({super.key});
@override
State<TreeExplorer> createState() => _TreeExplorerState();
}
/// Which example is being displayed.
enum TreeType {
/// Displays TreeExample.
simple,
/// Displays CustomTreeExample.
custom,
}
class _TreeExplorerState extends State<TreeExplorer> {
final SizedBox _spacer = const SizedBox.square(dimension: 20.0);
TreeType _currentExample = TreeType.simple;
String _getTitle() {
return switch (_currentExample) {
TreeType.simple => 'Simple TreeView',
TreeType.custom => 'Customizing TreeView',
};
}
Widget _getTree() {
return switch (_currentExample) {
TreeType.simple => const TreeExample(),
TreeType.custom => const CustomTreeExample(),
};
}
Widget _getRadioRow() {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
const Spacer(),
Radio<TreeType>(
value: TreeType.simple,
groupValue: _currentExample,
onChanged: (TreeType? value) {
setState(() {
_currentExample = value!;
});
},
),
const Text('Simple'),
_spacer,
Radio<TreeType>(
value: TreeType.custom,
groupValue: _currentExample,
onChanged: (TreeType? value) {
setState(() {
_currentExample = value!;
});
},
),
const Text('Custom'),
const Spacer(),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(_getTitle()),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(50),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: _getRadioRow(),
),
),
),
body: _getTree(),
);
}
}Screenshots or Video
Screenshots / Video demonstration
2024-05-28.17-00-23.mp4
treeview.2024-05-28.17-11-15.mp4
Logs
No response
Flutter Doctor output
Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.22.1, on Manjaro Linux 6.8.9-3-MANJARO, locale de_DE.UTF-8)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 2023.3)
[✓] Connected device (2 available)
[✓] Network resources
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: desktopRunning on desktopRunning on desktopfound in release: 3.22Found to occur in 3.22Found to occur in 3.22found in release: 3.23Found to occur in 3.23Found to occur in 3.23has 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 packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.r: 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 teamwaiting for PR to land (fixed)A fix is in flightA fix is in flight
Activity
darshankawar commentedon May 29, 2024
@yahooooza Can you provide us a runnable reproducible code sample that triggers the reported log ?
yahooooza commentedon May 29, 2024
@darshankawar As already mentioned, the beaviour appears also in the given example from the library. I update the issue with the example code form the repo. You can see the beaviour in the second video i posted under "Screenshots or Video".
darshankawar commentedon May 29, 2024
Thanks for the update. Using the code sample provided and running on desktop, I was able to replicate the reported error.
stable, master flutter doctor -v
1 remaining item
MichelleWeck commentedon Mar 6, 2025
This problem is still reproducable in the newest Flutter version, 3.29.0. Will there be a fix to this issue?
[two_dimensional_scrollables] Fix TreeView null dereference during pa…
github-actions commentedon May 16, 2025
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.[two_dimensional_scrollables] Fix TreeView null dereference during pa…
[two_dimensional_scrollables] Fix TreeView null dereference during pa…
[two_dimensional_scrollables] Fix TreeView null dereference during pa…
[two_dimensional_scrollables] Fix TreeView null dereference during pa…
[two_dimensional_scrollables] Fix TreeView null dereference during pa…