Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
flutterui:custom_screen [2020/08/06 20:44] admin |
flutterui:custom_screen [2020/08/06 22:48] admin |
||
---|---|---|---|
Line 3: | Line 3: | ||
~~NOPDF~~ | ~~NOPDF~~ | ||
- | If you want to customize your screen with flutter widgets on the client itself we offer a simple api to change a screen to whatever you need. In the following segment you will learn how to achieve something like that: | + | If you want to customize your screen, with flutter widgets on the client, we offer a simple API to change a screen to whatever you need. In the following sections you'll learn how to achieve that. |
=== Creating a custom screen manager === | === Creating a custom screen manager === | ||
- | To be able to customize your screens you have to create a custom screen manager for your application. You can achieve this by extending your dart class from CustomScreenManager like so: | + | To be able to customize your screens, you have to create a custom screen manager for your application. You can achieve this by extending your dart class from **CustomScreenManager** like so: |
<file dart> | <file dart> | ||
Line 13: | Line 13: | ||
</file> | </file> | ||
- | The CustomScreenManager has all the functions you will need to provide your users with customized screens. For this example we will 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 **getScreen** 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 19: | Line 19: | ||
<file dart> | <file dart> | ||
@override | @override | ||
- | void onMenu(SoMenuManager menuManager) { | + | void onMenu(SoMenuManager menuManager) { |
menuManager.addItemToMenu( | menuManager.addItemToMenu( | ||
id: 'CustomComponentId', | id: 'CustomComponentId', | ||
Line 42: | Line 42: | ||
} | } | ||
| | ||
- | return super.getScreen(componentId); | + | return super.getScreen(componentId); |
} | } | ||
</file> | </file> | ||
Line 78: | Line 78: | ||
In this class you can return any widget you want in the **getWidget** function. The **withServer** function tells the client not to communicate with the server for this screen. The **update** function is not necessary for this example. | In this class you can return any widget you want in the **getWidget** function. The **withServer** function tells the client not to communicate with the server for this screen. The **update** function is not necessary for this example. | ||
- | If you want to create a custom screen that communicates with the server you have to extend the **CustomScreen** class again: | + | If you want to create a custom screen that communicates with the server, you have to `return true;` in the **withServer** function: |
<file dart> | <file dart> |