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 BUG ON WEB] #979

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
492 changes: 246 additions & 246 deletions CHANGELOG.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: A new Flutter project.

# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
publish_to: "none" # Remove this line if you wish to publish to pub.dev

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
Expand All @@ -18,7 +18,9 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1

environment:
sdk: ">=2.17.0 <3.0.0"
# sdk: ">=2.17.0 <3.0.0"
sdk: ">=3.1.3 <4.0.0"
# flutter: ">=3.10.0"

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand All @@ -32,7 +34,6 @@ dependencies:
pluto_grid:
path: ../


# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
Expand All @@ -53,7 +54,6 @@ dev_dependencies:

# The following section is specific to Flutter.
flutter:

# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
Expand Down
10 changes: 6 additions & 4 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 Down Expand Up @@ -94,15 +94,17 @@ class PlutoKeyManagerEvent {
}

bool get isShiftPressed {
return event.isShiftPressed;
return event.logicalKey.keyId == LogicalKeyboardKey.shift.keyId;
}

bool get isCtrlPressed {
return event.isMetaPressed || event.isControlPressed;
return event.logicalKey.keyId == LogicalKeyboardKey.meta.keyId ||
event.logicalKey.keyId == LogicalKeyboardKey.control.keyId;
}

bool get isAltPressed {
return event.isAltPressed;
return event.logicalKey.keyId ==
LogicalKeyboardKey.alt.keyId; // event.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/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
keyEvent.event.logicalKey.keyId == LogicalKeyboardKey.shift.keyId
? _moveCellPrevious(stateManager)
: _moveCellNext(stateManager);

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

if (enterKeyAction.isEditingAndMoveDown) {
if (keyEvent.event.isShiftPressed) {
if (keyEvent.event.logicalKey.keyId == LogicalKeyboardKey.shift.keyId) {
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 (keyEvent.event.logicalKey.keyId == LogicalKeyboardKey.shift.keyId) {
stateManager.moveCurrentCell(
PlutoMoveDirection.left,
force: true,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/pluto_grid.dart
Original file line number Diff line number Diff line change
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
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 @@ -62,7 +62,7 @@ mixin PopupCellState<T extends PopupCell> on State<T>
..text =
widget.column.formattedValueForDisplayInEditing(widget.cell.value);

textFocus = FocusNode(onKey: _handleKeyboardFocusOnKey);
textFocus = FocusNode(onKeyEvent: _handleKeyboardFocusOnKey);
}

@override
Expand Down Expand Up @@ -175,7 +175,7 @@ mixin PopupCellState<T extends PopupCell> on State<T>
}
}

KeyEventResult _handleKeyboardFocusOnKey(FocusNode node, RawKeyEvent event) {
KeyEventResult _handleKeyboardFocusOnKey(FocusNode node, KeyEvent event) {
var keyManager = PlutoKeyManagerEvent(
focusNode: node,
event: event,
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 @@ -52,7 +52,7 @@ mixin TextCellState<T extends TextCell> on State<T> implements TextFieldProps {
void initState() {
super.initState();

cellFocus = FocusNode(onKey: _handleOnKey);
cellFocus = FocusNode(onKeyEvent: _handleOnKey);

widget.stateManager.setTextEditingController(_textController);

Expand Down Expand Up @@ -172,7 +172,7 @@ mixin TextCellState<T extends TextCell> on State<T> implements TextFieldProps {
});
}

KeyEventResult _handleOnKey(FocusNode node, RawKeyEvent event) {
KeyEventResult _handleOnKey(FocusNode node, KeyEvent event) {
var keyManager = PlutoKeyManagerEvent(
focusNode: node,
event: event,
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/columns/pluto_column_filter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class PlutoColumnFilterState extends PlutoStateWithChange<PlutoColumnFilter> {
initState() {
super.initState();

_focusNode = FocusNode(onKey: _handleOnKey);
_focusNode = FocusNode(onKeyEvent: _handleOnKey);

widget.column.setFilterFocusNode(_focusNode);

Expand Down Expand Up @@ -145,7 +145,7 @@ class PlutoColumnFilterState extends PlutoStateWithChange<PlutoColumnFilter> {
stateManager.notifyListeners();
}

KeyEventResult _handleOnKey(FocusNode node, RawKeyEvent event) {
KeyEventResult _handleOnKey(FocusNode node, KeyEvent event) {
var keyManager = PlutoKeyManagerEvent(
focusNode: node,
event: event,
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions packages/pluto_grid_export/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import FlutterMacOS
import Foundation

import file_saver
import path_provider_macos
import path_provider_foundation
import printing

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
Expand Down
43 changes: 43 additions & 0 deletions packages/pluto_grid_export/example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
10 changes: 6 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
name: pluto_grid
description: PlutoGrid is a dataGrid that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS. (DataGrid, DataTable, Data Grid, Data Table, Sticky)
version: 7.0.2
version: 7.0.3
homepage: https://pluto.weblaze.dev
repository: https://github.com/bosskmk/pluto_grid

environment:
sdk: ">=2.17.0 <3.0.0"
flutter: ">=2.5.0"
sdk: ">=3.3.0-91.0.dev <4.0.0"
flutter: ">=1.17.0"
# sdk: ">=3.1.3 <4.0.0"
# flutter: ">=3.10.0"

dependencies:
flutter:
Expand All @@ -22,4 +24,4 @@ dev_dependencies:
sdk: flutter
mockito: ^5.4.0
build_runner: ^2.4.2
flutter_lints: ^2.0.1
flutter_lints: ^3.0.0
6 changes: 3 additions & 3 deletions test/mock/shared_mocks.mocks.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4557,7 +4557,7 @@ class MockFocusNode extends _i1.Mock implements _i3.FocusNode {
[context],
{
#onKeyEvent: onKeyEvent,
#onKey: onKey,
#onKeyEvent: onKey,
},
),
returnValue: _FakeFocusAttachment_32(
Expand All @@ -4567,7 +4567,7 @@ class MockFocusNode extends _i1.Mock implements _i3.FocusNode {
[context],
{
#onKeyEvent: onKeyEvent,
#onKey: onKey,
#onKeyEvent: onKey,
},
),
),
Expand All @@ -4578,7 +4578,7 @@ class MockFocusNode extends _i1.Mock implements _i3.FocusNode {
[context],
{
#onKeyEvent: onKeyEvent,
#onKey: onKey,
#onKeyEvent: onKey,
},
),
),
Expand Down
8 changes: 4 additions & 4 deletions test/src/helper/pluto_key_manager_event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ void main() {

late PlutoKeyManagerEvent? keyManagerEvent;

KeyEventResult callback(FocusNode node, RawKeyEvent event) {
KeyEventResult callback(FocusNode node, KeyEvent event) {
keyManagerEvent = PlutoKeyManagerEvent(
focusNode: node,
event: event,
Expand All @@ -28,12 +28,12 @@ void main() {

Future<void> buildWidget({
required WidgetTester tester,
required KeyEventResult Function(FocusNode, RawKeyEvent) callback,
required KeyEventResult Function(FocusNode, KeyEvent) callback,
}) async {
await tester.pumpWidget(MaterialApp(
home: FocusScope(
autofocus: true,
onKey: callback,
onKeyEvent: callback,
child: Focus(
focusNode: focusNode,
child: const SizedBox(width: 100, height: 100),
Expand Down Expand Up @@ -62,7 +62,7 @@ void main() {
(tester) async {
late PlutoKeyManagerEvent keyManagerEvent;

KeyEventResult callback(FocusNode node, RawKeyEvent event) {
KeyEventResult callback(FocusNode node, KeyEvent event) {
keyManagerEvent = PlutoKeyManagerEvent(
focusNode: node,
event: event,
Expand Down
Loading