apptomate_custom_alert_dialog 0.0.1

SDKflutter
Platformandroidioswindowslinuxmacosweb

A highly customizable and reusable AlertDialog widget for Flutter applications, designed to provide consistent and flexible dialogs with support for dark mode, custom icons, scrollable content, and more.

CustomAlertDialog for Flutter

A highly customizable and reusable AlertDialog widget for Flutter applications, designed to provide consistent and flexible dialogs with support for dark mode, custom icons, scrollable content, and more.


📌 Key Features

✅ Fully Customizable – Control colors, text styles, padding, and shapes.
✅ Dark Mode Support – Automatically adapts to the app's theme.
✅ Icon Support – Add an optional icon with customizable color and size.
✅ Flexible Content – Supports both simple text and custom widgets.
✅ Scrollable Content – Handles long messages with a scrollable view.
✅ Custom Buttons – Configure confirm/cancel buttons with different styles.
✅ Divider Option – Add a divider between the title and content.
✅ Pre-Built Examples – Includes common dialog types (confirmation, error, info, etc.).
✅ Responsive Design – Works seamlessly across all screen sizes.

📥 Installation

Add the dependency to your pubspec.yaml:

dependencies:
  apptomate_custom_alert_dialog: ^0.0.1

🚀 Basic Usage

1. Simple Confirmation Dialog

showDialog(
  context: context,
  builder: (context) => CustomAlertDialog(
    title: "Confirm Action",
    content: "Are you sure you want to delete this item?",
    confirmText: "Delete",
    cancelText: "Cancel",
    onConfirm: () {
      // Handle delete action
    },
    icon: Icons.warning,
    iconColor: Colors.orange,
  ),
);

2. Information Dialog

showDialog(
  context: context,
  builder: (context) => CustomAlertDialog(
    title: "Success",
    content: "Your changes have been saved successfully!",
    confirmText: "OK",
    icon: Icons.check_circle,
    iconColor: Colors.green,
  ),
);

3. Error Dialog

showDialog(
  context: context,
  builder: (context) => CustomAlertDialog(
    title: "Error",
    content: "Failed to load data. Please try again.",
    confirmText: "Retry",
    cancelText: "Cancel",
    confirmButtonColor: Colors.red,
    icon: Icons.error,
    backgroundColor: Colors.red[50],
  ),
);

4. Custom Content Dialog

showDialog(
  context: context,
  builder: (context) => CustomAlertDialog(
    title: "Feedback",
    customContent: Column(
      children: [
        TextField(decoration: InputDecoration(labelText: "Name")),
        TextField(decoration: InputDecoration(labelText: "Email")),
        CheckboxListTile(
          title: Text("Subscribe to newsletter"),
          value: false,
          onChanged: (val) {},
        ),
      ],
    ),
    confirmText: "Submit",
    cancelText: "Close",
  ),
);

⚙️ Customization Options

PropertyTypeDescriptionDefault
titleStringDialog title (required)-
contentStringMain dialog message-
confirmTextString?Text for confirm buttonnull
cancelTextString?Text for cancel buttonnull
onConfirmVoidCallback?Action on confirm button pressnull
onCancelVoidCallback?Action on cancel button pressnull
confirmButtonColorColor?Background color for confirm buttonTheme primary color
cancelButtonColorColor?Text color for cancel buttonColors.red
backgroundColorColor?Dialog background colorAuto (light/dark theme)
titleTextStyleTextStyle?Custom style for titleBold, size 18
contentTextStyleTextStyle?Custom style for contentSize 16
iconIconData?Optional leading iconnull
iconColorColor?Icon colorTheme primary color
iconSizedouble?Icon size28
scrollableboolEnable scrolling for long contentfalse
contentPaddingEdgeInsetsGeometry?Padding around contentEdgeInsets.fromLTRB(24, 0, 24, 24)
shapeShapeBorder?Custom dialog shape (e.g., rounded corners)Default dialog shape
customContentWidget?Replace default content with a custom widgetnull
showDividerboolShow a divider below titlefalse
dividerColorColor?Divider colorTheme divider color
dividerThicknessdouble?Divider thickness1.0