Skip to content

Commit

Permalink
Add optional width to column in PlutoColumnType.select
Browse files Browse the repository at this point in the history
  • Loading branch information
ramiro-ciocca committed Dec 13, 2024
1 parent 7945e0d commit 9f20732
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/src/model/pluto_column_type.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,16 @@ abstract class PlutoColumnType {
bool enableColumnFilter = false,
IconData? popupIcon = Icons.arrow_drop_down,
Widget Function(dynamic item)? builder,
double? width,
}) {
return PlutoColumnTypeSelect(
onItemSelected: onItemSelected ?? (event) {},
defaultValue: defaultValue,
items: items,
enableColumnFilter: enableColumnFilter,
popupIcon: popupIcon,
builder: builder);
builder: builder,
width: width);
}

/// Set as a date column.
Expand Down Expand Up @@ -367,6 +369,8 @@ class PlutoColumnTypeSelect
final bool enableColumnFilter;
final Function(PlutoGridOnSelectedEvent event) onItemSelected;

final double? width;

@override
final IconData? popupIcon;

Expand All @@ -376,7 +380,8 @@ class PlutoColumnTypeSelect
required this.items,
required this.enableColumnFilter,
this.popupIcon,
this.builder});
this.builder,
this.width});

@override
bool isValid(dynamic value) => items.contains(value) == true;
Expand Down
1 change: 1 addition & 0 deletions lib/src/ui/cells/pluto_select_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class PlutoSelectCellState extends State<PlutoSelectCell>

popupColumns = [
PlutoColumn(
width: widget.column.type.select.width ?? PlutoGridSettings.columnWidth,
title: widget.column.title,
field: widget.column.title,
readOnly: true,
Expand Down

0 comments on commit 9f20732

Please sign in to comment.