|
|
@ -9,7 +9,7 @@ class MyPlutoDropdownColumn extends PlutoColumn { |
|
|
|
required String field, |
|
|
|
required String field, |
|
|
|
this.optionsBuilder, |
|
|
|
this.optionsBuilder, |
|
|
|
double width = 200, |
|
|
|
double width = 200, |
|
|
|
bool checkable = false, |
|
|
|
bool enableRowChecked = false, |
|
|
|
bool enableSorting = false, |
|
|
|
bool enableSorting = false, |
|
|
|
bool autoSize = false, |
|
|
|
bool autoSize = false, |
|
|
|
PlutoColumnTextAlign textAlign = PlutoColumnTextAlign.start, |
|
|
|
PlutoColumnTextAlign textAlign = PlutoColumnTextAlign.start, |
|
|
@ -18,7 +18,7 @@ class MyPlutoDropdownColumn extends PlutoColumn { |
|
|
|
field: field, |
|
|
|
field: field, |
|
|
|
type: PlutoColumnType.text(defaultValue: ''), |
|
|
|
type: PlutoColumnType.text(defaultValue: ''), |
|
|
|
width: width, |
|
|
|
width: width, |
|
|
|
enableRowChecked: checkable, |
|
|
|
enableRowChecked: enableRowChecked, |
|
|
|
enableContextMenu: false, |
|
|
|
enableContextMenu: false, |
|
|
|
enableEditingMode: true, |
|
|
|
enableEditingMode: true, |
|
|
|
enableSorting: enableSorting, |
|
|
|
enableSorting: enableSorting, |
|
|
@ -33,14 +33,13 @@ class MyPlutoDropdownColumn extends PlutoColumn { |
|
|
|
final currentValue = rendererContext.row.cells[field]!.value.toString(); |
|
|
|
final currentValue = rendererContext.row.cells[field]!.value.toString(); |
|
|
|
|
|
|
|
|
|
|
|
return DropdownButton<String>( |
|
|
|
return DropdownButton<String>( |
|
|
|
value: options.contains(currentValue) |
|
|
|
value: |
|
|
|
|
|
|
|
options.contains(currentValue) |
|
|
|
? currentValue |
|
|
|
? currentValue |
|
|
|
: (options.isNotEmpty ? options.first : ''), |
|
|
|
: (options.isNotEmpty ? options.first : ''), |
|
|
|
items: options |
|
|
|
items: |
|
|
|
.map((value) => DropdownMenuItem( |
|
|
|
options |
|
|
|
value: value, |
|
|
|
.map((value) => DropdownMenuItem(value: value, child: Text(value))) |
|
|
|
child: Text(value), |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.toList(), |
|
|
|
.toList(), |
|
|
|
onChanged: (newValue) { |
|
|
|
onChanged: (newValue) { |
|
|
|
if (newValue != null) { |
|
|
|
if (newValue != null) { |
|
|
@ -58,10 +57,7 @@ class MyPlutoDropdownColumn extends PlutoColumn { |
|
|
|
iconSize: 24, |
|
|
|
iconSize: 24, |
|
|
|
isExpanded: true, |
|
|
|
isExpanded: true, |
|
|
|
underline: Container(), // 移除下划线 |
|
|
|
underline: Container(), // 移除下划线 |
|
|
|
style: TextStyle( |
|
|
|
style: const TextStyle(fontSize: 14, color: Colors.black87), |
|
|
|
fontSize: 14, |
|
|
|
|
|
|
|
color: Colors.black87, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
dropdownColor: Colors.white, |
|
|
|
dropdownColor: Colors.white, |
|
|
|
elevation: 2, |
|
|
|
elevation: 2, |
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|
borderRadius: BorderRadius.circular(4), |
|
|
|