showConfirmationDialg method

void showConfirmationDialg(
  1. BuildContext context, {
  2. required String title,
  3. required String description,
  4. PanelyButtonType cancelButtonType = PanelyButtonType.secondary,
  5. String cancelButtonText = "Cancel",
  6. PanelyButtonType actionButtonType = PanelyButtonType.primary,
  7. String actionButtonText = "Do magic!",
  8. required dynamic actionButtonOnPress(),
  9. Size? size,
})

Implementation

void showConfirmationDialg(
  BuildContext context, {
  required String title,
  required String description,
  PanelyButtonType cancelButtonType = PanelyButtonType.secondary,
  String cancelButtonText = "Cancel",
  PanelyButtonType actionButtonType = PanelyButtonType.primary,
  String actionButtonText = "Do magic!",
  required Function() actionButtonOnPress,
  Size? size,
}) =>
    _dialog.show(
      size: size,
      builder: (BuildContext context) {
        return Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Padding(
              padding: const EdgeInsets.all(30.0),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text(
                    title,
                    style: theme.dialog.headerTextStyle,
                  ),
                  SizedBox(height: 15),
                  Text(
                    description,
                    style: theme.dialog.contentTextStyle,
                  ),
                ],
              ),
            ),
            Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                theme.dialog.divider,
                Padding(
                  padding: const EdgeInsets.all(25.0),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      PanelyButton(
                        type: cancelButtonType,
                        label: cancelButtonText,
                        onPressed: () => closeDialog(),
                      ),
                      const SizedBox(width: 10),
                      PanelyButton(
                        type: actionButtonType,
                        label: actionButtonText,
                        onPressed: () {
                          actionButtonOnPress();
                          closeDialog();
                        },
                      ),
                    ],
                  ),
                ),
              ],
            )
          ],
        );
      },
    );