XF-Material-Library icon indicating copy to clipboard operation
XF-Material-Library copied to clipboard

Allow to hide Confirming Button on a CustomContent Dialog

Open jm-parent opened this issue 4 years ago • 2 comments

🏗 Enhancement Proposal

Allowing MaterialDialog.Instance.ShowCustomContentAsync() to set confirmingText = Null , to hide the confirming Button.

The same way as dismissiveText do.

You can remove the negative button by passing null to the dismissiveText parameter.

Optional : Create MaterialDialog.Instance.ShowCustomContentAlertDialogAsync() , same as ShowCustomContentAsync , without buttons ;)

Pitch

Custom "ConfirmDialogs" are great. But Custom Alert Dialog are great too 🤙

jm-parent avatar Feb 20 '20 10:02 jm-parent

Can you include a use case?

ske66 avatar Apr 10 '20 08:04 ske66

@ske66 Sometimes it's useful because you can have confirm button in the top or in the middle of view with some specific UI. But I guess it's need separate API for such case because we need anyway to handle somehow setting of positive/negative answer. Something like this:

Current method, Confirm and Dismiss (if needed) button are present: Task<bool?> ShowCustomContentAsync (View view, string message, string title = null, string confirmingText = "Ok", string dismissiveText = "Cancel", MaterialAlertDialogConfiguration configuration = null);

New method, no buttons, only Task which will signal the window when to close: Task<bool?> ShowCustomContentAsync (View view, Task<bool> onCompletedTask, string message, string title = null, MaterialAlertDialogConfiguration configuration = null);

var completionTcs = new TaskCompletionSource<bool>(); var result = await ShowCustomContentAsync(new CustomView(completionTcs), completionTcs.Task,...);

We also can make a constraint to say that only View should implement this callback: Task<bool?> ShowCustomContentAsync<TView>(TView view, string message, string title = null, MaterialAlertDialogConfiguration configuration = null) where TView : View, ICompletable;

Interface also can be implemented in several ways: public interface ICompletable { EventHandler<bool> OnCompleted }

public interface ICompletable { Task<bool> OnCompletedTask { get; } }

Saratsin avatar Apr 21 '20 12:04 Saratsin