Skip to content

Commit

Permalink
Merge pull request doonfrs#59 from Software365-info/custom_filters
Browse files Browse the repository at this point in the history
Added filterWidgetBuilder
  • Loading branch information
doonfrs authored Jul 23, 2024
2 parents 59ec734 + 95ecdd9 commit d26208e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
11 changes: 11 additions & 0 deletions lib/src/model/pluto_column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,17 @@ class PlutoColumn {
Icon? filterSuffixIcon;

///Set custom widget
@Deprecated("Use new filterWidgetBuilder to provide some parameters")
Widget? filterWidget;

Widget Function(
FocusNode focusNode,
TextEditingController controller,
bool enabled,
void Function(String changed) handleOnChanged,
PlutoGridStateManager stateManager,
)? filterWidgetBuilder;

/// Displays Hide column menu in the column context menu.
/// Valid only when [enableContextMenu] is activated.
bool enableHideColumnMenuItem;
Expand Down Expand Up @@ -236,12 +245,14 @@ class PlutoColumn {
this.filterHintText,
this.filterHintTextColor,
this.filterSuffixIcon,
@Deprecated("Use new filterWidgetBuilder to provide some parameters")
this.filterWidget,
this.enableHideColumnMenuItem = true,
this.enableSetColumnsMenuItem = true,
this.enableAutoEditing = false,
this.enableEditingMode = true,
this.hide = false,
this.filterWidgetBuilder,
}) : _key = UniqueKey(),
_checkReadOnly = checkReadOnly;

Expand Down
2 changes: 2 additions & 0 deletions lib/src/ui/columns/pluto_column_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ class PlutoColumnFilterState extends PlutoStateWithChange<PlutoColumnFilter> {
child: Padding(
padding: _padding,
child: widget.column.filterWidget ??
widget.column.filterWidgetBuilder?.call(_focusNode, _controller,
_enabled, _handleOnChanged, stateManager) ??
TextField(
focusNode: _focusNode,
controller: _controller,
Expand Down
2 changes: 1 addition & 1 deletion packages/pluto_grid_plus_export/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ environment:
dependencies:
flutter:
sdk: flutter
pluto_grid_plus: 8.4.1
pluto_grid_plus: 8.4.2
pluto_grid_plus_export:
path: ../
file_saver: ^0.2.12
Expand Down

0 comments on commit d26208e

Please sign in to comment.