Skip to content

Commit

Permalink
fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
bosskmk committed Mar 1, 2024
1 parent 5f9a11f commit 73898d4
Show file tree
Hide file tree
Showing 30 changed files with 580 additions and 149 deletions.
4 changes: 2 additions & 2 deletions lib/src/helper/filter_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@ class PlutoGridFilterPopupHeader extends StatelessWidget {
final SetFilterPopupHandler? handleAddNewFilter;

const PlutoGridFilterPopupHeader({
Key? key,
super.key,
this.stateManager,
this.configuration,
this.handleAddNewFilter,
}) : super(key: key);
});

void handleAddButton() {
handleAddNewFilter!(stateManager);
Expand Down
4 changes: 2 additions & 2 deletions lib/src/helper/pluto_key_manager_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class PlutoKeyManagerEvent {

bool get needsThrottle => isMoving || isTab || isPageUp || isPageDown;

bool get isKeyDownEvent => event.runtimeType == RawKeyDownEvent;
bool get isKeyDownEvent => event.runtimeType == KeyDownEvent;

bool get isKeyUpEvent => event.runtimeType == RawKeyUpEvent;
bool get isKeyUpEvent => event.runtimeType == KeyUpEvent;

bool get isMoving => isHorizontal || isVertical;

Expand Down
2 changes: 1 addition & 1 deletion lib/src/manager/pluto_grid_state_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class PlutoGridStateChangeNotifier extends PlutoChangeNotifier
/// stateManager.refRows.addAll(FilteredList(initialList: value));
/// stateManager.notifyListeners();
/// });
/// {@endtemplate}
/// ```
/// {@endtemplate}
class PlutoGridStateManager extends PlutoGridStateChangeNotifier {
PlutoGridStateManager({
required super.columns,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/manager/state/column_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,12 @@ mixin ColumnState implements IPlutoGridState {

@override
PlutoColumn? get currentColumn {
return currentCell == null ? null : currentCell!.column;
return currentCell?.column;
}

@override
String? get currentColumnField {
return currentCell == null ? null : currentCell!.column.field;
return currentCell?.column.field;
}

@override
Expand Down
4 changes: 1 addition & 3 deletions lib/src/plugin/pluto_lazy_pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,7 @@ class _PaginationWidgetState extends State<_PaginationWidget> {
? SystemMouseCursors.basic
: SystemMouseCursors.click,
),
..._pageNumbers
.map(_makeNumberButton)
.toList(growable: false),
..._pageNumbers.map(_makeNumberButton),
IconButton(
onPressed: _isLastPage ? null : _nextPage,
icon: const Icon(Icons.navigate_next),
Expand Down
4 changes: 1 addition & 3 deletions lib/src/plugin/pluto_pagination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,7 @@ class PlutoPaginationState extends _PlutoPaginationStateWithChange {
? SystemMouseCursors.basic
: SystemMouseCursors.click,
),
..._pageNumbers
.map(_makeNumberButton)
.toList(growable: false),
..._pageNumbers.map(_makeNumberButton),
IconButton(
onPressed: _isLastPage ? null : _nextPage,
icon: const Icon(Icons.navigate_next),
Expand Down
8 changes: 4 additions & 4 deletions lib/src/pluto_dual_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class PlutoDualGrid extends StatefulWidget {
this.onSelected,
this.display,
this.divider = const PlutoDualGridDivider(),
Key? key,
}) : super(key: key);
super.key,
});

static const double dividerWidth = 10;

Expand Down Expand Up @@ -262,8 +262,8 @@ class PlutoDualGridDividerWidget extends StatefulWidget {
required this.indicatorColor,
required this.draggingColor,
required this.dragCallback,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<PlutoDualGridDividerWidget> createState() =>
Expand Down
19 changes: 9 additions & 10 deletions lib/src/pluto_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ typedef PlutoRowColorCallback = Color Function(
/// Also, the popup to set the filter or column inside the grid is implemented through the setting of [PlutoGrid].
class PlutoGrid extends PlutoStatefulWidget {
const PlutoGrid({
Key? key,
super.key,
required this.columns,
required this.rows,
this.columnGroups,
Expand All @@ -76,7 +76,7 @@ class PlutoGrid extends PlutoStatefulWidget {
this.configuration = const PlutoGridConfiguration(),
this.notifierFilterResolver,
this.mode = PlutoGridMode.normal,
}) : super(key: key);
});

/// {@template pluto_grid_property_columns}
/// The [PlutoColumn] column is delivered as a list and can be added or deleted after grid creation.
Expand Down Expand Up @@ -1204,8 +1204,7 @@ class _GridContainer extends StatelessWidget {
const _GridContainer({
required this.stateManager,
required this.child,
Key? key,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -1368,17 +1367,17 @@ abstract class PlutoGridOnRowCheckedEvent {
/// Argument of [PlutoGrid.onRowChecked] callback when the checkbox of the row is tapped.
class PlutoGridOnRowCheckedOneEvent extends PlutoGridOnRowCheckedEvent {
const PlutoGridOnRowCheckedOneEvent({
required PlutoRow row,
required int rowIdx,
required bool? isChecked,
}) : super(row: row, rowIdx: rowIdx, isChecked: isChecked);
required PlutoRow super.row,
required int super.rowIdx,
required super.isChecked,
});
}

/// Argument of [PlutoGrid.onRowChecked] callback when all checkboxes of the column are tapped.
class PlutoGridOnRowCheckedAllEvent extends PlutoGridOnRowCheckedEvent {
const PlutoGridOnRowCheckedAllEvent({
bool? isChecked,
}) : super(row: null, rowIdx: null, isChecked: isChecked);
super.isChecked,
}) : super(row: null, rowIdx: null);
}

/// The argument of the [PlutoGrid.onRowDoubleTap] callback
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/pluto_currency_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class PlutoCurrencyCell extends StatefulWidget implements TextCell {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});

@override
PlutoCurrencyCellState createState() => PlutoCurrencyCellState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/pluto_date_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class PlutoDateCell extends StatefulWidget implements PopupCell {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});

@override
PlutoDateCellState createState() => PlutoDateCellState();
Expand Down
10 changes: 4 additions & 6 deletions lib/src/ui/cells/pluto_default_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ class PlutoDefaultCell extends PlutoStatefulWidget {
required this.rowIdx,
required this.row,
required this.stateManager,
Key? key,
}) : super(key: key);
super.key,
});

@override
State<PlutoDefaultCell> createState() => _PlutoDefaultCellState();
Expand Down Expand Up @@ -219,8 +219,7 @@ class _RowDragIconWidget extends StatelessWidget {
required this.stateManager,
required this.dragIcon,
required this.feedbackWidget,
Key? key,
}) : super(key: key);
});

List<PlutoRow> get _draggingRows {
if (stateManager.currentSelectingRows.isEmpty) {
Expand Down Expand Up @@ -422,8 +421,7 @@ class _DefaultCellWidget extends StatelessWidget {
required this.row,
required this.column,
required this.cell,
Key? key,
}) : super(key: key);
});

bool get _showText {
if (!stateManager.enabledRowGroups) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/pluto_number_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ class PlutoNumberCell extends StatefulWidget implements TextCell {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});

@override
PlutoNumberCellState createState() => PlutoNumberCellState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/pluto_select_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class PlutoSelectCell extends StatefulWidget implements PopupCell {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});

@override
PlutoSelectCellState createState() => PlutoSelectCellState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/pluto_text_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class PlutoTextCell extends StatefulWidget implements TextCell {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});

@override
PlutoTextCellState createState() => PlutoTextCellState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/pluto_time_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class PlutoTimeCell extends StatefulWidget implements PopupCell {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});

@override
PlutoTimeCellState createState() => PlutoTimeCellState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/popup_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ abstract class PopupCell extends StatefulWidget {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});
}

abstract class GridPopupProps {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/cells/text_cell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ abstract class TextCell extends StatefulWidget {
required this.cell,
required this.column,
required this.row,
Key? key,
}) : super(key: key);
super.key,
});
}

abstract class TextFieldProps {
Expand Down
32 changes: 13 additions & 19 deletions lib/src/ui/columns/pluto_column_title.dart
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ class PlutoGridColumnIcon extends StatelessWidget {
this.icon = Icons.dehaze,
this.ascendingIcon,
this.descendingIcon,
Key? key,
}) : super(key: key);
super.key,
});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -248,8 +248,7 @@ class _DraggableWidget extends StatelessWidget {
required this.stateManager,
required this.column,
required this.child,
Key? key,
}) : super(key: key);
});

void _handleOnPointerMove(PointerMoveEvent event) {
stateManager.eventManager!.addEvent(PlutoGridScrollUpdateEvent(
Expand Down Expand Up @@ -307,11 +306,10 @@ class _SortableWidget extends StatelessWidget {
final Widget child;

const _SortableWidget({
Key? key,
required this.stateManager,
required this.column,
required this.child,
}) : super(key: key);
});

void _onTap() {
stateManager.toggleSortColumn(column);
Expand Down Expand Up @@ -343,8 +341,7 @@ class _ColumnWidget extends StatelessWidget {
required this.stateManager,
required this.column,
required this.height,
Key? key,
}) : super(key: key);
});

EdgeInsets get padding =>
column.titlePadding ??
Expand All @@ -357,17 +354,16 @@ class _ColumnWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DragTarget<PlutoColumn>(
onWillAccept: (PlutoColumn? columnToDrag) {
return columnToDrag != null &&
columnToDrag.key != column.key &&
onWillAcceptWithDetails: (DragTargetDetails<PlutoColumn> details) {
return details.data.key != column.key &&
!stateManager.limitMoveColumn(
column: columnToDrag,
column: details.data,
targetColumn: column,
);
},
onAccept: (PlutoColumn columnToMove) {
if (columnToMove.key != column.key) {
stateManager.moveColumn(column: columnToMove, targetColumn: column);
onAcceptWithDetails: (DragTargetDetails<PlutoColumn> details) {
if (details.data.key != column.key) {
stateManager.moveColumn(column: details.data, targetColumn: column);
}
},
builder: (dragContext, candidate, rejected) {
Expand Down Expand Up @@ -419,8 +415,7 @@ class _ColumnWidget extends StatelessWidget {
class CheckboxAllSelectionWidget extends PlutoStatefulWidget {
final PlutoGridStateManager stateManager;

const CheckboxAllSelectionWidget({required this.stateManager, Key? key})
: super(key: key);
const CheckboxAllSelectionWidget({required this.stateManager, super.key});

@override
CheckboxAllSelectionWidgetState createState() =>
Expand Down Expand Up @@ -496,8 +491,7 @@ class _ColumnTextWidget extends PlutoStatefulWidget {
required this.stateManager,
required this.column,
required this.height,
Key? key,
}) : super(key: key);
});

@override
_ColumnTextWidgetState createState() => _ColumnTextWidgetState();
Expand Down
2 changes: 1 addition & 1 deletion lib/src/ui/miscellaneous/pluto_state_with_change.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
import 'package:pluto_grid/pluto_grid.dart';

abstract class PlutoStatefulWidget extends StatefulWidget {
const PlutoStatefulWidget({Key? key}) : super(key: key);
const PlutoStatefulWidget({super.key});
}

abstract class PlutoStateWithChange<T extends PlutoStatefulWidget>
Expand Down
6 changes: 3 additions & 3 deletions lib/src/ui/miscellaneous/pluto_visibility_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ class PlutoVisibilityLayoutRenderObjectElement extends RenderObjectElement

class PlutoVisibilityLayoutId extends LayoutId {
PlutoVisibilityLayoutId({
Key? key,
super.key,
required super.id,
required PlutoVisibilityLayoutChild child,
}) : super(key: key, child: child);
required PlutoVisibilityLayoutChild super.child,
});

PlutoVisibilityLayoutChild get layoutChild =>
child as PlutoVisibilityLayoutChild;
Expand Down
Loading

0 comments on commit 73898d4

Please sign in to comment.