Comments (4)
Hi
that's enough, thanks :)
void handleCurrentSelectionState() {
...
print(stateManager.currentRow.cells.values.first.value); //in first column is Google sheet row number
}
I'm working on an application to easily filter data from google sheets
onCurrentSelected can be nice when you have time
from pluto_grid.
Do you want to receive an event every time the currently selected cell (and Row, Column) changes?
If so, you can achieve it with the example code below.
If this is not the case, please reply again.
import 'package:flutter/material.dart';
import 'package:pluto_grid/pluto_grid.dart';
import '../../dummy_data/development.dart';
import '../../widget/pluto_example_button.dart';
import '../../widget/pluto_example_screen.dart';
class MovingScreen extends StatefulWidget {
static const routeName = 'feature/moving';
@override
_MovingScreenState createState() => _MovingScreenState();
}
class _MovingScreenState extends State<MovingScreen> {
List<PlutoColumn> columns;
List<PlutoRow> rows;
PlutoStateManager stateManager;
@override
void dispose() {
stateManager.removeListener(handleCurrentSelectionState);
super.dispose();
}
@override
void initState() {
super.initState();
final dummyDate = DummyData(10, 100);
columns = dummyDate.columns;
rows = dummyDate.rows;
}
void handleCurrentSelectionState() {
print(stateManager.currentCell.value);
print(stateManager.currentRow.key);
print(stateManager.currentColumn.title);
}
@override
Widget build(BuildContext context) {
return PlutoExampleScreen(
title: 'Moving',
topTitle: 'Moving',
topContents: [
Text(
'Change the current cell position with the arrow keys, enter key, and tab key.'),
],
topButtons: [
PlutoExampleButton(
url:
'https://github.com/bosskmk/pluto_grid/blob/master/example/lib/screen/feature/moving_screen.dart',
),
],
body: PlutoGrid(
columns: columns,
rows: rows,
onChanged: (PlutoOnChangedEvent event) {
print(event);
},
onLoaded: (PlutoOnLoadedEvent event) {
stateManager = event.stateManager;
stateManager.addListener(handleCurrentSelectionState);
},
),
);
}
}
from pluto_grid.
If you want to add it as a feature, I will.
I'll add it with onCurrentSelected or whatever name you suggest.
from pluto_grid.
Sorry to add a followup question here even though the ticket has been closed. I found register a callback via addListener() not quite working the way I wanted. My pluto grid is situated near the bottom of my phone screen, when I edit a cell, the popup keyboard will block the view, hence I want to scroll the grid into view upwards only once when I start editing the cell, however I found the callback was hit multiple times (3 times to be exact) when I tap a cell to edit. Following code is what's in my callback:
void handleCheckedRow() {
if (_maintenanceHistStateMgr.isEditing) {
Scrollable.ensureVisible(_maintenanceHistkey.currentContext!); <== this is the line that got hit 3 times of the same cell
}
}
What I noticed is that only the 3rd call to the callback, the grid will briefly move upwards momentary after I finished editing. Not sure why the grid didn't move the first time. BTW, _maintenanceHistkey is the key to the grid parent.
from pluto_grid.
Related Issues (20)
- [Help] - How to detect cell value change without "exiting" the cell HOT 2
- [Help] How to customize the keyboard buttons for numbers value in android HOT 2
- [Help] Copy the content of selecting cell to the clipboard HOT 2
- [Bug] HOT 2
- [Help] Why PlutoDualGridProps onSelected Callback? HOT 2
- TextField Focus issue HOT 2
- [Help] How to disable (showFilterPopup)?[Help] HOT 2
- Show some empty space on the top of first row only in mobile phone HOT 6
- How to move to the next cell automatically when press done button from the android keyboard? HOT 2
- [Feature] Checkbox Column does not respect checkboxTheme of ThemeData HOT 2
- [Issue] date format HOT 2
- [Help] Inline editing date, time or select column HOT 2
- Reagrding Conflict with Pluto_Grid_Plus with Pluto_Grid [Help] HOT 2
- [Help] Is there is a way to remove this extra space/footer HOT 2
- [Help] how to set gridBorderWidth HOT 3
- [Feature] clipped new line should count as overflow HOT 2
- [Help]how to set color for icon of a specific item.? HOT 2
- Search HOT 1
- cellColorCallback [Feature] HOT 1
- [Feature] Support for merging cells, colSpan rowSpan HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pluto_grid.