-
Notifications
You must be signed in to change notification settings - Fork 390
[Property Editor] Can filter properties in the Property Editor #9022
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
Changes from 11 commits
3cc7607
9b3590a
9e53736
3974a83
e56bf7e
322a493
cdf5b39
6700aa3
34a2c73
a92d1d7
d46c813
fd60357
72a2bb2
c028575
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -8,6 +8,7 @@ import 'package:flutter/material.dart'; | |||
|
|
||||
| import '../../../shared/primitives/utils.dart'; | ||||
| import '../../../shared/ui/common_widgets.dart'; | ||||
| import '../../../shared/ui/filter.dart'; | ||||
| import 'property_editor_controller.dart'; | ||||
| import 'property_editor_inputs.dart'; | ||||
| import 'property_editor_types.dart'; | ||||
|
|
@@ -25,6 +26,7 @@ class PropertyEditorView extends StatelessWidget { | |||
| controller.editorClient.editArgumentMethodName, | ||||
| controller.editorClient.editableArgumentsMethodName, | ||||
| controller.editableWidgetData, | ||||
| controller.filteredData, | ||||
| ], | ||||
| builder: (_, values, _) { | ||||
| final editArgumentMethodName = values.first as String?; | ||||
|
|
@@ -42,7 +44,8 @@ class PropertyEditorView extends StatelessWidget { | |||
| ); | ||||
| } | ||||
|
|
||||
| final (:args, :name, :documentation) = editableWidgetData; | ||||
| final filteredProperties = values.fourth as List<EditableProperty>; | ||||
| final (:properties, :name, :documentation) = editableWidgetData; | ||||
| return Column( | ||||
| crossAxisAlignment: CrossAxisAlignment.start, | ||||
| children: [ | ||||
|
|
@@ -51,11 +54,11 @@ class PropertyEditorView extends StatelessWidget { | |||
| name: name, | ||||
| documentation: documentation, | ||||
| ), | ||||
| args.isEmpty | ||||
| properties.isEmpty | ||||
| ? _NoEditablePropertiesMessage(name: name) | ||||
| : _PropertiesList( | ||||
| editableProperties: args.map(argToProperty).nonNulls.toList(), | ||||
| editProperty: controller.editArgument, | ||||
| controller: controller, | ||||
| editableProperties: filteredProperties, | ||||
| ), | ||||
| ], | ||||
| ); | ||||
|
|
@@ -66,12 +69,12 @@ class PropertyEditorView extends StatelessWidget { | |||
|
|
||||
| class _PropertiesList extends StatefulWidget { | ||||
| const _PropertiesList({ | ||||
| required this.controller, | ||||
| required this.editableProperties, | ||||
| required this.editProperty, | ||||
| }); | ||||
|
|
||||
| final PropertyEditorController controller; | ||||
| final List<EditableProperty> editableProperties; | ||||
| final EditArgumentFunction editProperty; | ||||
|
|
||||
| static const defaultItemPadding = borderPadding; | ||||
| static const denseItemPadding = defaultItemPadding / 2; | ||||
|
|
@@ -99,10 +102,13 @@ class _PropertiesListState extends State<_PropertiesList> { | |||
| Widget build(BuildContext context) { | ||||
| return Column( | ||||
| children: <Widget>[ | ||||
| _FilterControls(controller: widget.controller), | ||||
| if (widget.editableProperties.isEmpty) | ||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what if editableProperties is empty and the filter query is empty? In this case, this message may not make sense
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is actually handled before we get here - if there are no editable properties at all we display a message instead of rendering the Line 58 in d46c813
|
||||
| const _NoMatchingPropertiesMessage(), | ||||
| for (final property in widget.editableProperties) | ||||
| _EditablePropertyItem( | ||||
| property: property, | ||||
| editProperty: widget.editProperty, | ||||
| editProperty: widget.controller.editArgument, | ||||
| ), | ||||
| ].joinWith(const PaddedDivider.noPadding()), | ||||
| ); | ||||
|
|
@@ -142,6 +148,29 @@ class _EditablePropertyItem extends StatelessWidget { | |||
| } | ||||
| } | ||||
|
|
||||
| class _FilterControls extends StatelessWidget { | ||||
| const _FilterControls({required this.controller}); | ||||
|
|
||||
| final PropertyEditorController controller; | ||||
|
|
||||
| @override | ||||
| Widget build(BuildContext context) { | ||||
| return Padding( | ||||
| padding: const EdgeInsets.all(_PropertiesList.defaultItemPadding), | ||||
| child: Row( | ||||
| children: [ | ||||
| Expanded( | ||||
| child: StandaloneFilterField<EditableProperty>( | ||||
| controller: controller, | ||||
| filteredItem: 'property', | ||||
| ), | ||||
| ), | ||||
| ], | ||||
| ), | ||||
| ); | ||||
| } | ||||
| } | ||||
|
|
||||
| class _PropertyLabels extends StatelessWidget { | ||||
| const _PropertyLabels({required this.property}); | ||||
|
|
||||
|
|
@@ -289,6 +318,15 @@ class _NoEditablePropertiesMessage extends StatelessWidget { | |||
| } | ||||
| } | ||||
|
|
||||
| class _NoMatchingPropertiesMessage extends StatelessWidget { | ||||
| const _NoMatchingPropertiesMessage(); | ||||
|
|
||||
| @override | ||||
| Widget build(BuildContext context) { | ||||
| return const Text('No properties matching the current filter.'); | ||||
| } | ||||
| } | ||||
|
|
||||
| class _WidgetNameAndDocumentation extends StatelessWidget { | ||||
| const _WidgetNameAndDocumentation({required this.name, this.documentation}); | ||||
|
|
||||
|
|
@@ -320,7 +358,7 @@ class _WidgetNameAndDocumentation extends StatelessWidget { | |||
| ), | ||||
| ], | ||||
| ), | ||||
| const PaddedDivider(), | ||||
| const PaddedDivider(padding: EdgeInsets.all(noPadding)), | ||||
|
elliette marked this conversation as resolved.
Outdated
|
||||
| ], | ||||
| ); | ||||
| } | ||||
|
|
||||
Uh oh!
There was an error while loading. Please reload this page.