Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code integrery #122

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 0 additions & 27 deletions .github/workflows/coverage.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"dart.lineLength": 80,
"files.eol": "\n",
}
"files.eol": "auto",
}
45 changes: 22 additions & 23 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,29 +170,28 @@ class _PlutoGridExamplePageState extends State<PlutoGridExamplePage> {
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));
}),
),
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/manager/event/pluto_grid_row_hover_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 4 additions & 8 deletions lib/src/manager/state/hovering_state.dart
Original file line number Diff line number Diff line change
@@ -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);
}
Expand All @@ -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;
}
Expand Down
6 changes: 2 additions & 4 deletions lib/src/manager/state/layout_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion lib/src/plugin/pluto_infinity_scroll_rows.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ class _PlutoInfinityScrollRowsState extends State<PlutoInfinityScrollRows> {
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);
}
});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/plugin/pluto_lazy_pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ class _PlutoLazyPaginationState extends State<PlutoLazyPagination> {
),
)
.then((data) {
if(!mounted)return;
if (!mounted) return;
stateManager.scroll.bodyRowsVertical!.jumpTo(0);

stateManager.refRows.clearFromOriginal();
Expand Down
7 changes: 6 additions & 1 deletion lib/src/pluto_grid_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/ui/cells/pluto_date_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class PlutoDateCellState extends State<PlutoDateCell>
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(
Expand Down
8 changes: 4 additions & 4 deletions test/src/manager/state/hovering_row_state_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand Down
Loading