getTickCounter method
- covariant Rocket sm,
- dynamic ctr
Return the widget that displays the counter value.
Note the use of sm.watch to build a Text widget that relies on the SamHot
value of ctr. SAMCAS watches the dependent variables and updates this widget whenever
they change. In this case the dependent variable is determined to be ctr.
When sm is null (during initialization) this logic is bypassed and the value provided as a parameter
is used.
Implementation
Widget getTickCounter(covariant Rocket sm,String ctr) {
return Container(
width: 40,
color: Colors.white,
child: Align(
alignment: Alignment.center,
child: ((sm == null)?Text(ctr,style:TextStyle(fontSize: 30.0))
:sm.watch((SamBuild sb)=>Text("${sm.getHot('ctr')}",style:TextStyle(fontSize: 30.0)))
),
),
);
}