From ae124f63bdc8ca8905fd2abea24a610109510acc Mon Sep 17 00:00:00 2001 From: Tyler Christensen <31700358+Tylerchristensen100@users.noreply.github.com> Date: Thu, 14 Dec 2023 13:39:22 -0700 Subject: [PATCH 1/2] Added EnableClickCursor Made the changes Bambinoua made in order to get this working. Thank you Bambinoua! https://github.com/bosskmk/pluto_grid/pull/901/files --- lib/src/pluto_grid.dart | 12 +++-- lib/src/pluto_grid_configuration.dart | 13 +++++ lib/src/ui/pluto_base_row.dart | 69 +++++++++++++++++++-------- 3 files changed, 70 insertions(+), 24 deletions(-) diff --git a/lib/src/pluto_grid.dart b/lib/src/pluto_grid.dart index 54d8e96ee..f365974af 100644 --- a/lib/src/pluto_grid.dart +++ b/lib/src/pluto_grid.dart @@ -1224,10 +1224,14 @@ class _GridContainer extends StatelessWidget { decoration: BoxDecoration( color: style.gridBackgroundColor, borderRadius: style.gridBorderRadius, - border: Border.all( - color: style.gridBorderColor, - width: PlutoGridSettings.gridBorderWidth, - ), + // border: Border.all( + border: style.enableGridBorder + ? Border.all( + color: style.gridBorderColor, + width: PlutoGridSettings.gridBorderWidth, + //), + ) + : null, ), child: Padding( padding: const EdgeInsets.all(PlutoGridSettings.gridPadding), diff --git a/lib/src/pluto_grid_configuration.dart b/lib/src/pluto_grid_configuration.dart index 9b946b169..032813830 100644 --- a/lib/src/pluto_grid_configuration.dart +++ b/lib/src/pluto_grid_configuration.dart @@ -211,6 +211,7 @@ class PlutoGridStyleConfig { this.iconColor = Colors.black26, this.disabledIconColor = Colors.black12, this.menuBackgroundColor = Colors.white, + this.enableGridBorder = true, this.gridBorderColor = const Color(0xFFA1A5AE), this.borderColor = const Color(0xFFDDE2EB), this.activatedBorderColor = Colors.lightBlue, @@ -245,6 +246,7 @@ class PlutoGridStyleConfig { this.rowGroupEmptyIcon = Icons.noise_control_off, this.gridBorderRadius = BorderRadius.zero, this.gridPopupBorderRadius = BorderRadius.zero, + this.enableClickCursor = true, }); const PlutoGridStyleConfig.dark({ @@ -267,6 +269,7 @@ class PlutoGridStyleConfig { this.iconColor = Colors.white38, this.disabledIconColor = Colors.white12, this.menuBackgroundColor = const Color(0xFF414141), + this.enableGridBorder = true, this.gridBorderColor = const Color(0xFF666666), this.borderColor = const Color(0xFF222222), this.activatedBorderColor = const Color(0xFFFFFFFF), @@ -301,6 +304,7 @@ class PlutoGridStyleConfig { this.rowGroupEmptyIcon = Icons.noise_control_off, this.gridBorderRadius = BorderRadius.zero, this.gridPopupBorderRadius = BorderRadius.zero, + this.enableClickCursor = true, }); /// Enable borderShadow in [PlutoGrid]. @@ -369,6 +373,9 @@ class PlutoGridStyleConfig { /// BackgroundColor of Popup menu. (column menu) final Color menuBackgroundColor; + /// Enables the border around the [PlutoGrid]. + final bool enableGridBorder; + /// Set the border color of [PlutoGrid]. final Color gridBorderColor; @@ -447,6 +454,12 @@ class PlutoGridStyleConfig { /// Apply border radius to popup opened inside [PlutoGrid]. final BorderRadiusGeometry gridPopupBorderRadius; + + /// Changes the mouse cursor when pointer is overr the row. + /// + /// Applicable for web platform. + final bool enableClickCursor; + PlutoGridStyleConfig copyWith({ bool? enableGridBorderShadow, diff --git a/lib/src/ui/pluto_base_row.dart b/lib/src/ui/pluto_base_row.dart index 598098294..d8e288017 100644 --- a/lib/src/ui/pluto_base_row.dart +++ b/lib/src/ui/pluto_base_row.dart @@ -1,4 +1,5 @@ import 'package:collection/collection.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:pluto_grid/pluto_grid.dart'; @@ -84,30 +85,58 @@ class PlutoBaseRow extends StatelessWidget { enableRowColorAnimation: stateManager.configuration.style.enableRowColorAnimation, key: ValueKey('rowContainer_${row.key}'), - child: visibilityLayout - ? PlutoVisibilityLayout( - key: ValueKey('rowContainer_${row.key}_row'), - delegate: _RowCellsLayoutDelegate( - stateManager: stateManager, - columns: columns, - textDirection: stateManager.textDirection, - ), - scrollController: stateManager.scroll.bodyRowsHorizontal!, - initialViewportDimension: MediaQuery.of(dragContext).size.width, - children: columns.map(_makeCell).toList(growable: false), - ) - : CustomMultiChildLayout( - key: ValueKey('rowContainer_${row.key}_row'), - delegate: _RowCellsLayoutDelegate( - stateManager: stateManager, - columns: columns, - textDirection: stateManager.textDirection, + // child: visibilityLayout + // ? PlutoVisibilityLayout( + // key: ValueKey('rowContainer_${row.key}_row'), + // delegate: _RowCellsLayoutDelegate( + // stateManager: stateManager, + // columns: columns, + // textDirection: stateManager.textDirection, + // ), + // scrollController: stateManager.scroll.bodyRowsHorizontal!, + // initialViewportDimension: MediaQuery.of(dragContext).size.width, + // children: columns.map(_makeCell).toList(growable: false), + // ) + // : CustomMultiChildLayout( + // key: ValueKey('rowContainer_${row.key}_row'), + // delegate: _RowCellsLayoutDelegate( + // stateManager: stateManager, + // columns: columns, + // textDirection: stateManager.textDirection, + child: _maybeMouseRegion( + isWeb: kIsWeb && stateManager.configuration.style.enableClickCursor, + child: visibilityLayout + ? PlutoVisibilityLayout( + key: ValueKey('rowContainer_${row.key}_row'), + delegate: _RowCellsLayoutDelegate( + stateManager: stateManager, + columns: columns, + textDirection: stateManager.textDirection, + ), + scrollController: stateManager.scroll.bodyRowsHorizontal!, + initialViewportDimension: MediaQuery.of(dragContext).size.width, + children: columns.map(_makeCell).toList(growable: false), + ) + : CustomMultiChildLayout( + key: ValueKey('rowContainer_${row.key}_row'), + delegate: _RowCellsLayoutDelegate( + stateManager: stateManager, + columns: columns, + textDirection: stateManager.textDirection, + ), + children: columns.map(_makeCell).toList(growable: false), ), - children: columns.map(_makeCell).toList(growable: false), - ), + // children: columns.map(_makeCell).toList(growable: false), + // ), + ), ); } + Widget _maybeMouseRegion({required bool isWeb, required Widget child}) => + isWeb + ? MouseRegion(cursor: SystemMouseCursors.click, child: child) + : child; + @override Widget build(BuildContext context) { return DragTarget( From 52fec9f5bcfe8ae854552160a5a5f557eb5d5e31 Mon Sep 17 00:00:00 2001 From: Tyler Christensen <31700358+Tylerchristensen100@users.noreply.github.com> Date: Thu, 7 Mar 2024 10:23:16 -0700 Subject: [PATCH 2/2] Pluto Grid 8.0.0 Upgraded to Pluto Grid 8.0.0 Compatible with Flutter 3.19 Includes all new Pluto Grid 8.0.0 Features as well as the pointer feature provided in the original Enable Click Cursor fork --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 25d262df5..4a5394853 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ ## 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)