showCustom<T> method

Future<T?> showCustom<T>({
  1. required String title,
  2. required Widget child,
  3. List<PanelKitButton>? actions,
  4. Size? size,
})

Implementation

Future<T?> showCustom<T>({
  required String title,
  required Widget child,
  List<PanelKitButton>? actions,
  Size? size,
}) {
  final theme = GetIt.I<PanelKitController>().theme;
  return showDialog<T>(
    context: context,
    builder: (BuildContext context) {
      return Center(
        child: Container(
          decoration: BoxDecoration(
              color: theme.dialog.backgroundColor,
              border: Border.all(
                color: theme.borderColor,
              ),
              borderRadius: BorderRadius.circular(15)),
          width: size?.width,
          height: size?.height,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            mainAxisSize: MainAxisSize.min,
            children: [
              Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisSize: MainAxisSize.min,
                children: [
                  Padding(
                    padding: const EdgeInsets.all(25.0),
                    child: Text(
                      title,
                      style: theme.dialog.headerTextStyle,
                    ),
                  ),
                  theme.dialog.divider,
                ],
              ),
              child,
              Column(
                mainAxisSize: MainAxisSize.min,
                children: [
                  theme.dialog.divider,
                  Padding(
                    padding: const EdgeInsets.all(35.0),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      mainAxisSize: MainAxisSize.min,
                      children: actions ??
                          [
                            PanelKitButton(
                              type: PanelKitButtonType.secondary,
                              label: "Close",
                              onPressed: () => Navigator.of(context).pop(),
                            ),
                          ],
                    ),
                  ),
                ],
              )
            ],
          ),
        ),
      );
    },
  );
}