Added modal widget
This commit is contained in:
parent
130a8f33f0
commit
1b86907d1b
1 changed files with 38 additions and 0 deletions
38
lib/functions/modal.dart
Normal file
38
lib/functions/modal.dart
Normal 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),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue