41 lines
791 B
Dart
41 lines
791 B
Dart
import 'package:angular/angular.dart';
|
|
import 'package:angular_components/angular_components.dart';
|
|
import 'package:rules_of_living/service/control_service.dart';
|
|
|
|
@Component(
|
|
selector: 'sim-controls',
|
|
templateUrl: "controls_component.html",
|
|
directives: [
|
|
coreDirectives,
|
|
MaterialButtonComponent,
|
|
MaterialIconComponent,
|
|
MaterialTooltipDirective
|
|
],
|
|
providers: [],
|
|
styleUrls: const ["controls_component.css"],
|
|
)
|
|
class ControlsComponent {
|
|
final ControlService ctrl;
|
|
|
|
ControlsComponent(this.ctrl);
|
|
|
|
void onStartClicked() {
|
|
ctrl.toggleRunning();
|
|
}
|
|
|
|
void onStepClicked() {
|
|
ctrl.step();
|
|
}
|
|
|
|
void onResetClicked() {
|
|
ctrl.reset();
|
|
}
|
|
|
|
void onRandomClicked() {
|
|
ctrl.addRandomPattern();
|
|
}
|
|
|
|
void onClearClicked() {
|
|
ctrl.clear();
|
|
}
|
|
}
|