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

Enable Click Cursor #1057

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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
12 changes: 8 additions & 4 deletions lib/src/pluto_grid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
13 changes: 13 additions & 0 deletions lib/src/pluto_grid_configuration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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({
Expand All @@ -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),
Expand Down Expand Up @@ -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].
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down
69 changes: 49 additions & 20 deletions lib/src/ui/pluto_base_row.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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<PlutoRow>(
Expand Down