Sample apps
Three larger samples each combine several Enro features. The three samples are part of the test application in the repository, under tests/application/.../samples. For examples that each show one concept, see Recipes.
Run the samples
Clone the repository, then run the test application from the repository root:
| Platform | Command |
|---|---|
| Desktop | ./gradlew :tests:application:app:desktop:run |
| Android | ./gradlew :tests:application:app:android:installDebug, then open the app on the device |
| Web | ./gradlew :tests:application:app:web:wasmJsBrowserDevelopmentRun |
| iOS | Open EnroTestApplication.xcodeproj in Xcode and run the project |
In the app, choose Samples, then a sample.
Loan Application
A long, branching form: samples/loan.
- A ViewModel declares the flow with
registerForFlowResult. The answers to earlier steps decide which later steps the flow opens. - The host screen renders the steps in a container created with
rememberNavigationContainerForFlow, below a progress bar. - From the summary step, the user can return to an earlier step and change the answer.
- On desktop, a
@NavigationDestination.PlatformOverrideopens the flow in a separate window withrootWindowDestination.
See also the Flow in a ViewModel recipe.
Recipe Browser
A list, a detail screen, and a create flow: samples/recipes.
- The list and detail screens share an element with
sharedElement. - The create flow is a
managedFlowDestination. One step is a dialog that returns a result, and the flow branches on the dialog’s result. - On desktop, the create flow opens in a separate window and the app has a menu bar.
Travel Planner
Login, registration and a home screen: samples/travel.
- Login and logout replace the current screen with
closeAndReplaceWith. - After registration,
updateBackstackremoves the registration screens from the backstack, so Back does not return to the registration screens. - Some screens declare transitions for that screen only.