dlgCustom<T> method

Future<T?> dlgCustom<T>({
  1. required Widget content,
  2. required String title,
  3. List<Widget>? actions,
  4. double? height,
  5. double? width,
})

Shows a custom dialog for a more complex form where at the end you can apply changes as a returned value if necessary. You will make use of CodeMeltedUI.dlgClose for returning values via your actions array.

Implementation

Future<T?> dlgCustom<T>({
  required Widget content,
  required String title,
  List<Widget>? actions,
  double? height,
  double? width,
}) async {
  return showDialog<T>(
    barrierDismissible: false,
    context: cNavigatorKey.currentContext!,
    builder: (_) => AlertDialog(
      backgroundColor: _getTheme().backgroundColor,
      insetPadding: EdgeInsets.zero,
      scrollable: true,
      titlePadding: const EdgeInsets.all(5.0),
      title: Center(child: Text(title)),
      titleTextStyle: TextStyle(
        color: _getTheme().titleColor,
        fontSize: 20.0,
        fontWeight: FontWeight.bold,
      ),
      contentPadding: const EdgeInsets.only(
        left: 25.0,
        right: 25.0,
      ),
      content: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          SizedBox(
            height: height,
            width: width,
            child: content,
          )
        ],
      ),
      actionsPadding: const EdgeInsets.all(5.0),
      actionsAlignment: MainAxisAlignment.center,
      actions: actions,
    ),
  );
}