Added modal widget

This commit is contained in:
Patrick Alvin Alcala 2025-12-12 16:39:30 +08:00
parent 130a8f33f0
commit 1b86907d1b

38
lib/functions/modal.dart Normal file
View file

@ -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),
),
],
),
),
);
}