65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
// 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),
|
|
),
|
|
);
|
|
}
|