build method

  1. @override
Widget build(
  1. BuildContext context,
  2. Group content
)
override

Builds the layout for the content item. This transforms the content into a Flutter Widget.

Implementation

@override
Widget build(BuildContext context, Group content) {
  final gridContent = GridView.builder(
    shrinkWrap: true,
    physics: scrollable
        ? const AlwaysScrollableScrollPhysics()
        : const NeverScrollableScrollPhysics(),
    gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
      crossAxisCount: columns,
      childAspectRatio: aspectRatio,
      crossAxisSpacing: 4,
      mainAxisSpacing: 4,
    ),
    itemBuilder: (context, index) =>
        vyuh.content.buildContent(context, content.items[index]),
    itemCount: content.items.length,
  );

  return GroupLayoutContainer(
    content: content,
    body: scrollable ? Expanded(child: gridContent) : gridContent,
  );
}