Your First Dialog in Compose
There are several types of dialogs available in Compose, including an AlertDialog composable that mimics the appearance of its framework counterpart. You will be using Dialog, which is more agnostic about its content and will let you build a more custom UI. Regardless of which dialog flavor you choose, the semantics are largely the same – especially when it comes to how the dialog’s state is managed.
On its own, the Dialog function renders an empty window, so you will need to create a new composable that builds off of Dialog and provides the dialog’s view. Building this UI will require a fair amount of code, so your composable for this dialog should be in its own file to keep your code organized.
Create ...
Get Android Programming: The Big Nerd Ranch Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.