Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
flutterui:custom_screen [2020/08/06 23:17] admin |
flutterui:custom_screen [2020/08/13 16:26] (current) admin |
||
---|---|---|---|
Line 13: | Line 13: | ||
</file> | </file> | ||
- | The **CustomScreenManager** has all the functions you'll need to provide your users with customized screens. For this example we'll override both the **getScreen** and the **onMenu** function. | + | The **CustomScreenManager** has all the functions you'll need to provide your users with customized screens. For this example we'll override both the **init** and the **onMenu** function. |
The **onMenu** function is used to provide the menu with screens that aren't provided by the server. To add our own entry to the Menu we just have to override the function like this: | The **onMenu** function is used to provide the menu with screens that aren't provided by the server. To add our own entry to the Menu we just have to override the function like this: | ||
Line 29: | Line 29: | ||
</file> | </file> | ||
- | This adds an entry to our menu. For us to be able to react to a click on this menu item we have to override the getScreen function: | + | This adds an entry to our menu. For us to be able to react to a click on this menu item we have to override the init function: |
<file dart> | <file dart> | ||
@override | @override | ||
- | getScreen(String componentId, {String templateName}) { | + | init() { |
- | globals.currentTempalteName = templateName; | + | SoComponentCreator componentCreator = SoComponentCreator(); |
- | + | ||
- | if (componentId == 'CustomComponentId') { | + | super.registerScreen('CustomComponentId', CustomScreen(componentCreator)); |
- | return CustomScreen(SoComponentCreator()); | + | super.registerScreen('com.sibvisions.example.ContactScreen:L1_MI_DOOPENWORKSCREEN_COM-SIB-EXA-CONWORSCR', ContactCustomScreen(componentCreator)); |
- | } else if (componentId == 'com.sibvisions.example.ContactScreen:L1_MI_DOOPENWORKSCREEN_COM-SIB-EXA-CONWORSCR') { | + | |
- | return ContactCustomScreen(SoComponentCreator()); | + | |
- | } | + | |
- | + | ||
- | return super.getScreen(componentId); | + | |
} | } | ||
</file> | </file> | ||
- | In this case the getScreen function returns our own CustomScreen class when the componentId matches and defaults to the superclass if not. | + | In this case the init function registers custom screen implementations for specific identifiers. |
=== Creating a custom screen === | === Creating a custom screen === |