widget method

Widget widget(
  1. BuildContext context
)
override

Implementation

widget(context) {
  switch (type) {
    case NikuGridViewType.builder:
      return GridView.builder(
        key: key,
        scrollDirection: scrollDirection ?? Axis.vertical,
        reverse: reverse ?? false,
        controller: controller,
        primary: primary,
        physics: physics,
        shrinkWrap: shrinkWrap ?? false,
        padding: padding?.value,
        gridDelegate: gridDelegate!,
        itemBuilder: itemBuilder!,
        itemCount: itemCount,
        addAutomaticKeepAlives: addAutomaticKeepAlives ?? true,
        addRepaintBoundaries: addRepaintBoundaries ?? true,
        addSemanticIndexes: addSemanticIndexes ?? true,
        cacheExtent: cacheExtent,
        semanticChildCount: semanticChildCount,
        dragStartBehavior: dragStartBehavior ?? DragStartBehavior.start,
        keyboardDismissBehavior: keyboardDismissBehavior ??
            ScrollViewKeyboardDismissBehavior.manual,
        restorationId: restorationId,
        clipBehavior: clipBehavior ?? Clip.hardEdge,
      );

    case NikuGridViewType.custom:
      return GridView.custom(
        key: key,
        scrollDirection: scrollDirection ?? Axis.vertical,
        reverse: reverse ?? false,
        controller: controller,
        primary: primary,
        physics: physics,
        shrinkWrap: shrinkWrap ?? false,
        padding: padding?.value,
        gridDelegate: gridDelegate!,
        childrenDelegate: childrenDelegate!,
        cacheExtent: cacheExtent,
        semanticChildCount: semanticChildCount,
        dragStartBehavior: dragStartBehavior ?? DragStartBehavior.start,
        keyboardDismissBehavior: keyboardDismissBehavior ??
            ScrollViewKeyboardDismissBehavior.manual,
        restorationId: restorationId,
        clipBehavior: clipBehavior ?? Clip.hardEdge,
      );

    case NikuGridViewType.extent:
      return GridView.extent(
        key: key,
        scrollDirection: scrollDirection ?? Axis.vertical,
        reverse: reverse ?? false,
        controller: controller,
        primary: primary,
        physics: physics,
        shrinkWrap: shrinkWrap ?? false,
        padding: padding?.value,
        maxCrossAxisExtent: maxCrossAxisExtent!,
        mainAxisSpacing: mainAxisSpacing ?? 0.0,
        crossAxisSpacing: crossAxisSpacing ?? 0.0,
        childAspectRatio: childAspectRatio ?? 1.0,
        addAutomaticKeepAlives: addAutomaticKeepAlives ?? true,
        addRepaintBoundaries: addRepaintBoundaries ?? true,
        addSemanticIndexes: addSemanticIndexes ?? true,
        cacheExtent: cacheExtent,
        children: children ?? [],
        semanticChildCount: semanticChildCount,
        dragStartBehavior: dragStartBehavior ?? DragStartBehavior.start,
        keyboardDismissBehavior: keyboardDismissBehavior ??
            ScrollViewKeyboardDismissBehavior.manual,
        restorationId: restorationId,
        clipBehavior: clipBehavior ?? Clip.hardEdge,
      );

    case NikuGridViewType.count:
      return GridView.count(
        key: key,
        crossAxisCount: this.itemCount ?? 0,
        children: this.children ?? [],
        scrollDirection: this.scrollDirection ?? Axis.vertical,
        reverse: this.reverse ?? false,
        controller: this.controller,
        primary: this.primary,
        physics: this.physics,
        shrinkWrap: this.shrinkWrap ?? false,
        padding: this.padding?.value,
        mainAxisSpacing: this.mainAxisSpacing ?? 0.0,
        crossAxisSpacing: this.crossAxisSpacing ?? 0.0,
        childAspectRatio: this.childAspectRatio ?? 1.0,
        addAutomaticKeepAlives: this.addAutomaticKeepAlives ?? true,
        addRepaintBoundaries: this.addRepaintBoundaries ?? true,
        addSemanticIndexes: this.addSemanticIndexes ?? true,
        cacheExtent: this.cacheExtent,
        semanticChildCount: this.semanticChildCount,
        dragStartBehavior: this.dragStartBehavior ?? DragStartBehavior.start,
        keyboardDismissBehavior: this.keyboardDismissBehavior ??
            ScrollViewKeyboardDismissBehavior.manual,
        restorationId: this.restorationId,
        clipBehavior: this.clipBehavior ?? Clip.hardEdge,
      );

    case NikuGridViewType.children:
    default:
      return GridView(
        key: key,
        scrollDirection: scrollDirection ?? Axis.vertical,
        reverse: reverse ?? false,
        controller: controller,
        primary: primary,
        physics: physics,
        shrinkWrap: shrinkWrap ?? false,
        padding: padding?.value,
        gridDelegate: gridDelegate!,
        addRepaintBoundaries: addRepaintBoundaries ?? true,
        addAutomaticKeepAlives: addAutomaticKeepAlives ?? true,
        addSemanticIndexes: addSemanticIndexes ?? true,
        cacheExtent: cacheExtent,
        children: children ?? [],
        semanticChildCount: semanticChildCount,
        dragStartBehavior: dragStartBehavior ?? DragStartBehavior.start,
        clipBehavior: clipBehavior ?? Clip.hardEdge,
        keyboardDismissBehavior: keyboardDismissBehavior ??
            ScrollViewKeyboardDismissBehavior.manual,
        restorationId: restorationId,
      );
  }
}