buildAvatarList method

List<Widget> buildAvatarList(
  1. BuildContext context
)

Implementation

List<Widget> buildAvatarList(BuildContext context) {
  final widgets = <Widget>[];
  final displayCount = maxCount ?? data.length;

  for (var i = 0; i < data.length; ++i) {
    if (i < displayCount) {
      widgets.add(Positioned(
        top: 0,
        left: i * (spacing ?? (size * 0.5)),
        child: ComAvatar(
          data[i],
          size: size,
        ),
      ));
    } else {
      break;
    }
  }

  if (data.length > displayCount) {
    widgets.add(Positioned(
      top: 0,
      left: (displayCount - 1) * (spacing ?? (size * 0.5)),
      child: ComAvatar(
        '',
        size: size,
        placeholder: _buildDefaultOverflowWidget(data.length),
      ),
    ));
  }

  return widgets;
}