Comments (8)
There's an early version of DataTable2 which allows setting N fixed left columns and M top rows. It can be found in the following branch: https://github.com/maxim-saplin/data_table_2/tree/sticky-row-col
from data_table_2.
For PaginatedDataTable2.
from data_table_2.
There're no guys, it is just me) Do you maen making them always visible just like header row.
from data_table_2.
There're no guys, it is just me) Do you mean making them always visible just like header row.
lol.
Yeah, if some columns are always visible, for instance, the serial # and timestamp, that will be quite convenient for table users.
from data_table_2.
It took some time to get this request) Reflected on the matter, though don't plan to approach that feature any time soon - that would require a solid overhaul of widgets.
Will keep that issue open, might be worked on some time in the future.
from data_table_2.
You can have this view with two DataTable2 Widgets wrapped with Row. (One of them includes fixed columns and rows the other one includes other data.) But both cannot be vertical scroll at the same time. A wrapper like ListView is needed. This time, the fixed row property is lost. I don't know, maybe you have a solution/idea for scroll.
from data_table_2.
Use Row
to split the screen in half, nest DataTable2
on the left and right, and then use ScrollNotification
to sync the scroll offset.
sync_scroll_controller_manager.dart
import 'package:flutter/material.dart';
class SyncScrollControllerManager {
final List<ScrollController> _registeredScrollControllers = [];
ScrollController? _scrollingController;
bool _scrollingActive = false;
void registerScrollController(ScrollController controller) {
_registeredScrollControllers.add(controller);
}
void unregisterScrollController(ScrollController controller) {
_registeredScrollControllers.remove(controller);
}
void processNotification(
ScrollNotification notification, ScrollController sender) {
if (notification is ScrollStartNotification && !_scrollingActive) {
_scrollingController = sender;
_scrollingActive = true;
return;
}
if (identical(sender, _scrollingController) && _scrollingActive) {
if (notification is ScrollEndNotification) {
_scrollingController = null;
_scrollingActive = false;
return;
}
if (notification is ScrollUpdateNotification) {
_registeredScrollControllers.forEach(
(controller) {
if (!identical(_scrollingController, controller)) {
if (controller.hasClients) {
controller.jumpTo(_scrollingController?.offset ?? 0);
}
}
},
);
return;
}
}
}
}
home.dart
import 'package:data_table_2/data_table_2.dart';
import 'package:flutter/material.dart';
import './sync_scroll_controller_manager.dart';
class Home extends StatelessWidget {
Home({Key? key}) : super(key: key);
final ScrollController _leftScrollController = ScrollController();
final ScrollController _rightScrollController = ScrollController();
final SyncScrollControllerManager _syncScroller =
SyncScrollControllerManager();
@override
Widget build(BuildContext context) {
_syncScroller.registerScrollController(_leftScrollController);
_syncScroller.registerScrollController(_rightScrollController);
return Scaffold(
appBar: AppBar(),
body: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
SizedBox( // first culumn
width: 100,
child: NotificationListener<ScrollNotification>(
child: DataTable2(
scrollController: _leftScrollController,
// ... more properties
),
onNotification: (ScrollNotification scrollInfo) { // listening scroll event
_syncScroller.processNotification(
scrollInfo, _leftScrollController);
return false;
},
),
),
Expanded( // second culumn
child: NotificationListener<ScrollNotification>(
child: DataTable2(
scrollController: _rightScrollController,
// ... more properties
),
onNotification: (ScrollNotification scrollInfo) { // listening scroll event
_syncScroller.processNotification(
scrollInfo, _rightScrollController);
return false;
},
),
)
],
));
}
}
from data_table_2.
Pushed to pub.dev
from data_table_2.
Related Issues (20)
- Hide empty rows HOT 2
- Update data row in AsyncDataTableSource HOT 1
- Hide scrollbar HOT 1
- How to have selected rows on table create with AsyncDataTableSource? HOT 1
- Center the header title is "impossible" due to the invisible sorting arrow HOT 4
- isHorizontalScrollBarVisible & isVerticalScrollBarVisible for AsyncPaginatedDataTable2 HOT 6
- Horizontal Scroll in Table with mouse wheel
- How do I make DataRow2 react to Theme changes? HOT 6
- DataRow2 decoration property improvement HOT 2
- Alignment center HOT 3
- Visibility of scroll indicator HOT 1
- Column is not handled by HorizontalScrollController
- Adding a TextField to DataRow2 and implementing onSubmitted doesn't listen to the Enter key next to the numeric keypad.
- InfiniteScroll And PullToRefresh implementation
- AsyncDataTableSource.selectAll() seems that not update _selectionRowKeys correctly
- DataTable2 with SliverMainAxisGroup/SliverToBoxAdapter non-zero flex but incoming height constraints are unbounded HOT 4
- DataCell onTap is slow / laggy HOT 1
- Only start stopwatch when dataTableShowLogs && kDebugMode is true HOT 1
- [Feature Request] Grouping HOT 1
- Support merged cells, colSpan rowSpan
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 data_table_2.