popAlert function

Future popAlert(
  1. BuildContext context,
  2. String title,
  3. String message
)

Implementation

Future<dynamic> popAlert(BuildContext context, String title, String message) {
  return showDialog(
    context: context,
    builder: (BuildContext context) => ClipRRect(
      clipBehavior: Clip.antiAlias,
      child: Dialog(
        backgroundColor: TruthinUITheme.of(context).primaryBackground,
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(20.0),
        ),
        insetPadding: const EdgeInsets.symmetric(horizontal: 25),
        child: SizedBox(
          child: SingleChildScrollView(
            child: Padding(
              padding: const EdgeInsetsDirectional.fromSTEB(30, 0, 20, 30),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Align(
                    alignment: const AlignmentDirectional(1, 0),
                    child: IconButton(
                      onPressed: () {
                        Navigator.of(context).pop();
                      },
                      icon: const Icon(Icons.close),
                    ),
                  ),
                  Text(
                    title,
                    style: TruthinUITheme.of(context).titleMedium.copyWith(
                          fontSize: 20,
                          color: TruthinUITheme.of(context).primaryText,
                          fontWeight: FontWeight.bold,
                        ),
                  ),
                  const SizedBox(height: 20),
                  Text(
                    message,
                    style: TruthinUITheme.of(context).titleSmall.copyWith(fontSize: 16, color: Colors.black),
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    ),
  );
}