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) diff --git a/lib/src/pluto_grid.dart b/lib/src/pluto_grid.dart index 672b8e4cd..64c62fdda 100644 --- a/lib/src/pluto_grid.dart +++ b/lib/src/pluto_grid.dart @@ -1223,10 +1223,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 208d244dd..3c9a8b219 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'; @@ -80,30 +81,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(