show method

void show({
  1. required String message,
  2. Function? onPressedOk,
  3. String? buttonTitle,
})

Implementation

void show(
    {required String message, Function? onPressedOk, String? buttonTitle}) {
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return AlertDialog(
        backgroundColor: Colors.transparent,
        contentPadding: EdgeInsets.zero,
        content: Container(
          decoration: BoxDecoration(
            borderRadius:
                BorderRadius.circular(XfdnDesignSystem.settings.cardRadius),
            color: Colors.white,
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.stretch,
            children: [
              Container(
                padding: const EdgeInsets.all(36),
                child: XfdnText(
                  message,
                  fontSize: 18,
                  textAlign: TextAlign.center,
                  textColor: Colors.black,
                ),
              ),
              Container(
                height: 60,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.only(
                    bottomLeft:
                        Radius.circular(XfdnDesignSystem.settings.cardRadius),
                    bottomRight:
                        Radius.circular(XfdnDesignSystem.settings.cardRadius),
                  ),
                  color: XfdnDesignSystem.settings.primaryColor,
                ),
                child: TextButton(
                  onPressed: () {
                    Navigator.pop(context);
                    if (onPressedOk != null) onPressedOk();
                  },
                  child: XfdnText(
                    buttonTitle ?? XfdnDesignSystem.labels.ok,
                    textColor: Colors.white,
                  ),
                ),
              )
            ],
          ),
        ),
      );
    },
  );
}