<@UL1A5BA2X> I'm trying to use a `MDCDialog` in an...
# kmdc
r
@Big Chungus I'm trying to use a
MDCDialog
in an MVI application. I have a view model which has an
open
state for the dialog. The dialog may be: a) closed by some button press by the user, in which case the dialog is closed when it sees the
open
state of the VM change to false, or b) closed on scrim or escape, in which case I need to send an event to the VM (using the
onClosed
hook seems appropriate) The problem I have is when the dialog is closed via (a), my view model receives two inputs: the button press and the event from the
onClosed
hook, which causes issues. Is there a way to trigger a callback only for the scrim/escape case?
b
Dunno, but I don't think so. Have you checked mdc docs for mdc-dialog yet?
r
Yeah,
closing
and
closed
are documented as "Indicates when the dialog begins/finishes its closing animation." I'm checking the
action
value received in the event right now, they don't document what that is.
b
r
Ah, so the string just gets set to something else so I can distinguish it. Got it!
b
Let me know if you manage to get it working
r
Yep, it works. I don't even need to use
scrimClickAction
and
escapeKeyAction
because the close event action is
undefined
(null in Kotlin) if I close the popup through state, and `scrimClickAction`/`escapeKeyAction` (which defaults to
close
) if done via the scrim/esc.
b
I'd be curious to check out the website you're building once you have something to show
(assuming it's oss ofc)
r
Not oss, but the site is already live: https://sell.diyoffer.com/. You have to login to see most of it -- feel free to create an account on the test site: https://test.diyoffer.com/home.
b
Thanks
Did you theme it with css variables or scss mixins?
Looks neat, btw!
r
A small amount of scss but mostly css variables
Looks neat, btw!
Thanks!