AlertModalPopupWidget function

SafeArea AlertModalPopupWidget(
  1. BuildContext context,
  2. dynamic child,
  3. Widget? bottom,
  4. double? bottomHeight,
  5. Function? leftCallBack,
  6. String? leftText,
  7. String? title,
  8. bool? elevation,
  9. double? height,
)

Implementation

SafeArea AlertModalPopupWidget(
    BuildContext context,
    child,
    Widget? bottom,
    double? bottomHeight,
    Function? leftCallBack,
    String? leftText,
    String? title,
    bool? elevation,
    double? height) {
  return SafeArea(
    bottom: true,
    child: AnimatedPadding(
      padding: MediaQuery.of(context).viewInsets,
      duration: const Duration(milliseconds: 100),
      child: Scaffold(
        resizeToAvoidBottomInset: false,
        backgroundColor: Colors.transparent,
        body: Stack(
          children: [
            Stack(
              clipBehavior: Clip.none,
              children: [
                Container(
                  child: child(context),
                  margin: EdgeInsets.only(
                      top: 92.w,
                      bottom: bottom == null ? 0 : (bottomHeight ?? 88.w)),
                ),
                Positioned(
                  width: ScreenUtil().screenWidth,
                  child: bottom ?? SizedBox(),
                  bottom: 0,
                  left: 0,
                ),
                Positioned(
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      XButton(
                        callback: () => leftCallBack?.call(),
                        child: Text(
                          '${leftText ?? ''}',
                          style: Theme.of(context)
                              .textTheme
                              .bodyLarge
                              ?.copyWith(color: themeColor.ff3D3B48),
                        ).centerLeft.background(width: 150.w),
                      ),
                      Text(
                        '${title ?? ''}',
                        style: Theme.of(context)
                            .textTheme
                            .titleLarge
                            ?.copyWith(color: themeColor.ff0E0D15),
                      )
                          .center
                          .background(height: 44.w)
                          .padding(vertical: 24.w)
                          .center,
                      XButton(
                        callback: () => Navigator.pop(context),
                        child: Icon(
                          // Icons.close_outlined,
                          const IconData(0xe648, fontFamily: 'iconfont'),
                          size: 24.w,
                          color: themeColor.ff9EA6AE,
                        )
                            .center
                            .background(height: 40.w, width: 40.w)
                            .centerRight
                            .background(width: 150.w),
                      )
                    ],
                  ).padding(horizontal: 32.w).background(
                      height: 92.w,
                      topRight: 16.w,
                      topLeft: 16.w,
                      borderBottom: elevation ?? false ? 1.w : null,
                      width: ScreenUtil().screenWidth),
                  top: 0,
                  left: 0,
                ),
              ],
            )
                .background(
                    topRight: 16.w,
                    topLeft: 16.w,
                    color: Theme.of(context).primaryColorLight,
                    width: ScreenUtil().screenHeight,
                    height: ScreenUtil().screenHeight / 2)
                .bottomCenter,
          ],
        ),
      ).background(height: height ?? ScreenUtil().screenHeight * 0.5),
    ),
  );
}