Fixed column and row header for DataTable on Flutter Dart

前端 未结 2 1958
南方客
南方客 2020-12-19 12:11

I\'ve build a table on Flutter Dart using DataTable. This table is very large, and I\'m using both Vertical and Horizontal scrolling. When scrolling I lose refe

2条回答
  •  不知归路
    2020-12-19 12:58

    Good afternoon, I got your code and I'm adapting for testing, I created a dynamic list for _fixedColCells

    worked perfectly,

    var disciplina =[];
         for (var c = 0; c <= notas?.length -1; c++) {
         disciplina.add(notas[c].disciplina.toString())  ;
        }
    

    ..... fixedColCells: disciplina, ....

    _fixedRowCells is a fixed String list, so I used the same variable just by hitting cell labels

    but _rowsCells, which by the statement is a >, set the routine is equal to the fixed variable of the example, but gives error.

    type List is not a subtype of type List>

    and print output basically equals fixed variable _rowsCells example, see below

    [[8.5, 7.0, 6.5, 0.0, 5.5, 5.5, 5.5, 0.0, 0.0, 5.5, ATIVA], 
    [8.5, 6.0, 8.5, 0.0, 6.0, 6.0, 6.0, 0.0, 0.0, 6.0, ATIVA], 
    [7.5, 7.5, 6.0, 0.0, 5.5, 5.5, 5.5, 0.0, 0.0, 5.5, ATIVA], 
    [9.5, 9.0, 8.0, 0.0, 6.5, 6.5, 6.5, 0.0, 0.0, 6.5, ATIVA], 
    [7.5, 6.0, 8.0, 0.0, 5.5, 5.5, 5.5, 0.0, 0.0, 5.5, ATIVA], 
    [10.0, 7.5, 8.5, 0.0, 6.5, 6.5, 6.5, 0.0, 0.0, 6.5, ATIVA], 
    [9.0, 9.5, 8.0, 0.0, 6.5, 6.5, 6.5, 0.0, 0.0, 6.5, ATIVA], 
    [10.0, 10.0, 10.0, 0.0, 7.5, 7.5, 7.5, 0.0, 0.0, 7.5, ATIVA], 
    [10.0, 9.5, 9.5, 0.0, 7.5, 7.5, 7.5, 0.0, 0.0, 7.5, ATIVA], 
    [9.0, 7.0, 8.5, 0.0, 6.0, 6.5, 6.5, 0.0, 0.0, 6.0, ATIVA], 
    [6.0, 6.0, 6.5, 0.0, 4.5, 4.5, 4.5, 0.0, 0.0, 4.5, ATIVA], 
    [9.0, 7.5, 8.5, 0.0, 6.5, 6.5, 6.5, 0.0, 0.0, 6.5, ATIVA], 
    [5.0, 5.0, 7.5, 0.0, 4.5, 4.5, 4.5, 0.0, 0.0, 4.5, ATIVA], 
    [8.5, 9.0, 8.0, 0.0, 6.5, 6.5, 6.5, 0.0, 0.0, 6.5, ATIVA]]
    

    Thanks for the possible help.

提交回复
热议问题