Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
5009433
Improve widget selection in the inspector (Related ticket: #3489)
msavela Nov 18, 2021
0607595
Removed details tree search (#3489)
alexlindroos Nov 19, 2021
4203f88
Highlight search matches with orange color (#3489)
alexlindroos Nov 19, 2021
c5e15bd
Changed the orange color of search highlight (#3489)
alexlindroos Nov 19, 2021
75b3046
Highlight preview only instead of the whole item (flutter#3489)
aednlaxer Nov 23, 2021
8808813
Use different text background colors depending on whether the node is…
aednlaxer Nov 23, 2021
f6bf52e
Highlight searchValue in text preview (flutter#3489)
aednlaxer Nov 24, 2021
3b72790
Reformat code (flutter#3489)
aednlaxer Nov 24, 2021
a8dd2d9
Use colors from ui/colors.dart for search matches (flutter#3489)
aednlaxer Nov 24, 2021
2ee4c21
Find widget by tooltip instead of text in inspector_screen_test (flut…
aednlaxer Nov 30, 2021
ee4f81a
Add breadcrumbs widget and show it in the Widget detail tree (#3489)
aednlaxer Dec 2, 2021
b752bca
Merge pull request #26 from CodemateLtd/widget-search-alex
msavela Dec 2, 2021
580ea85
Fix inspector_integration_test.dart (flutter#3489)
aednlaxer Dec 2, 2021
ec063b1
Update goldens (flutter#3489)
aednlaxer Dec 2, 2021
17e117d
Remove unnecessary import (flutter#3489)
aednlaxer Dec 2, 2021
3b79477
Revert goldens update (flutter#3489)
aednlaxer Dec 7, 2021
87c6fae
Put FakeServiceManager to the global storage before running tests in …
aednlaxer Dec 7, 2021
8df337a
Mock searchInProgressNotifier (flutter#3489)
aednlaxer Dec 7, 2021
cc61b2d
Update goldens (flutter#3489)
aednlaxer Dec 7, 2021
ff60690
Fix several nits (flutter#3489)
aednlaxer Dec 8, 2021
7719e8f
Use regular text style when searchValue is null, empty or there's no …
aednlaxer Dec 8, 2021
9ca2161
Add extra null checks to isChevron and isEllipsis (flutter#3489)
aednlaxer Dec 8, 2021
7207269
Use Container's alignment instead of Align (flutter#3489)
aednlaxer Dec 8, 2021
774a89d
Remove SizedBox (flutter#3489)
aednlaxer Dec 8, 2021
6903577
Add constant for the max number of breadcrumbs (flutter#3489)
aednlaxer Dec 9, 2021
ae76768
Move search controls to InspectorSummaryTreeControls (flutter#3489)
aednlaxer Dec 9, 2021
1e3f6c9
Add TODO comment regarding other values of SearchTargetType (flutter#…
aednlaxer Dec 9, 2021
162dce7
Add named constructor to PaddedDivider for setting symmetric vertical…
aednlaxer Dec 9, 2021
b14178f
Add SmallCircularProgressIndicator and reuse it (flutter#3489)
aednlaxer Dec 9, 2021
4ac247f
Use constants (flutter#3489)
aednlaxer Dec 9, 2021
c65d079
Prefix debug variables (flutter#3489)
aednlaxer Dec 9, 2021
247d509
Cache selected inspector tree row (flutter#3489)
aednlaxer Dec 9, 2021
9d43a70
Simplify the way search works in inspector_tree_controller.dart (flut…
aednlaxer Dec 10, 2021
0951e4f
Rename searchPreventCloseOnBlur to searchPreventClose (flutter#3489)
aednlaxer Dec 10, 2021
fc71a46
Remove irrelevant comments (flutter#3489)
aednlaxer Dec 10, 2021
b1063f7
Change max number of breadcrumbs and the way displayed items are calc…
aednlaxer Dec 13, 2021
243cfa8
Change isChevron and isEllipsis checks (flutter#3489)
aednlaxer Dec 13, 2021
6987e58
Doc: wrap variables in brackets (flutter#3489)
aednlaxer Dec 13, 2021
4d08128
Simplify horizontal padding (flutter#3489)
aednlaxer Dec 13, 2021
0c6e704
Add tests for caseInsensitiveEquals and caseInsensitiveAllMatches (fl…
aednlaxer Dec 13, 2021
fbdbb5a
Merge branch 'master' into widget-selection-search
aednlaxer Dec 13, 2021
ea299df
Pull out search debounce to SearchControllerMixin (flutter#3489)
aednlaxer Dec 13, 2021
1c0b711
Use refreshSearchMatches instead of matchesForSearch (flutter#3489)
aednlaxer Dec 13, 2021
d72570a
Search previous matches in widget search when asked to (flutter#3489)
aednlaxer Dec 13, 2021
337bab1
Perform a global search when search inside previous matches fails (fl…
aednlaxer Dec 13, 2021
2c42d9f
Fix nits (flutter#3489)
aednlaxer Dec 15, 2021
5374d37
Remove setSearchMatch function (flutter#3489)
aednlaxer Dec 15, 2021
6ab7258
Expand every node of the tree before search (flutter#3489)
aednlaxer Dec 15, 2021
a9ac6b6
Add a list of all cached tree rows for search (flutter#3489)
aednlaxer Dec 16, 2021
6347a52
Use tree nodes instead of rows in InspectorBreadcrumbNavigator. Simpl…
aednlaxer Dec 17, 2021
eafc8bf
Fix nits (flutter#3489)
aednlaxer Dec 17, 2021
20b2d60
Merge branch 'master' into widget-selection-search
aednlaxer Dec 17, 2021
74a32a3
Optimize usage of variables (flutter#3489)
aednlaxer Dec 20, 2021
7af5098
Update goldens (flutter#3489)
aednlaxer Dec 21, 2021
72c9b5e
Merge branch 'master' into widget-selection-search
aednlaxer Dec 21, 2021
1937d24
Update matchIndex when activeMatchIndex is greater than number of ite…
aednlaxer Dec 21, 2021
90922d0
Set searchInProgress to false before calling _updateMatches (flutter#…
aednlaxer Dec 21, 2021
cb2d114
Make matchesForSearch return Future (flutter#3489)
aednlaxer Dec 14, 2021
04d30c5
Check diagnostic properties for search matches (flutter#3489)
aednlaxer Dec 14, 2021
522e086
Fix issues after rebase (flutter#3489)
aednlaxer Dec 16, 2021
48cd304
Add search scope selector (flutter#3489)
aednlaxer Dec 16, 2021
0e79734
Highlight details search results (flutter#3489)
aednlaxer Dec 20, 2021
d9d4a88
Set details tree opacity to 1 (flutter#3489)
aednlaxer Dec 20, 2021
b2cd2f8
Fix search match highlight color for details tree (flutter#3489)
aednlaxer Dec 20, 2021
e546105
Add 'all' search target type (flutter#3489)
aednlaxer Dec 20, 2021
fc3227b
Remove dropdown border (flutter#3489)
aednlaxer Dec 20, 2021
d916bf7
Reset match index when search target changes (flutter#3489)
aednlaxer Dec 20, 2021
25df88b
Highlight details tree search matches using 'focused' style (flutter#…
aednlaxer Dec 20, 2021
d2ea137
Do not look for matches in hidden properties (flutter#3489)
aednlaxer Dec 20, 2021
0f5e5fc
Allow only one line of property name and description (flutter#3489)
aednlaxer Dec 20, 2021
84be861
Fix rebase issues (flutter#3489)
aednlaxer Dec 22, 2021
b66e2b5
Merge branch 'master' into widget-search-details
aednlaxer Jan 5, 2022
2811511
Fix issues after merge (flutter#3489)
aednlaxer Jan 5, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1053,10 +1053,10 @@ class DebuggerController extends DisposableController

// TODO(kenz): search through previous matches when possible.
@override
List<SourceToken> matchesForSearch(
Future<List<SourceToken>> matchesForSearch(
String search, {
bool searchPreviousMatches = false,
}) {
}) async {
if (search == null || search.isEmpty || parsedScript.value == null) {
return [];
}
Expand Down
69 changes: 53 additions & 16 deletions packages/devtools_app/lib/src/inspector/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ class DiagnosticsNodeDescription extends StatelessWidget {
searchValue,
textStyle,
textStyle.merge(nodeDescriptionHighlightStyle),
addQuotes: true,
),
],
);
Expand Down Expand Up @@ -185,14 +186,34 @@ class DiagnosticsNodeDescription extends StatelessWidget {
TextStyle textStyle =
baseStyle.merge(textStyleForLevel(diagnostic.level, colorScheme));
var descriptionTextStyle = textStyle;
final TextStyle searchMatchTextStyle = textStyle?.copyWith(
color: nodeDescriptionHighlightStyle?.color,
backgroundColor: nodeDescriptionHighlightStyle?.backgroundColor,
);
// TODO(jacobr): use TextSpans and SelectableText instead of Text.
if (diagnostic.isProperty) {
// Display of inline properties.
final String propertyType = diagnostic.propertyType;
final Map<String, Object> properties = diagnostic.valuePropertiesJson;

if (name?.isNotEmpty == true && diagnostic.showName) {
children.add(Text('$name${diagnostic.separator} ', style: textStyle));
children.add(
RichText(
maxLines: 1,
text: TextSpan(
children: [
_buildHighlightedSearchPreview(
name,
searchValue,
textStyle,
searchMatchTextStyle,
),
TextSpan(text: '${diagnostic.separator} '),
],
),
),
);

// provide some contrast between the name and description if both are
// present.
descriptionTextStyle =
Expand Down Expand Up @@ -248,16 +269,30 @@ class DiagnosticsNodeDescription extends StatelessWidget {
textStyle = textStyle..merge(inspector_text_styles.link(colorScheme));
}

final TextStyle descriptionSearchMatchTextStyle =
descriptionTextStyle?.copyWith(
color: nodeDescriptionHighlightStyle?.color,
backgroundColor: nodeDescriptionHighlightStyle?.backgroundColor,
);

// TODO(jacobr): custom display for units, iterables, and padding.
children.add(Flexible(
child: buildDescription(
description,
descriptionTextStyle,
context,
colorScheme,
isProperty: true,
children.add(
Flexible(
child: RichText(
maxLines: 1,
text: TextSpan(
children: [
_buildHighlightedSearchPreview(
description,
searchValue,
descriptionTextStyle,
descriptionSearchMatchTextStyle,
),
],
),
),
),
));
);

if (diagnostic.level == DiagnosticLevel.fine &&
diagnostic.hasDefaultValue) {
Expand Down Expand Up @@ -369,32 +404,34 @@ class DiagnosticsNodeDescription extends StatelessWidget {
String textPreview,
String searchValue,
TextStyle textStyle,
TextStyle highlightTextStyle,
) {
TextStyle highlightTextStyle, {
bool addQuotes = false,
}) {
if (searchValue == null || searchValue.isEmpty) {
return TextSpan(
text: '"$textPreview"',
text: addQuotes ? '"$textPreview"' : textPreview,
style: textStyle,
);
}

if (textPreview.caseInsensitiveEquals(searchValue)) {
return TextSpan(
text: '"$textPreview"',
text: addQuotes ? '"$textPreview"' : textPreview,
style: highlightTextStyle,
);
}

final matches = searchValue.caseInsensitiveAllMatches(textPreview);
if (matches.isEmpty) {
return TextSpan(
text: '"$textPreview"',
text: addQuotes ? '"$textPreview"' : textPreview,
style: textStyle,
);
}

final quoteSpan = TextSpan(text: '"', style: textStyle);
final spans = <TextSpan>[quoteSpan];
final spans = <TextSpan>[];
if (addQuotes) spans.add(quoteSpan);
var previousItemEnd = 0;
for (final match in matches) {
if (match.start > previousItemEnd) {
Expand All @@ -416,7 +453,7 @@ class DiagnosticsNodeDescription extends StatelessWidget {
text: textPreview.substring(previousItemEnd, textPreview.length),
style: textStyle,
));
spans.add(quoteSpan);
if (addQuotes) spans.add(quoteSpan);

return TextSpan(children: spans);
}
Expand Down
23 changes: 18 additions & 5 deletions packages/devtools_app/lib/src/inspector/inspector_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,8 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>

/// Indicates whether search can be closed. The value is set to true when
/// search target type dropdown is displayed
/// TODO(https://github.com/flutter/devtools/issues/3489) use this variable when adding the scope dropdown
bool searchPreventClose = false;

SearchTargetType searchTarget = SearchTargetType.widget;

static const summaryTreeKey = Key('Summary Tree');
static const detailsTreeKey = Key('Details Tree');
static const minScreenWidthForTextBeforeScaling = 900.0;
Expand Down Expand Up @@ -125,8 +122,6 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
onLayoutExplorerSupported: _onLayoutExplorerSupported,
);

summaryTreeController.setSearchTarget(searchTarget);

addAutoDisposeListener(searchFieldFocusNode, () {
// Close the search once focus is lost and following conditions are met:
// 1. Search string is empty.
Expand Down Expand Up @@ -241,6 +236,24 @@ class InspectorScreenBodyState extends State<InspectorScreenBody>
shouldRequestFocus: searchVisible,
supportsNavigation: true,
onClose: _onSearchVisibleToggle,
prefix: ValueListenableBuilder(
valueListenable: summaryTreeController.searchTarget,
builder: (context, value, child) {
return DropdownButton<SearchTargetType>(
underline: const SizedBox(),
value: value,
items: SearchTargetType.values.map((e) {
return DropdownMenuItem(
child: Text(e.name),
value: e,
);
}).toList(),
onTap: () => searchPreventClose = !searchPreventClose,
onChanged: (value) =>
summaryTreeController.setSearchTarget(value),
);
},
),
),
),
Expanded(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,12 +313,17 @@ class InspectorTreeConfig {

enum SearchTargetType {
widget,
// TODO(https://github.com/flutter/devtools/issues/3489) implement other search scopes: details, all etc
details,
all,
}

extension SearchTargetTypeExtension on SearchTargetType {
String get name {
switch (this) {
case SearchTargetType.details:
return 'Details';
case SearchTargetType.all:
return 'All';
case SearchTargetType.widget:
default:
return 'Widget';
Expand Down
Loading