From 0ab15d7c33c212abe83bd16b0a949db9e3c2f434 Mon Sep 17 00:00:00 2001 From: Stan Persoons <147701137+stan-at-work@users.noreply.github.com> Date: Sat, 11 Jan 2025 14:15:00 +0100 Subject: [PATCH] fix formatting for unrelated file changs --- example/lib/main.dart | 45 +++++++++---------- .../event/pluto_grid_row_hover_event.dart | 3 +- lib/src/manager/state/hovering_state.dart | 12 ++--- lib/src/manager/state/layout_state.dart | 6 +-- .../plugin/pluto_infinity_scroll_rows.dart | 3 +- lib/src/plugin/pluto_lazy_pagination.dart | 2 +- lib/src/pluto_grid_configuration.dart | 7 ++- lib/src/ui/cells/pluto_date_cell.dart | 3 +- .../state/hovering_row_state_test.dart | 8 ++-- 9 files changed, 45 insertions(+), 44 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index dad9d280d..78c17d30a 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -170,29 +170,28 @@ class _PlutoGridExamplePageState extends State { body: Container( padding: const EdgeInsets.all(15), child: PlutoGrid( - columns: columns, - rows: rows, - columnGroups: columnGroups, - onLoaded: (PlutoGridOnLoadedEvent event) { - stateManager = event.stateManager; - stateManager.setShowColumnFilter(true); - }, - onChanged: (PlutoGridOnChangedEvent event) { - print(event); - }, - configuration: const PlutoGridConfiguration(), - selectDateCallback: (PlutoCell cell, PlutoColumn column) async { - return showDatePicker( - context: context, - initialDate: PlutoDateTimeHelper.parseOrNullWithFormat( - cell.value, - column.type.date.format, - ) ?? DateTime.now(), - firstDate: column.type.date.startDate ?? DateTime(0), - lastDate: column.type.date.endDate ?? DateTime(9999) - ); - } - ), + columns: columns, + rows: rows, + columnGroups: columnGroups, + onLoaded: (PlutoGridOnLoadedEvent event) { + stateManager = event.stateManager; + stateManager.setShowColumnFilter(true); + }, + onChanged: (PlutoGridOnChangedEvent event) { + print(event); + }, + configuration: const PlutoGridConfiguration(), + selectDateCallback: (PlutoCell cell, PlutoColumn column) async { + return showDatePicker( + context: context, + initialDate: PlutoDateTimeHelper.parseOrNullWithFormat( + cell.value, + column.type.date.format, + ) ?? + DateTime.now(), + firstDate: column.type.date.startDate ?? DateTime(0), + lastDate: column.type.date.endDate ?? DateTime(9999)); + }), ), ); } diff --git a/lib/src/manager/event/pluto_grid_row_hover_event.dart b/lib/src/manager/event/pluto_grid_row_hover_event.dart index 4987d459f..6f9abbd75 100644 --- a/lib/src/manager/event/pluto_grid_row_hover_event.dart +++ b/lib/src/manager/event/pluto_grid_row_hover_event.dart @@ -12,7 +12,8 @@ class PlutoGridRowHoverEvent extends PlutoGridEvent { @override void handler(PlutoGridStateManager stateManager) { - bool enableRowHoverColor = stateManager.configuration.style.enableRowHoverColor; + bool enableRowHoverColor = + stateManager.configuration.style.enableRowHoverColor; // only change current hovered row index // if row hover color effect is enabled diff --git a/lib/src/manager/state/hovering_state.dart b/lib/src/manager/state/hovering_state.dart index 59b30b646..21abfe000 100644 --- a/lib/src/manager/state/hovering_state.dart +++ b/lib/src/manager/state/hovering_state.dart @@ -1,13 +1,9 @@ import 'package:pluto_grid_plus/pluto_grid_plus.dart'; abstract class IHoveringState { - int? get hoveredRowIdx; - void setHoveredRowIdx( - int? rowIdx, - {bool notify = true} - ); + void setHoveredRowIdx(int? rowIdx, {bool notify = true}); bool isRowIdxHovered(int rowIdx); } @@ -24,9 +20,9 @@ mixin HoveringState implements IPlutoGridState { @override void setHoveredRowIdx( - int? rowIdx, - {bool notify = true,} - ) { + int? rowIdx, { + bool notify = true, + }) { if (hoveredRowIdx == rowIdx) { return; } diff --git a/lib/src/manager/state/layout_state.dart b/lib/src/manager/state/layout_state.dart index 339dd710a..f9946e7c9 100644 --- a/lib/src/manager/state/layout_state.dart +++ b/lib/src/manager/state/layout_state.dart @@ -386,10 +386,8 @@ mixin LayoutState implements IPlutoGridState { double offset = 0; if (showFrozenColumn) { - offset += - leftFrozenColumnsWidth > 0 ? gridBorderWidth: 0; - offset += - rightFrozenColumnsWidth > 0 ? gridBorderWidth : 0; + offset += leftFrozenColumnsWidth > 0 ? gridBorderWidth : 0; + offset += rightFrozenColumnsWidth > 0 ? gridBorderWidth : 0; } return offset; diff --git a/lib/src/plugin/pluto_infinity_scroll_rows.dart b/lib/src/plugin/pluto_infinity_scroll_rows.dart index 756d0232f..13f340582 100644 --- a/lib/src/plugin/pluto_infinity_scroll_rows.dart +++ b/lib/src/plugin/pluto_infinity_scroll_rows.dart @@ -203,7 +203,8 @@ class _PlutoInfinityScrollRowsState extends State { if (!_isLast) { WidgetsBinding.instance.addPostFrameCallback((_) { if (scroll.hasClients && scroll.position.maxScrollExtent == 0) { - var lastRow = stateManager.rows.isNotEmpty ? stateManager.rows.last : null; + var lastRow = + stateManager.rows.isNotEmpty ? stateManager.rows.last : null; _update(lastRow); } }); diff --git a/lib/src/plugin/pluto_lazy_pagination.dart b/lib/src/plugin/pluto_lazy_pagination.dart index 6126c8cc4..4dd915d0d 100644 --- a/lib/src/plugin/pluto_lazy_pagination.dart +++ b/lib/src/plugin/pluto_lazy_pagination.dart @@ -180,7 +180,7 @@ class _PlutoLazyPaginationState extends State { ), ) .then((data) { - if(!mounted)return; + if (!mounted) return; stateManager.scroll.bodyRowsVertical!.jumpTo(0); stateManager.refRows.clearFromOriginal(); diff --git a/lib/src/pluto_grid_configuration.dart b/lib/src/pluto_grid_configuration.dart index c3bed1f8b..0c932002c 100644 --- a/lib/src/pluto_grid_configuration.dart +++ b/lib/src/pluto_grid_configuration.dart @@ -642,7 +642,8 @@ class PlutoGridStyleConfig { defaultColumnFilterPadding ?? this.defaultColumnFilterPadding, defaultCellPadding: defaultCellPadding ?? this.defaultCellPadding, columnTextStyle: columnTextStyle ?? this.columnTextStyle, - columnUnselectedColor: columnUnselectedColor ?? this.columnUnselectedColor, + columnUnselectedColor: + columnUnselectedColor ?? this.columnUnselectedColor, columnActiveColor: columnActiveColor ?? this.columnActiveColor, cellUnselectedColor: cellUnselectedColor ?? this.cellUnselectedColor, cellActiveColor: cellActiveColor ?? this.cellActiveColor, @@ -1784,12 +1785,16 @@ class PlutoGridLocaleText { enum PlutoGridRowSelectionCheckBoxBehavior { /// Selecting a row does nothing to its checkbox none, + /// Automatically enables the checkbox of the selected rows checkRow, + /// Automatically toggles the checkbox of the selected rows toggleCheckRow, + /// Automatically enabels the checkbox of a selected row (if another row is checked via select, the previous one is unchecked) singleRowCheck, + /// Automatically toggles the checkbox of a selected row (if another row is checked via select, the previous one is unchecked) toggleSingleRowCheck, } diff --git a/lib/src/ui/cells/pluto_date_cell.dart b/lib/src/ui/cells/pluto_date_cell.dart index cf8d3d628..1d197096b 100644 --- a/lib/src/ui/cells/pluto_date_cell.dart +++ b/lib/src/ui/cells/pluto_date_cell.dart @@ -52,7 +52,8 @@ class PlutoDateCellState extends State final date = await sm.selectDateCallback!(widget.cell, widget.column); isOpenedPopup = false; if (date != null) { - handleSelected(widget.column.type.date.dateFormat.format(date)); // Consider call onSelected + handleSelected(widget.column.type.date.dateFormat + .format(date)); // Consider call onSelected } } else { PlutoGridDatePicker( diff --git a/test/src/manager/state/hovering_row_state_test.dart b/test/src/manager/state/hovering_row_state_test.dart index da52c2540..e5a7ee6ab 100644 --- a/test/src/manager/state/hovering_row_state_test.dart +++ b/test/src/manager/state/hovering_row_state_test.dart @@ -38,7 +38,7 @@ void main() { group('setHoveredRowIdx', () { test( 'If the rowIdx passed as an argument is the same as' - 'hoveredRowIdx, then notifyListeners should not be called.', + 'hoveredRowIdx, then notifyListeners should not be called.', () { // given stateManager.setHoveredRowIdx(1); @@ -55,7 +55,7 @@ void main() { test( 'If the rowIdx passed as an argument is different from ' - 'hoveredRowIdx, notifyListeners should be called.', + 'hoveredRowIdx, notifyListeners should be called.', () { // given stateManager.setHoveredRowIdx(1); @@ -73,8 +73,8 @@ void main() { test( 'If the rowIdx passed as an argument is different from ' - 'hoveredRowIdx, but notify is false,' - 'notifyListeners should not be called.', + 'hoveredRowIdx, but notify is false,' + 'notifyListeners should not be called.', () { // given stateManager.setHoveredRowIdx(1);