renderStep method

Widget renderStep(
  1. BuildContext context
)

Implementation

Widget renderStep(BuildContext context) {
  var next = controller?.isLast != true
      ? AntdBox(
          style: style.nextStyle,
          onTap: () {
            controller?.next();
          },
          child: widget.nextBuilder != null
              ? widget.nextBuilder?.call(() {
                  controller?.next();
                })
              : const Text("下一步"),
        )
      : const AntdBox();
  var skip = widget.skip
      ? ListenableBuilder(
          listenable: controller ?? AntdTourController(),
          builder: (context, value) {
            var activeIndex = controller?.activeIndex;
            return AntdBox(
              style: style.skipStyle,
              onTap: () {
                controller?.finish();
              },
              child: widget.skipBuilder != null
                  ? widget.skipBuilder!.call(() {
                      controller?.next();
                    }, controller?.activeIndex ?? 0,
                      controller?.totalStep ?? 0)
                  : Text("跳过 ($activeIndex/${controller?.totalStep})"),
            );
          })
      : const AntdBox();
  var child = AntdColumn(
    style: style.titleColumnStyle,
    children: [
      if (widget.title != null)
        AntdBox(
          style: style.titleStyle,
          child: widget.title,
        ),
      if (widget.description != null)
        AntdBox(
          style: style.descriptionStyle,
          child: widget.description,
        )
    ],
  );
  return AntdBox(
    style: style.contentStyle,
    child: widget.builder != null
        ? widget.builder!(skip, next)
        : Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              child,
              Row(
                children: [skip, next],
              )
            ],
          ),
  );
}