build method

  1. @override
Widget build(
  1. BuildContext context
)
override

父类处理点击事件

Implementation

@override
Widget build(BuildContext context) {
  Widget wid = Container(
    alignment: widget.alignment,
    width: widget.width,
    height: widget.heigth,
    margin: widget.margin,
    padding: widget.padding,
    color: widget.decoration == null ? widget.color : null,
    decoration: widget.decoration,
    child: childBuild(context),
  );

  Widget ges = GestureDetector(
    behavior: HitTestBehavior.translucent,
    onTap: widget.onClick != null
        ? () {
            if (widget.hiddenKeepFrame == true ||
                widget.hiddenClearFrame == true) {
                  //隐藏状态不能点击
            } else {
              if (widget.onClick != null) {
                widget.onClick!();
              }
            }
          }
        : null,
    child: widget.unconstrainedBox == true
        ? UnconstrainedBox(
            child: wid,
          )
        : wid,
  );

  Widget hiddenWid = ges;
  if (widget.hiddenKeepFrame == true) {
    hiddenWid = Opacity(
      opacity: widget.hiddenKeepFrame == true ? 0 : 1,
      child: ges,
    );
  } else if (widget.hiddenClearFrame == true) {
    hiddenWid =
        Offstage(child: ges, offstage: widget.hiddenClearFrame ?? false);
  }

  return hiddenWid;
}