From 9f207328d599a5ba22e3e6e111b272256e58ab4c Mon Sep 17 00:00:00 2001 From: "ciocca@gmail.com" Date: Thu, 12 Dec 2024 22:31:37 -0300 Subject: [PATCH] Add optional width to column in PlutoColumnType.select --- lib/src/model/pluto_column_type.dart | 9 +++++++-- lib/src/ui/cells/pluto_select_cell.dart | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/src/model/pluto_column_type.dart b/lib/src/model/pluto_column_type.dart index 68256a852..01cb713cf 100644 --- a/lib/src/model/pluto_column_type.dart +++ b/lib/src/model/pluto_column_type.dart @@ -99,6 +99,7 @@ abstract class PlutoColumnType { bool enableColumnFilter = false, IconData? popupIcon = Icons.arrow_drop_down, Widget Function(dynamic item)? builder, + double? width, }) { return PlutoColumnTypeSelect( onItemSelected: onItemSelected ?? (event) {}, @@ -106,7 +107,8 @@ abstract class PlutoColumnType { items: items, enableColumnFilter: enableColumnFilter, popupIcon: popupIcon, - builder: builder); + builder: builder, + width: width); } /// Set as a date column. @@ -367,6 +369,8 @@ class PlutoColumnTypeSelect final bool enableColumnFilter; final Function(PlutoGridOnSelectedEvent event) onItemSelected; + final double? width; + @override final IconData? popupIcon; @@ -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; diff --git a/lib/src/ui/cells/pluto_select_cell.dart b/lib/src/ui/cells/pluto_select_cell.dart index c31e454ac..f96f649a7 100644 --- a/lib/src/ui/cells/pluto_select_cell.dart +++ b/lib/src/ui/cells/pluto_select_cell.dart @@ -64,6 +64,7 @@ class PlutoSelectCellState extends State popupColumns = [ PlutoColumn( + width: widget.column.type.select.width ?? PlutoGridSettings.columnWidth, title: widget.column.title, field: widget.column.title, readOnly: true,