Trace:
Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revision Both sides next revision | ||
flutterui:custom_screen [2020/08/06 22:54] admin |
flutterui:custom_screen [2020/08/06 23:17] admin |
||
---|---|---|---|
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 `return true;` in the **withServer** function: | + | 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> | ||
Line 123: | Line 123: | ||
</file> | </file> | ||
- | In the **getWidget** function we return our custom widget. In this case we create a CoCustomComponent which can hold any widget we want. Afterwards we get the component that we want to replace from the widget tree via `this.componentScreen.getComponentFromName('contactPanel');`. | + | In the **getWidget** function we return our custom widget. In this case we create a CoCustomComponent which can hold any widget we want. Afterwards we get the component that we want to replace from the widget tree via ''%%this.componentScreen.getComponentFromName('contactPanel');%%''. |
- | To replace this component with our own widget, we just have to call `this.componentScreen.replaceComponent(comp, contactComp);`. | + | To replace this component with our own widget, we just have to call ''%%this.componentScreen.replaceComponent(comp, contactComp);%%''. |
We also override the **update** function to update our components when we get new data from the server. The **withServer** function now tells our screen to communicate with the server. | We also override the **update** function to update our components when we get new data from the server. The **withServer** function now tells our screen to communicate with the server. | ||
An example screen can be found [[https://github.com/sibvisions/flutterclient.example/blob/master/lib/screens/contact_custom_screen.dart|here]] and an example custom screen manager [[https://github.com/sibvisions/flutterclient.example/blob/master/lib/example_custom_screen_manager.dart|here]]. | An example screen can be found [[https://github.com/sibvisions/flutterclient.example/blob/master/lib/screens/contact_custom_screen.dart|here]] and an example custom screen manager [[https://github.com/sibvisions/flutterclient.example/blob/master/lib/example_custom_screen_manager.dart|here]]. |