selfprivacy.org.app/lib/ui/helpers/modals.dart

46 lines
1.5 KiB
Dart
Raw Normal View History

import 'package:easy_localization/easy_localization.dart';
2021-06-20 21:08:52 +00:00
import 'package:flutter/material.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:selfprivacy/config/get_it_config.dart';
import 'package:selfprivacy/ui/components/action_button/action_button.dart';
import 'package:selfprivacy/ui/components/brand_alert/brand_alert.dart';
2021-06-20 21:08:52 +00:00
Future<T?> showBrandBottomSheet<T>({
2022-06-05 19:36:32 +00:00
required final BuildContext context,
required final WidgetBuilder builder,
2021-06-20 21:08:52 +00:00
}) =>
showCupertinoModalBottomSheet<T>(
builder: builder,
barrierColor: Colors.black45,
context: context,
2022-05-24 18:55:39 +00:00
shadow: const BoxShadow(color: Colors.transparent),
2021-06-20 21:08:52 +00:00
backgroundColor: Colors.transparent,
);
void showPopUpAlert({
required final String description,
required final String actionButtonTitle,
required final void Function() actionButtonOnPressed,
final void Function()? cancelButtonOnPressed,
final String? alertTitle,
final String? cancelButtonTitle,
}) {
getIt.get<NavigationService>().showPopUpDialog(
BrandAlert(
title: alertTitle ?? 'basis.alert'.tr(),
contentText: description,
actions: [
ActionButton(
text: actionButtonTitle,
isRed: true,
onPressed: actionButtonOnPressed,
),
ActionButton(
text: cancelButtonTitle ?? 'basis.cancel'.tr(),
onPressed: cancelButtonOnPressed,
),
],
),
);
}