buildContainer method

Widget buildContainer()

Implementation

Widget buildContainer() {
  return Container(
    width: kOptions.headerWidth,
    height: kOptions.headerHeight,
    decoration: kOptions.headerDecoration,
    child: Stack(
      children: [
        // center
        Container(
          alignment: Alignment.center,
          padding: kOptions.titlePadding,
          child: Text(
            title ?? '',
            style: kOptions.titleStyle,
            overflow: TextOverflow.ellipsis,
          ),
        ),
        // left
        Positioned(
          child: kOptions.leftBuilder?.call() ??
              Container(
                width: kOptions.leftWidth,
                color: Colors.transparent,
                child: CupertinoButton(
                  alignment: Alignment.center,
                  pressedOpacity: kOptions.leftPressedOpacity,
                  padding: kOptions.leftPadding ?? EdgeInsets.zero,
                  child: kOptions.leftWidget ?? Text(kOptions.leftTitle ?? '', style: kOptions.leftTitleStyle),
                  onPressed: () {
                    if (kOptions.leftEvent != null) {
                      kOptions.leftEvent?.call();
                    } else {
                      DialogWrapper.dismissTopDialog();
                    }
                  },
                ),
              ),
          top: 0,
          left: 0,
          bottom: 0,
        ),
        // right
        Positioned(
          child: kOptions.rightBuilder?.call() ??
              Container(
                width: kOptions.rightWidth,
                color: Colors.transparent,
                child: CupertinoButton(
                  alignment: Alignment.center,
                  pressedOpacity: kOptions.rightPressedOpacity,
                  padding: kOptions.rightPadding ?? EdgeInsets.zero,
                  child: kOptions.rightWidget ?? Text(kOptions.rightTitle ?? '', style: kOptions.rightTitleStyle),
                  onPressed: () {
                    kOptions.rightEvent?.call();
                  },
                ),
              ),
          top: 0,
          right: 0,
          bottom: 0,
        ),
      ],
    ),
  );
}