diff --git a/lib/functions/modal.dart b/lib/functions/modal.dart new file mode 100644 index 0000000..792f480 --- /dev/null +++ b/lib/functions/modal.dart @@ -0,0 +1,38 @@ +import 'package:flutter/material.dart'; +import 'package:gap/gap.dart'; +import 'package:ocbo_esign_validator/widgets/text_widget.dart'; + +void showModal(BuildContext context, String title, String message, bool error) { + showDialog( + context: context, + builder: (context) => Theme( + data: ThemeData( + dialogTheme: DialogThemeData( + backgroundColor: error + ? const Color.fromRGBO(72, 30, 31, 0.919) + : Color.fromRGBO(18, 44, 31, 0.919), // Check the value of `error` + ), + ), + child: AlertDialog( + title: TextWidget(text: title, color: Color.fromRGBO(244, 244, 244, 1), bold: true, size: 24), + content: SizedBox( + height: 48, + child: Column( + children: [ + const Gap(24), + TextWidget(text: message, color: Color.fromRGBO(244, 244, 244, 1), size: 16), + ], + ), + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: const TextWidget(text: 'OK', color: Colors.white, bold: true, size: 16), + ), + ], + ), + ), + ); +}