|
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:photos/core/constants.dart';
|
|
|
import 'package:photos/ui/common/loading_widget.dart';
|
|
|
import 'package:photos/ui/common/progress_dialog.dart';
|
|
|
+import 'package:photos/ui/components/action_sheet_widget.dart';
|
|
|
import 'package:photos/ui/components/button_widget.dart';
|
|
|
import 'package:photos/ui/components/dialog_widget.dart';
|
|
|
import 'package:photos/ui/components/models/button_type.dart';
|
|
@@ -132,6 +133,48 @@ Future<ButtonAction?> showNewChoiceDialog(
|
|
|
);
|
|
|
}
|
|
|
|
|
|
+///Will return null if dismissed by tapping outside
|
|
|
+Future<ButtonAction?> showChoiceActionSheet(
|
|
|
+ BuildContext context, {
|
|
|
+ required String title,
|
|
|
+ String? body,
|
|
|
+ required String firstButtonLabel,
|
|
|
+ String secondButtonLabel = "Cancel",
|
|
|
+ ButtonType firstButtonType = ButtonType.neutral,
|
|
|
+ ButtonType secondButtonType = ButtonType.secondary,
|
|
|
+ ButtonAction firstButtonAction = ButtonAction.first,
|
|
|
+ ButtonAction secondButtonAction = ButtonAction.cancel,
|
|
|
+ FutureVoidCallback? firstButtonOnTap,
|
|
|
+ FutureVoidCallback? secondButtonOnTap,
|
|
|
+ bool isCritical = false,
|
|
|
+ IconData? icon,
|
|
|
+ bool isDismissible = true,
|
|
|
+}) async {
|
|
|
+ final buttons = [
|
|
|
+ ButtonWidget(
|
|
|
+ buttonType: isCritical ? ButtonType.critical : firstButtonType,
|
|
|
+ labelText: firstButtonLabel,
|
|
|
+ isInAlert: true,
|
|
|
+ onTap: firstButtonOnTap,
|
|
|
+ buttonAction: firstButtonAction,
|
|
|
+ ),
|
|
|
+ ButtonWidget(
|
|
|
+ buttonType: secondButtonType,
|
|
|
+ labelText: secondButtonLabel,
|
|
|
+ isInAlert: true,
|
|
|
+ onTap: secondButtonOnTap,
|
|
|
+ buttonAction: secondButtonAction,
|
|
|
+ ),
|
|
|
+ ];
|
|
|
+ return showActionSheet(
|
|
|
+ context: context,
|
|
|
+ title: title,
|
|
|
+ body: body,
|
|
|
+ buttons: buttons,
|
|
|
+ isDismissible: isDismissible,
|
|
|
+ );
|
|
|
+}
|
|
|
+
|
|
|
ProgressDialog createProgressDialog(
|
|
|
BuildContext context,
|
|
|
String message, {
|