Skip to content

Files

Latest commit

bf6a4ca · May 3, 2022

History

History

example

Flutter-View Tools Example

Screenshot

This app shows you by example how you may use the Lifecycle, and ReactiveWidget classes.

It is a simple screen that lets you enter a text, and as you type, updates the same text on the screen.

  • It demonstrates the reactive tag and ReactiveWidget by using it to update the text on the screen by monitoring the model
  • It demonstrates the lifecycle tag and widget by using it to call methods to init and dispose of a listener for the text controller

The most important files to check are:

  • example-model.dart: This contains the state of the app. Since it extends the Model class, it can call notifyListeners() to inform any listeners that it has changed. This allows the ReactiveWidget in the ExamplePage to watch it, and rerender whenever the example model has changed.
  • main.dart: The startpoint of the app. It creates the ExampleApp and its _ExampleAppState. The _ExampleAppState creates and holds the ExampleModel, and for the home it uses the ExamplePage, passing the model for rendering.
  • example-page.pug: The template for the home page of the example app. In this file you see each flutter-view tag being used, with some explanation in the comments.
  • example-page.dart: This is the generated Dart code from example-page.pug, after having been processed by the flutter-view console tool.

See the project page for more information on this project and flutter-view.