Frontend first draft

This commit is contained in:
Arseni
2025-11-13 15:06:15 +03:00
parent e47f343afb
commit ddb54ddfdc
504 changed files with 25498 additions and 1 deletions

View File

@@ -0,0 +1,38 @@
import 'package:flutter/material.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
import 'package:pweb/utils/snackbar.dart';
import 'package:pweb/widgets/error/snackbar.dart';
Future<void> invokeAndNotify<T>(
BuildContext context, {
required Future<T> Function() operation,
String? operationSuccess,
String? operationError,
void Function(Object)? onError,
void Function(T)? onSuccess,
}) async {
final sm = ScaffoldMessenger.of(context);
final locs = AppLocalizations.of(context)!;
try {
final res = await operation();
if (operationSuccess != null) {
notifyUserX(sm, operationSuccess);
}
if (onSuccess != null) {
onSuccess(res);
}
} catch (e) {
notifyUserOfErrorX(
scaffoldMessenger: sm,
errorSituation: operationError ?? locs.errorInternalError,
exception: e,
appLocalizations: locs,
);
if (onError != null) {
onError(e);
}
rethrow;
}
}