From 3b07d164bed6ed686c5cf22f671d55e09e61e84e Mon Sep 17 00:00:00 2001 From: abdullahmohammed Date: Wed, 9 Aug 2023 13:17:24 +0300 Subject: [PATCH] create a new mode for select with normal --- demo/ios/Flutter/AppFrameworkInfo.plist | 2 +- demo/ios/Podfile | 2 +- demo/ios/Podfile.lock | 16 ++++++++-------- demo/ios/Runner.xcodeproj/project.pbxproj | 13 ++++++++----- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- demo/ios/Runner/Info.plist | 4 ++++ .../.plugin_symlinks/url_launcher_linux | 2 +- example/ios/Flutter/AppFrameworkInfo.plist | 2 +- example/ios/Podfile | 2 +- example/ios/Runner.xcodeproj/project.pbxproj | 11 +++++++---- example/ios/Runner/Info.plist | 4 ++++ .../event/pluto_grid_cell_gesture_event.dart | 7 +++++-- lib/src/manager/state/grid_state.dart | 4 +++- lib/src/pluto_grid.dart | 10 +++++++++- .../example/ios/Flutter/Debug.xcconfig | 1 + .../example/ios/Flutter/Release.xcconfig | 1 + .../example/macos/Flutter/Flutter-Debug.xcconfig | 1 + .../macos/Flutter/Flutter-Release.xcconfig | 1 + .../Flutter/GeneratedPluginRegistrant.swift | 2 +- 19 files changed, 59 insertions(+), 28 deletions(-) diff --git a/demo/ios/Flutter/AppFrameworkInfo.plist b/demo/ios/Flutter/AppFrameworkInfo.plist index 9367d483e..9625e105d 100644 --- a/demo/ios/Flutter/AppFrameworkInfo.plist +++ b/demo/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 11.0 diff --git a/demo/ios/Podfile b/demo/ios/Podfile index 1e8c3c90a..88359b225 100644 --- a/demo/ios/Podfile +++ b/demo/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/demo/ios/Podfile.lock b/demo/ios/Podfile.lock index 0ec45db53..187670cd8 100644 --- a/demo/ios/Podfile.lock +++ b/demo/ios/Podfile.lock @@ -1,22 +1,22 @@ PODS: - Flutter (1.0.0) - - url_launcher (0.0.1): + - url_launcher_ios (0.0.1): - Flutter DEPENDENCIES: - Flutter (from `Flutter`) - - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) EXTERNAL SOURCES: Flutter: :path: Flutter - url_launcher: - :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: - Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c - url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4 -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c +PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 -COCOAPODS: 1.10.0 +COCOAPODS: 1.12.1 diff --git a/demo/ios/Runner.xcodeproj/project.pbxproj b/demo/ios/Runner.xcodeproj/project.pbxproj index 3280881b0..cce9367cf 100644 --- a/demo/ios/Runner.xcodeproj/project.pbxproj +++ b/demo/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -156,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -200,10 +200,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -214,6 +216,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -340,7 +343,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -414,7 +417,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -463,7 +466,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140cfd..3db53b6e1 100644 --- a/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux b/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux index e433ea04f..20937e7c8 120000 --- a/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux +++ b/demo/linux/flutter/ephemeral/.plugin_symlinks/url_launcher_linux @@ -1 +1 @@ -C:/Users/manek/AppData/Local/Pub/Cache/hosted/pub.dev/url_launcher_linux-3.0.2/ \ No newline at end of file +/Users/abdullahmohammed/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.5/ \ No newline at end of file diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 8d4492f97..9625e105d 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 9.0 + 11.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index 1e8c3c90a..88359b225 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 6edd238e7..cec40315d 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -171,10 +171,12 @@ /* Begin PBXShellScriptBuildPhase section */ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -185,6 +187,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -272,7 +275,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -349,7 +352,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -398,7 +401,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 27491e8a7..41603ef1b 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -43,5 +43,9 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/lib/src/manager/event/pluto_grid_cell_gesture_event.dart b/lib/src/manager/event/pluto_grid_cell_gesture_event.dart index 8714d59a4..a9b948354 100644 --- a/lib/src/manager/event/pluto_grid_cell_gesture_event.dart +++ b/lib/src/manager/event/pluto_grid_cell_gesture_event.dart @@ -57,6 +57,7 @@ class PlutoGridCellGestureEvent extends PlutoGridEvent { stateManager.setEditing(true); } else { stateManager.setCurrentCell(cell, rowIdx); + _selectMode(stateManager); } } @@ -151,16 +152,18 @@ class PlutoGridCellGestureEvent extends PlutoGridEvent { void _selectMode(PlutoGridStateManager stateManager) { switch (stateManager.mode) { - case PlutoGridMode.normal: case PlutoGridMode.readOnly: + case PlutoGridMode.normal: case PlutoGridMode.popup: return; case PlutoGridMode.select: + case PlutoGridMode.normalWithSelect: case PlutoGridMode.selectWithOneTap: if (stateManager.isCurrentCell(cell) == false) { stateManager.setCurrentCell(cell, rowIdx); - if (!stateManager.mode.isSelectWithOneTap) { + if (!stateManager.mode.isSelectWithOneTap || + !stateManager.mode.isNormalWithSelect) { return; } } diff --git a/lib/src/manager/state/grid_state.dart b/lib/src/manager/state/grid_state.dart index aff6f729b..6881c634e 100644 --- a/lib/src/manager/state/grid_state.dart +++ b/lib/src/manager/state/grid_state.dart @@ -158,6 +158,7 @@ mixin GridState implements IPlutoGridState { switch (mode) { case PlutoGridMode.normal: + case PlutoGridMode.normalWithSelect: case PlutoGridMode.readOnly: case PlutoGridMode.popup: selectingMode = this.selectingMode; @@ -189,7 +190,8 @@ mixin GridState implements IPlutoGridState { @override void handleOnSelected() { - if (mode.isSelectMode == true && onSelected != null) { + if (mode.isSelectMode == true && onSelected != null || + (mode.isNormalWithSelect == true && onSelected != null)) { onSelected!( PlutoGridOnSelectedEvent( row: currentRow, diff --git a/lib/src/pluto_grid.dart b/lib/src/pluto_grid.dart index 54d8e96ee..ecf44509a 100644 --- a/lib/src/pluto_grid.dart +++ b/lib/src/pluto_grid.dart @@ -1580,6 +1580,12 @@ enum PlutoGridMode { /// {@endtemplate} normal, + /// {@template pluto_grid_mode_select} + /// Mode for selecting one and edit cell from a specific list. + /// Tap a row or press Enter to select the current row. + /// + normalWithSelect, + /// {@template pluto_grid_mode_readOnly} /// Cell cannot be edited. /// To try to edit by force, it is possible as follows. @@ -1642,9 +1648,11 @@ enum PlutoGridMode { bool get isNormal => this == PlutoGridMode.normal; + bool get isNormalWithSelect => this == PlutoGridMode.normalWithSelect; + bool get isReadOnly => this == PlutoGridMode.readOnly; - bool get isEditableMode => isNormal || isPopup; + bool get isEditableMode => isNormal || isPopup || isNormalWithSelect; bool get isSelectMode => isSingleSelectMode || isMultiSelectMode; diff --git a/packages/pluto_grid_export/example/ios/Flutter/Debug.xcconfig b/packages/pluto_grid_export/example/ios/Flutter/Debug.xcconfig index 592ceee85..ec97fc6f3 100644 --- a/packages/pluto_grid_export/example/ios/Flutter/Debug.xcconfig +++ b/packages/pluto_grid_export/example/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/packages/pluto_grid_export/example/ios/Flutter/Release.xcconfig b/packages/pluto_grid_export/example/ios/Flutter/Release.xcconfig index 592ceee85..c4855bfe2 100644 --- a/packages/pluto_grid_export/example/ios/Flutter/Release.xcconfig +++ b/packages/pluto_grid_export/example/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/packages/pluto_grid_export/example/macos/Flutter/Flutter-Debug.xcconfig b/packages/pluto_grid_export/example/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b60..4b81f9b2d 100644 --- a/packages/pluto_grid_export/example/macos/Flutter/Flutter-Debug.xcconfig +++ b/packages/pluto_grid_export/example/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/pluto_grid_export/example/macos/Flutter/Flutter-Release.xcconfig b/packages/pluto_grid_export/example/macos/Flutter/Flutter-Release.xcconfig index c2efd0b60..5caa9d157 100644 --- a/packages/pluto_grid_export/example/macos/Flutter/Flutter-Release.xcconfig +++ b/packages/pluto_grid_export/example/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/packages/pluto_grid_export/example/macos/Flutter/GeneratedPluginRegistrant.swift b/packages/pluto_grid_export/example/macos/Flutter/GeneratedPluginRegistrant.swift index 416ef8457..9c4efdd9c 100644 --- a/packages/pluto_grid_export/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/packages/pluto_grid_export/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -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) {