submitBottomsheet static method

dynamic submitBottomsheet(
  1. String message,
  2. String content,
  3. VoidCallback onDelete,
  4. double width,
  5. BuildContext context,
  6. String assetName,
)

Implementation

static submitBottomsheet(
    String message,
    String content,
    VoidCallback onDelete,
    double width,
    BuildContext context,
    String assetName) {
  bool isButtonEnabled = true;

  showModalBottomSheet<void>(
    context: context,
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.circular(30.0),
    ),
    backgroundColor: Colors.transparent,
    builder: (BuildContext context) {
      return StatefulBuilder(
        builder: (BuildContext context, StateSetter setState) {
          return SizedBox(
            height: SizeConstant.getHeightWithScreen(299),
            child: Stack(
              children: [
                Column(children: [
                  Container(
                    height: SizeConstant.getHeightWithScreen(38),
                    color: Colors.transparent,
                  ),
                  Container(
                    height: SizeConstant.getHeightWithScreen(261),
                    padding: EdgeInsets.only(
                      bottom: MediaQuery.of(context).viewInsets.bottom,
                    ),
                    width: MediaQuery.of(context).size.width,
                    decoration: BoxDecoration(
                      color: ColorConstant.white,
                      borderRadius: const BorderRadius.only(
                        topLeft: Radius.circular(30.0),
                        topRight: Radius.circular(30.0),
                      ),
                    ),
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Expanded(
                          child: Column(
                            children: [
                              SizedBox(
                                height: SizeConstant.getHeightWithScreen(53),
                              ),
                              Padding(
                                padding: EdgeInsets.symmetric(
                                  horizontal:
                                      SizeConstant.getHeightWithScreen(63),
                                ),
                                child: Text(
                                  message,
                                  style: TextStyle(
                                    color: ColorConstant.black3,
                                    fontSize: SizeConstant.mediumFont,
                                    fontWeight: FontWeight.w600,
                                  ),
                                  textAlign: TextAlign.center,
                                ),
                              ),
                              Padding(
                                padding: EdgeInsets.only(
                                  left: SizeConstant.getHeightWithScreen(63),
                                  right: SizeConstant.getHeightWithScreen(63),
                                  top: SizeConstant.getHeightWithScreen(20),
                                ),
                                child: Text(
                                  content,
                                  style: TextStyle(
                                    color: ColorConstant.grey5,
                                    fontSize: SizeConstant.smallFont,
                                    fontWeight: FontWeight.w500,
                                  ),
                                  textAlign: TextAlign.center,
                                ),
                              ),
                            ],
                          ),
                        ),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            InkWell(
                              onTap: () {
                                Get.back();
                              },
                              child: Container(
                                  width: width,
                                  height:
                                      SizeConstant.getHeightWithScreen(40),
                                  decoration: BoxDecoration(
                                    border: Border.all(
                                      width: 1,
                                      color: ColorConstant.primaryColor,
                                    ),
                                    borderRadius: BorderRadius.circular(
                                        SizeConstant.xSmallFont),
                                  ),
                                  child: Center(
                                    child: Text(
                                      "cancel",
                                      style: TextStyle(
                                        fontSize: SizeConstant.mediumFont,
                                        fontWeight: FontWeight.w500,
                                        color: ColorConstant.primaryColor,
                                      ),
                                    ),
                                  )),
                            ),
                            // VentasPrimaryButton(
                            //     onTap: () {
                            //       Get.back();
                            //     },
                            //     label: 'cancel'.tr,
                            //     btnHeight: SizeConstant.getHeightWithScreen(40),
                            //     btnWidth: width,
                            //     textColor: ColorConstant.primaryColor,
                            //     borderRadius: SizeConstant.xSmallFont,
                            //     bgColor: ColorConstant.white,
                            //     borderColor: ColorConstant.primaryColor),
                            SizedBox(
                                width: SizeConstant.getHeightWithScreen(20)),
                            InkWell(
                              onTap: isButtonEnabled
                                  ? () {
                                      setState(() {
                                        isButtonEnabled = false;
                                      });
                                      onDelete();
                                      Get.back();
                                      Future.delayed(
                                          const Duration(milliseconds: 500),
                                          () {
                                        setState(() {
                                          isButtonEnabled = true;
                                        });
                                      });
                                    }
                                  : null,
                              child: Container(
                                  width: width,
                                  height:
                                      SizeConstant.getHeightWithScreen(40),
                                  decoration: BoxDecoration(
                                    color: ColorConstant.primaryColor,
                                    border: Border.all(
                                      width: 1,
                                      color: ColorConstant.white,
                                    ),
                                    borderRadius: BorderRadius.circular(
                                        SizeConstant.xSmallFont),
                                  ),
                                  child: Center(
                                    child: Text(
                                      localization.translate('confirm'),
                                      style: TextStyle(
                                        fontSize: SizeConstant.mediumFont,
                                        fontWeight: FontWeight.w500,
                                        color: ColorConstant.white,
                                      ),
                                    ),
                                  )),
                            ),
                            // VentasPrimaryButton(
                            //     onTap: () {
                            //       onDelete();
                            //       Get.back();
                            //     },
                            //     label: 'confirm'.tr,
                            //     btnHeight: SizeConstant.getHeightWithScreen(40),
                            //     btnWidth: width,
                            //     textColor: ColorConstant.white,
                            //     borderRadius: SizeConstant.xSmallFont,
                            //     bgColor: ColorConstant.primaryColor,
                            //     borderColor: ColorConstant.white)
                          ],
                        ),
                        SizedBox(
                            height: SizeConstant.getHeightWithScreen(20)),
                      ],
                    ),
                  )
                ]),
                Positioned(
                  left: MediaQuery.of(context).size.width / 2 -
                      SizeConstant.getHeightWithScreen(38),
                  top: 0,
                  child: CircleAvatar(
                    radius: SizeConstant.getHeightWithScreen(38),
                    backgroundColor: ColorConstant.primaryColor,
                    child: SizedBox(
                      height: SizeConstant.getHeightWithScreen(32),
                      width: SizeConstant.getHeightWithScreen(32),
                      child: SvgPicture.asset(
                        'assets/images/$assetName',
                        package: Constants.packageName,
                      ),
                    ),
                  ),
                ),
              ],
            ),
          );
        },
      );
    },
  );
}