first commit

This commit is contained in:
2025-03-03 20:59:42 +03:00
commit 273e68557a
1099 changed files with 17880 additions and 0 deletions

64
lib/common/functions.dart Normal file
View File

@@ -0,0 +1,64 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:get_it/get_it.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:remever/common/resources.dart';
import 'package:remever/components/extensions/context.dart';
import 'package:remever/router.dart';
import 'events/events.dart';
///
/// Глобальный навигатор
///
AppRouter get globalRouter {
return GetIt.I.get<AppRouter>();
}
///
/// Глобальный показ ошибки
///
void showErrorNotification(String text, [SnackBarAction? action]) {
eventBus.fire(
NotificationEvent(
text: text,
type: NotificationEventType.ERROR,
action: action,
),
);
}
///
/// Глобальный показ уведомления
///
void showInfoNoitification(String text, [SnackBarAction? action]) {
eventBus.fire(
NotificationEvent(
text: text,
type: NotificationEventType.NOTIFY,
action: action,
),
);
}
///
/// Показ диалога как cupertino
///
Future<T?> showCuperModalBottomSheet<T>({
required BuildContext context,
required WidgetBuilder builder,
Color? backgroundColor,
double? height,
}) {
return showCupertinoModalBottomSheet(
topRadius: const Radius.circular(24).r,
backgroundColor: backgroundColor ?? AppColors.white,
context: context,
builder:
(BuildContext _) => SizedBox(
height: height ?? MediaQuery.of(context).size.height / 2,
child: Builder(builder: builder),
),
);
}