69 lines
2.4 KiB
Dart
69 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:hub/components/molecular_components/throw_exception/throw_exception_widget.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
import 'package:hub/shared/enums/enum_throw_exception.dart';
|
|
|
|
class DialogUtil {
|
|
static const double _height = 350;
|
|
|
|
static Future<dynamic> errorDefault(BuildContext context) {
|
|
return error(
|
|
context,
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: "Falha ao efetuar operação, Tente Novamente mais tarde.",
|
|
enText: "Failed to perform operation, please try again later."));
|
|
}
|
|
|
|
static Future<dynamic> warningDefault(BuildContext context) {
|
|
return warning(
|
|
context,
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: "Atenção, algo deu errado. Tente novamente mais tarde.",
|
|
enText: "Warning, something went wrong. Try again later."))
|
|
.then((value) => value);
|
|
}
|
|
|
|
static Future<dynamic> error(BuildContext context, String message) async {
|
|
return await showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return Dialog(
|
|
|
|
child: SizedBox(
|
|
height: _height,
|
|
child: Padding(
|
|
padding: MediaQuery.viewInsetsOf(context),
|
|
child: ThrowExceptionWidget(
|
|
msg: message, type: EnumThrowException.error))));
|
|
});
|
|
}
|
|
|
|
static Future<dynamic> warning(BuildContext context, String message) async {
|
|
return await showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return Dialog(
|
|
child: SizedBox(
|
|
height: _height,
|
|
child: Padding(
|
|
padding: MediaQuery.viewInsetsOf(context),
|
|
child: ThrowExceptionWidget(
|
|
msg: message, type: EnumThrowException.warning))));
|
|
});
|
|
}
|
|
|
|
static Future<dynamic> success(BuildContext context, String message) async {
|
|
return await showDialog(
|
|
context: context,
|
|
builder: (context) {
|
|
return Dialog(
|
|
child: SizedBox(
|
|
height: _height,
|
|
child: Padding(
|
|
padding: MediaQuery.viewInsetsOf(context),
|
|
child: ThrowExceptionWidget(
|
|
msg: message, type: EnumThrowException.success))));
|
|
});
|
|
}
|
|
}
|