material_table_view icon indicating copy to clipboard operation
material_table_view copied to clipboard

Immutable list of columns does not work with `TableColumnControlsPopupRoute`

Open NikolayNIK opened this issue 4 months ago • 0 comments

@NikolayNIK never mind.. the problem was creating a new instance of the list of columns.. when using TableView.builder(columns: columns.toList(), ...) moving columns doesn't work either.. imho this is a (separate) bug, arguments to widgets should always be immutable.. by passing a mutable list into the TableView it's pretty random that moving columns works in the first place.. imho everything should work with passing a new list instance into the widget on every build (or when the list changes) as well..

Originally posted by @hpoul in https://github.com/NikolayNIK/material_table_view/issues/50#issuecomment-3172524823

The TableView and SliverTableView widgets are meant to be used either with mutable or immutable list of columns but TableColumnControlsPopupRoute column moving does not work whenever an immutable copy is passed to the table widget. Steps to reproduce:

  1. Replace the columns argument in the example to List.unmodifiable(columns).
  2. Try to move a column and get an exception.

NikolayNIK avatar Aug 10 '25 10:08 NikolayNIK