gskinnerTeam / flutter-flextras

A collection of Flex widgets (Columns and Rows) with additional functionality.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] `SeparatedColumn` throws error

mzdm opened this issue · comments

Let's say you have list:

  final myList = <String>['hello', 'dog', 'launch'];

and you pass it to SeparatedColumn / SeparatedRow, it throws error:

SeparatedColumn(
    separatorBuilder: () => SizedBox(height: 12),
    children: myList.map((e) => Text('$e\n')).toList(), // Throws error SeparatedColumn: type 'SizedBox' is not a subtype of type 'Text' of 'element'.
  )

This, however builds fine:

SeparatedColumn(
    separatorBuilder: () => SizedBox(height: 12),
    children: [
      ...myList.map((e) => Text('$e\n')),
    ],
  )

Not sure the building process in the Flutter framework but I've the fix. My guess it was modifying the original list which was used somewhere while building so I'm copying it. I've added a test for it.