Skip to content

Commit

Permalink
Merge pull request #1021 from bosskmk/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
bosskmk authored Mar 1, 2024
2 parents 44d2317 + 2b0d6c4 commit 3a2e741
Show file tree
Hide file tree
Showing 45 changed files with 774 additions and 260 deletions.
140 changes: 88 additions & 52 deletions CHANGELOG.md

Large diffs are not rendered by default.

26 changes: 24 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,46 @@
## PlutoGrid for flutter - v7.0.2
## PlutoGrid for flutter - v8.0.0

[![Awesome Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg)](https://github.com/Solido/awesome-flutter)
[![codecov](https://codecov.io/gh/bosskmk/pluto_grid/branch/master/graph/badge.svg)](https://codecov.io/gh/bosskmk/pluto_grid)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

<br>

`PlutoGrid` is a `DataGrid` that can be operated with the keyboard in various situations such as moving cells.
`PlutoGrid` is a `DataGrid` that can be operated with the keyboard in various situations such as
moving cells.
It is developed with priority on the web and desktop.
Improvements such as UI on mobile are being considered.
If you comment on an issue, mobile improvements can be made quickly.

<br>

### [Demo Web](https://bosskmk.github.io/pluto_grid/build/web/index.html)

> You can try out various functions and usage methods right away.
> All features provide example code.
<br>

### [Pub.Dev](https://pub.dev/packages/pluto_grid)

> Check out how to install from the official distribution site.
<br>

### [Documentation](https://pluto.weblaze.dev/series/pluto-grid)

> The documentation has more details.
<br>

### [ChangeLog](https://github.com/bosskmk/pluto_grid/blob/master/CHANGELOG.md)

> Please note the changes when changing the version of PlutoGrid you are using.
<br>

### [Issue](https://github.com/bosskmk/pluto_grid/issues)

> Report any questions or errors.
<br>
Expand All @@ -50,59 +56,71 @@ If you comment on an issue, mobile improvements can be made quickly.
### Screenshots

#### Change the color of the rows or make the cells look the way you want them.

![PlutoGrid Normal](https://bosskmk.github.io/images/pluto_grid/2.8.0/pluto_grid_2.8.0_01.png)

<br>

#### Date type input can be easily selected by pop-up and keyboard.

![PlutoGrid Select Popup](https://bosskmk.github.io/images/pluto_grid/3.1.0/pluto_grid_3.1.0_01.png)

<br>

#### The selection type column can be easily selected using a pop-up and keyboard.

![PlutoGrid Select Date](https://bosskmk.github.io/images/pluto_grid/2.8.0/pluto_grid_2.8.0_03.png)

<br>

#### Group columns by desired depth.

![PlutoGrid Cell renderer](https://bosskmk.github.io/images/pluto_grid/2.8.0/pluto_grid_2.8.0_04.png)

<br>

#### Grid can be expressed in dark mode or a combination of desired colors. Also, freeze the column, move it by dragging, or adjust the size.

![PlutoGrid Multi select](https://bosskmk.github.io/images/pluto_grid/2.8.0/pluto_grid_2.8.0_05.png)

<br>

### Example

Generate the data to be used in the grid.

```dart
List<PlutoColumn> columns = [
/// Text Column definition
PlutoColumn(
title: 'text column',
field: 'text_field',
type: PlutoColumnType.text(),
),
/// Number Column definition
PlutoColumn(
title: 'number column',
field: 'number_field',
type: PlutoColumnType.number(),
),
/// Select Column definition
PlutoColumn(
title: 'select column',
field: 'select_field',
type: PlutoColumnType.select(['item1', 'item2', 'item3']),
),
/// Datetime Column definition
PlutoColumn(
title: 'date column',
field: 'date_field',
type: PlutoColumnType.date(),
),
/// Time Column definition
PlutoColumn(
title: 'time column',
Expand Down Expand Up @@ -143,6 +161,7 @@ List<PlutoRow> rows = [
```

Create a grid with the data created above.

```dart
@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -173,6 +192,7 @@ Widget build(BuildContext context) {

| Flutter | PlutoGrid |
|------------------|-----------------------|
| 3.19.0 or higher | 8.0.0 or higher |
| 3.10.0 or higher | 7.0.0 or higher |
| 3.7.0 or higher | 6.0.0 or higher |
| 3.3.0 or higher | 5.0.6 or higher |
Expand All @@ -184,7 +204,9 @@ For other versions, contact the issue
<br>

### Related packages

> develop packages that make it easy to develop admin pages or CMS with Flutter.
* [PlutoGrid](https://github.com/bosskmk/pluto_grid)
* [PlutoMenuBar](https://github.com/bosskmk/pluto_menu_bar)
* [PlutoLayout](https://github.com/bosskmk/pluto_layout)
Expand Down
1 change: 1 addition & 0 deletions demo/linux/flutter/ephemeral/.plugin_symlinks/printing
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
13 changes: 7 additions & 6 deletions lib/src/helper/pluto_key_manager_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter/services.dart';

class PlutoKeyManagerEvent {
FocusNode focusNode;
RawKeyEvent event;
KeyEvent event;

PlutoKeyManagerEvent({
required this.focusNode,
Expand All @@ -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 Expand Up @@ -94,15 +94,16 @@ class PlutoKeyManagerEvent {
}

bool get isShiftPressed {
return event.isShiftPressed;
return HardwareKeyboard.instance.isShiftPressed;
}

bool get isCtrlPressed {
return event.isMetaPressed || event.isControlPressed;
return HardwareKeyboard.instance.isMetaPressed ||
HardwareKeyboard.instance.isControlPressed;
}

bool get isAltPressed {
return event.isAltPressed;
return HardwareKeyboard.instance.isAltPressed;
}

bool get isModifierPressed {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/manager/pluto_grid_key_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class PlutoGridKeyManager {
if (stateManager.configuration.shortcut.handle(
keyEvent: keyEvent,
stateManager: stateManager,
state: RawKeyboard.instance,
state: HardwareKeyboard.instance,
)) {
return;
}
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
2 changes: 1 addition & 1 deletion lib/src/manager/shortcut/pluto_grid_shortcut.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PlutoGridShortcut {
bool handle({
required PlutoKeyManagerEvent keyEvent,
required PlutoGridStateManager stateManager,
required RawKeyboard state,
required HardwareKeyboard state,
}) {
for (final action in actions.entries) {
if (action.key.accepts(keyEvent.event, state)) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/manager/shortcut/pluto_grid_shortcut_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class PlutoGridActionDefaultTab extends PlutoGridShortcutAction {

final saveIsEditing = stateManager.isEditing;

keyEvent.event.isShiftPressed
HardwareKeyboard.instance.isShiftPressed
? _moveCellPrevious(stateManager)
: _moveCellNext(stateManager);

Expand Down Expand Up @@ -408,7 +408,7 @@ class PlutoGridActionDefaultEnterKey extends PlutoGridShortcutAction {
}

if (enterKeyAction.isEditingAndMoveDown) {
if (keyEvent.event.isShiftPressed) {
if (HardwareKeyboard.instance.isShiftPressed) {
stateManager.moveCurrentCell(
PlutoMoveDirection.up,
notify: false,
Expand All @@ -420,7 +420,7 @@ class PlutoGridActionDefaultEnterKey extends PlutoGridShortcutAction {
);
}
} else if (enterKeyAction.isEditingAndMoveRight) {
if (keyEvent.event.isShiftPressed) {
if (HardwareKeyboard.instance.isShiftPressed) {
stateManager.moveCurrentCell(
PlutoMoveDirection.left,
force: true,
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
23 changes: 11 additions & 12 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 @@ -593,7 +593,7 @@ class PlutoGridState extends PlutoStateWithChange<PlutoGrid> {
}
}

KeyEventResult _handleGridFocusOnKey(FocusNode focusNode, RawKeyEvent event) {
KeyEventResult _handleGridFocusOnKey(FocusNode focusNode, KeyEvent event) {
if (_keyManager.eventResult.isSkip == false) {
_keyManager.subject.add(PlutoKeyManagerEvent(
focusNode: focusNode,
Expand All @@ -608,7 +608,7 @@ class PlutoGridState extends PlutoStateWithChange<PlutoGrid> {
Widget build(BuildContext context) {
return FocusScope(
onFocusChange: _stateManager.setKeepFocus,
onKey: _handleGridFocusOnKey,
onKeyEvent: _handleGridFocusOnKey,
child: _GridContainer(
stateManager: _stateManager,
child: LayoutBuilder(
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
Loading

1 comment on commit 3a2e741

@yunchiri
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow 다시 작업하시는 겁니까?

Please sign in to comment.