mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-09 14:47:23 +00:00
69 lines
2.2 KiB
Dart
69 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
Future<void> showCustomDialog({
|
|
required BuildContext context,
|
|
required String message,
|
|
String? title,
|
|
String? iconPath,
|
|
Widget? widget,
|
|
double? dialogHeight,
|
|
double? iconHeight,
|
|
double? iconWidth,
|
|
VoidCallback? onOkPressed,
|
|
bool barrierDismissible = false,
|
|
List<Widget>? actions,
|
|
}) {
|
|
return showDialog(
|
|
context: context,
|
|
barrierDismissible: barrierDismissible,
|
|
builder: (BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
return AlertDialog(
|
|
alignment: Alignment.center,
|
|
content: SizedBox(
|
|
height: dialogHeight ?? size.height * 0.15,
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
if (iconPath != null)
|
|
SvgPicture.asset(
|
|
iconPath,
|
|
height: iconHeight ?? 35,
|
|
width: iconWidth ?? 35,
|
|
),
|
|
if (title != null)
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
child: Text(
|
|
title,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.headlineLarge!
|
|
.copyWith(
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w400,
|
|
color: Colors.black),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 8.0),
|
|
child: Text(
|
|
message,
|
|
style: Theme.of(context)
|
|
.textTheme
|
|
.bodyMedium!
|
|
.copyWith(color: Colors.black),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
if (widget != null) Expanded(child: widget)
|
|
],
|
|
),
|
|
),
|
|
actionsAlignment: MainAxisAlignment.center,
|
|
actions: actions);
|
|
},
|
|
);
|
|
}
|