build method

  1. @override
Widget build(
  1. BuildContext context,
  2. List<Widget>? children
)

Subclasses should override this function to display the given children, which are the parsed representation of data.

Implementation

@override
Widget build(BuildContext context, List<Widget>? children) {
  final list = children ?? const <Widget>[];
  if (list.length == 1) return list.single;

  final visible =
  (maxLines != null && maxLines! < list.length)
      ? list.take(maxLines!).toList()
      : list;

  return Column(
    crossAxisAlignment: CrossAxisAlignment.stretch,
    children: visible,
  );
}