attach method

  1. @override
Widget? attach(
  1. BuildContext context,
  2. CheckmarkViewController controller
)
override

Implementation

@override
Widget? attach(BuildContext context, CheckmarkViewController controller) {
  Widget child = Checkbox.adaptive(
    activeColor: controller.activeColor,
    autofocus: controller.checkAutofocus,
    checkColor: controller.checkColor,
    fillColor: controller.fillColorProperty,
    focusColor: controller.checkFocusColor,
    focusNode: controller.checkFocusNode,
    hoverColor: controller.checkHoverColor,
    isError: controller.isError,
    materialTapTargetSize: controller.materialTapTargetSize,
    mouseCursor: controller.mouseCursor,
    overlayColor: controller.overlayColor,
    shape: controller.checkboxShape,
    side: controller.borderSide,
    splashRadius: controller.splashRadius,
    tristate: controller.tristate,
    value: controller.activated,
    visualDensity: controller.visualDensity,
    onChanged: (value) => controller.onNotifyToggleWithActivator(),
  );

  return LinearLayout(
    width: double.infinity,
    orientation: Axis.horizontal,
    crossGravity: controller.checkboxAlignment.isTopMode
        ? CrossAxisAlignment.start
        : controller.checkboxAlignment.isBottomMode
            ? CrossAxisAlignment.end
            : CrossAxisAlignment.center,
    children: [
      if (controller._isStart) child,
      Expanded(
        child: Padding(
          padding: EdgeInsets.only(
            left: controller._isStart ? controller.spaceBetween : 0,
            right: !controller._isStart ? controller.spaceBetween : 0,
          ),
          child: super.attach(context, controller)!,
        ),
      ),
      if (!controller._isStart) child,
    ],
  );
}