Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create Spreadsheet in Flutter

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:

  1. The headers shoule be fixed.
  2. 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 ?

like image 927
Suresh Kumar Avatar asked Oct 16 '25 19:10

Suresh Kumar


1 Answers

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:

enter image description here

like image 78
MαπμQμαπkγVπ.0 Avatar answered Oct 19 '25 12:10

MαπμQμαπkγVπ.0