Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
46 lines (33 sloc) 1.58 KB
import(package='flutter_view_tools/flutter_view_tools.dart')
import(file='example-model.dart')
//- This is a flutter-view, that renders the example-page, which is the homepage of the app
//- It expects a parameter model of type [ExampleModel], which contains the data to render,
//- as well as page functions
example-page(flutter-view :model[ExampleModel])
//- LIFECYCLE EXAMPLE:
//- the lifecycle widget here provides callbacks for when the state is created and disposed
//- See the ExampleModel class for the methods being called
lifecycle(:on-init='model.init' :on-dispose='model.dispose')
scaffold
app-bar(as='appBar')
#title(as='title') Example App
center(as='body')
.spacer(height=200)
//- ASSIGN EXAMPLE:
//- the assign widget assigns the textcontroller of the model to the variable ctl
assign(name='ctl' :^value='model.textController')
//- within this indentation/scope, ctl is assigned and can be used
.message-box(font-size=20)
.greeting Hello, you entered:
//- REACTIVE EXAMPLE:
//- When ExampleModel.notifyListeners is called (when someone types),
//- the below reactive widget automatically updates it child, updating the text
reactive(watch='model')
//- when the text changes in the model, it updates here
//- the ctl variable was created by the assign tag above
.text ${ctl.text}
.spacer(height=200)
.input(width=200)
//- the ctl variable was created by the assign tag above
text-field(:controller='ctl')
input-decoration(as='decoration' hint-text='Enter text')
You can’t perform that action at this time.