I have three columns inside a row. The contents of the columns are generated by a listbuilder getting data from a database. Right now each column scrolls individually but I need them to scroll as one. Is this even possible in flutter or should I have made a gridview instead of three separate columns?
See https://stackoverflow.com/a/54879937/6447123
It works using a NotificationListener<ScrollNotification> plus an independent ScrollController for each scrollable Widget that should be synchronized.
You can use TrackingScrollController too
Related
I want to make a table with moving rows and columns inside, it also should be able to add a row or column with a button and delete it likewise. Internet only suggests Datatable or DataGrid, but I need to use the Table Widget in Flutter and Row and Column widgets if required. Can someone help me?
So I am implementing sort of a data table in flutter. it shows data based on time in days in rows and some other variant in columns. so naturally, first row is name of the days, and then in first column are values of the other variant. What properties of GridView.count can I use to make first row and column stay fixed when scrolling the grid. so that you can always see the data variants in screen.
I have gone over all properties of GridView.count but I can't find anything.
PS: I don't want to change to something else Like GridView.builder..... because the code is too far gone with how it renders the dynamic data in the rest of rows and columns.
Please Use data table instead of Grid
https://api.flutter.dev/flutter/material/DataTable-class.html.
Im going to create an excel like application in Flutter where the user can input a quantity to one of the cells and the app automatically calculate its values based on quantity.
Shall i use DataTables or Tables widget?
Both accept widgets as cell content like TextField, Slider or just Text. Anywhere there are some differences:
Feature
Table
DataTable
Checkbox column
no
showCheckBoxColumn
Set column width
columnWidth
no
Set row height
no
dataRowHeight
Sortable
no
integrated
If a cell with a no this does not mean, its not possible. The feature is just
not directly supported by the widget. In all cases sizes will computed according to Flutters rendering engine: constraints go down, sizes go up.
Anybody please feel free to add more content to above comparison.
I have a Table in Flutter and I want to have it expand it's row so that the table takes up the full space that's available for it. Given that TableRow isn't a widget I can't use Expanded on it the way I would for Widgets in a Column. Is there another way to get similar behavior for a Table?
According to my information, you need to use the Row and Columns widgets instead of the Table widget and in addition to using the Expanded widget, or you will need to set a specific height for each row separately and it cannot be Flexible, Using Container in TableRow children
How to create spreadhseet like Widget in Flutter (only for displaying data).
Currenly I have used Datatable but it does not support 1. fixed header 2. scrollable body.
I want following features:
The headers shoule be fixed.
the body should be scrollable (in both axes)
Currently my Datatable is inside a column > Expanded > SingleChildScrollView(horizontal) > SingleChildScrollView (vertical) > DataTable. Although I am able to scroll the complete Table in both the directions but 1. not simultaneously (i.e. it scrolls either horizontally or vertically), 2. Headers should not scroll, when scrolled vertically.
How can I achieve this ?
It seems that you need scroll controller that allows two or more scroll views to be in sync. In his case, you can use linked_scroll_controller plugin.
You can follow the example in this blog post for a step by step tutorial on how to achieve this.
Sample taken from the blog, check the complete source code here:
Here is an another package for this purpose: syncfusion_flutter_datagrid.
It has several features:
Editing - Allows users to edit cell values.
Sorting - Sort one or more columns in the ascending or descending order.
Stacked headers - Show unbound header rows.
Paging - Load data in segments.
Freeze Panes - Freeze the rows and columns when scrolling the grid.
And more, details in document
However, scrolling simultaneously is something different feature in this case.
You can try InteractiveViewer, but this not recommended in this case. Because both widgets, InteractiveViewer and DataTable, are very powerful widget that may build some conflict.