popupWidget static method

Widget popupWidget({
  1. required BuildContext context,
  2. String? title,
  3. Widget? titleWidget,
  4. IconData? icon,
  5. dynamic body,
  6. dynamic button1,
  7. dynamic button2,
  8. dynamic button3,
})

Implementation

static Widget popupWidget(
    {required BuildContext context, String? title, Widget? titleWidget, IconData? icon, body, button1, button2, button3}) {
  return AlertDialog(
    titlePadding: EdgeInsets.zero,
    contentPadding: const EdgeInsets.all(4.0),
    actionsPadding: const EdgeInsets.all(8.0),
    insetPadding: const EdgeInsets.all(8.0),
    backgroundColor: Theme.of(context).colorScheme.surface,
    title: titleWidget ??
        (title != null
            ? Container(
                padding: const EdgeInsets.only(left: 10),
                decoration: BoxDecoration(
                  borderRadius: const BorderRadius.only(topLeft: Radius.circular(20), topRight: Radius.circular(20)),
                  color: Theme.of(context).colorScheme.primaryContainer,
                ),
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    if (icon != null) Icon(icon, size: 30),
                    if (icon != null)
                      const SizedBox(
                        width: 5,
                      ),
                    Expanded(
                      child: Text(
                        title,
                        style: Theme.of(context).textTheme.headlineSmall,
                        overflow: TextOverflow.ellipsis,
                      ),
                    ),
                  ],
                ))
            : null),
    content: body,
    actions: <Widget>[if (button1 != null) button1, if (button2 != null) button2, if (button3 != null) button3],
  );
}