build method

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

当content含TextField 键盘弹起遮挡内容 因此顶级父Widget 采用SingleChildScrollView

Implementation

@override
Widget build(BuildContext context) {
  return Scaffold(
      backgroundColor: const Color(0x33999999),
      body: Container(
        alignment: Alignment.center,
        child: SingleChildScrollView(
          child: Container(
              alignment: Alignment.center,
              child: Padding(
                padding: const EdgeInsets.symmetric(horizontal: 20),
                child: Container(
                  constraints: const BoxConstraints(maxWidth: 300),
                  decoration: BoxDecoration(
                    //背景
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(
                        DialogUtils.getDialogRadius(themeData!))), //设置四周圆角 角度
                  ),
                  child: Stack(
                    children: <Widget>[
                      Column(
                        mainAxisSize: MainAxisSize.min,
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: <Widget>[
                          _generateTitleWidget(),
                          contentWidget ?? Container(),
                          _generateBottomWidget(context),
                        ],
                      ),
                      _generateCloseWidget(context),
                    ],
                  ),
                ),
              )),
        ),
      ));
}