Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make table text selectable #6919

Merged
merged 8 commits into from Dec 29, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
55 changes: 30 additions & 25 deletions packages/devtools_app/lib/src/shared/table/table.dart
Expand Up @@ -325,18 +325,21 @@ class FlatTableState<T> extends State<FlatTable<T>> with AutoDisposeMixin {

@override
Widget build(BuildContext context) {
Widget buildTable(List<double> columnWidths) => _Table<T>(
tableController: tableController,
columnWidths: columnWidths,
autoScrollContent: widget.autoScrollContent,
rowBuilder: _buildRow,
activeSearchMatchNotifier: widget.activeSearchMatchNotifier,
rowItemExtent: defaultRowHeight,
preserveVerticalScrollPosition: widget.preserveVerticalScrollPosition,
tallHeaders: widget.tallHeaders,
headerColor: widget.headerColor,
fillWithEmptyRows: widget.fillWithEmptyRows,
enableHoverHandling: widget.enableHoverHandling,
Widget buildTable(List<double> columnWidths) => SelectionArea(
CoderDake marked this conversation as resolved.
Show resolved Hide resolved
child: _Table<T>(
tableController: tableController,
columnWidths: columnWidths,
autoScrollContent: widget.autoScrollContent,
rowBuilder: _buildRow,
activeSearchMatchNotifier: widget.activeSearchMatchNotifier,
rowItemExtent: defaultRowHeight,
preserveVerticalScrollPosition:
widget.preserveVerticalScrollPosition,
tallHeaders: widget.tallHeaders,
headerColor: widget.headerColor,
fillWithEmptyRows: widget.fillWithEmptyRows,
enableHoverHandling: widget.enableHoverHandling,
),
);
if (widget.sizeColumnsToFit || tableController.columnWidths == null) {
return LayoutBuilder(
Expand Down Expand Up @@ -687,17 +690,19 @@ class TreeTableState<T extends TreeNode<T>> extends State<TreeTable<T>>

@override
Widget build(BuildContext context) {
return _Table<T>(
tableController: tableController,
columnWidths: tableController.columnWidths!,
rowBuilder: _buildRow,
rowItemExtent: defaultRowHeight,
focusNode: _focusNode,
handleKeyEvent: _handleKeyEvent,
selectionNotifier: widget.selectionNotifier,
preserveVerticalScrollPosition: widget.preserveVerticalScrollPosition,
tallHeaders: widget.tallHeaders,
headerColor: widget.headerColor,
return SelectionArea(
child: _Table<T>(
tableController: tableController,
columnWidths: tableController.columnWidths!,
rowBuilder: _buildRow,
rowItemExtent: defaultRowHeight,
focusNode: _focusNode,
handleKeyEvent: _handleKeyEvent,
selectionNotifier: widget.selectionNotifier,
preserveVerticalScrollPosition: widget.preserveVerticalScrollPosition,
tallHeaders: widget.tallHeaders,
headerColor: widget.headerColor,
),
);
}

Expand Down Expand Up @@ -1600,8 +1605,8 @@ class _TableRowState<T> extends State<TableRow<T>>
}
// If ColumnRenderer.build returns null, fall back to the default
// rendering.
content ??= RichText(
text: TextSpan(
content ??= Text.rich(
TextSpan(
text: column.getDisplayValue(node),
children: [
if (column.getCaption(node) != null)
Expand Down
4 changes: 2 additions & 2 deletions packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md
Expand Up @@ -10,11 +10,11 @@ To learn more about DevTools, check out the

## General updates

TODO: Remove this section if there are not any general updates.
* Made table text selectable [6919](https://github.com/flutter/devtools/pull/6919)
CoderDake marked this conversation as resolved.
Show resolved Hide resolved

## Inspector updates

* Added link to package directory documentation, from the inspect settings dialog - [6825](https://github.com/flutter/devtools/pull/6825)
* Added link to package directory documentation, from the inspect settings dialog - [#6825](https://github.com/flutter/devtools/pull/6825)
* Fix bug where widgets owned by the Flutter framework were showing up in the widget tree view -
[6857](https://github.com/flutter/devtools/pull/6857)
* Only cache pub root directories added by the user - [6897](https://github.com/flutter/devtools/pull/6897)
Expand Down