Flutter-View Tools #
Flutter-view is a tool that lets you easily create layouts for Flutter, using Pug and Sass.
This package adds some widgets that allow some extra functionality for flutter-view, and are highly recommended for your flutter-view projects.
The library adds the following widgets:
A builder widget used in combination with the flutter-view assign tag shortcut, used to assign a value to a new variable in your widget build tree.
A stateful widget that lets you hook into different lifecycle events of its state, such as initState, render and dispose. You can use these hooks for updating and cleaning up in your view-model.
A wrapper of a Flutter StreamWidget, that monitors a Listenable such as a Model, and triggers an update when that Listenable updates. This allows for your tree of widgets to respond to model updates.
- Formatted sources with flutter format
- Using scoped_model: ^1.0.1 - Updated example readme - Fixed example bug
- Added example, better description, changelog.md and more documentation.
- Improved exports
- Updated readme and added scoped_model in the exports
- First public release with the tools in a new seperated tools package
Flutter-View Tools Example #
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 assign tag and widget by assigning the text controller to the ctl parameter
- 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.
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: flutter_view_tools: ^1.0.5
2. Install it
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support
flutter pub get.
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
We analyzed this package on Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
- Dart: 2.5.0
- pana: 0.12.21
- Flutter: 1.9.1+hotfix.2
Detected platforms: Flutter
References Flutter, and has no conflicting libraries.
flutter format to format
flutter format to format