Connect Start Button through Angular
This commit is contained in:
parent
843dad6cbb
commit
96a5bd0cec
3 changed files with 14 additions and 8 deletions
|
|
@ -5,11 +5,13 @@ import 'package:rules_of_living/src/App.dart';
|
|||
|
||||
@Component(
|
||||
selector: 'my-app',
|
||||
templateUrl: "app_component.html"
|
||||
)
|
||||
class AppComponent implements OnInit {
|
||||
var name = "World";
|
||||
|
||||
App engine;
|
||||
String buttonRunText = "Start";
|
||||
|
||||
@ViewChild("caCanvas")
|
||||
html.CanvasElement canvas;
|
||||
|
|
@ -26,4 +28,14 @@ class AppComponent implements OnInit {
|
|||
engine.process(now);
|
||||
html.window.animationFrame.then(animFrame);
|
||||
}
|
||||
|
||||
void onStartClicked() {
|
||||
bool isRunning = !engine.running;
|
||||
engine.running = isRunning;
|
||||
|
||||
switch (isRunning) {
|
||||
case true: buttonRunText = "Stop"; break;
|
||||
case false: buttonRunText = "Start"; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue