Dialog

Dialog

MUIPrimaryDialog

A customizable primary dialog provided by Modular UI.

Properties

  • titleText: String - Title of the dialog box that appears at the top.

  • contentText: String - The main content of the dialog box.

  • dialogRadius: double? - Border radius of the dialog box; default: 5.

  • dialogBackgroundColor: Color? - Color of the dialog box; default: white.

  • titleStyle: TextStyle? - Text style of the dialog box title; default: size=18, bold, color=black.

  • contentStyle: TextStyle? - Text style of the dialog box content; default: color=black54.

  • buttons: List? - List of buttons or widgets to be shown in the primary dialog box.

  • buttonsAlignment: MainAxisAlignment? - Main axis alignment for buttons.

Methods

showDialogBox(BuildContext context)

Displays the primary dialog box.

Parameters

  • context: BuildContext - The build context of the widget.

Returns

  • Future - A Future that resolves to the result returned by the showDialog function.

Example Usage

MUISecondaryOutlinedButton(
        text: 'Show Dialog Box',
        borderColor: Colors.grey.shade300,
        bgColor: Colors.white,
        onPressed: () {
          MUIPrimaryDialog(
              titleText: 'Alert Dialog',
              contentText:
                  'This action cannot be undone. This will permanently delete your account and remove your data from our servers.',
              buttonsAlignment: MainAxisAlignment.spaceEvenly,
              buttons: [
                MUISecondaryButton(
                    text: 'Cancel',
                    onPressed: () {
                      Navigator.pop(context);
                    }),
                MUISecondaryOutlinedButton(
                  text: 'Done',
                  onPressed: () {},
                  bgColor: Colors.grey.shade200,
                  borderColor: Colors.grey.shade300,
                )
              ]).showDialogBox(context);
        },
      ),

Notes

  • Provides a customizable dialog box with title, content, and action buttons.

  • Supports customization of dialog box appearance, including title and content text styles.

  • Allows the addition of action buttons with various styles and functionalities.

Last updated