This repository has been archived by the owner on Sep 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 28
/
material_checkbox_example.dart
83 lines (72 loc) · 2.22 KB
/
material_checkbox_example.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:angular/angular.dart';
import 'package:angular_forms/angular_forms.dart';
import 'package:angular_components/material_button/material_button.dart';
import 'package:angular_components/material_checkbox/material_checkbox.dart';
import 'package:angular_components/material_icon/material_icon.dart';
import 'package:angular_components/material_input/material_input.dart';
import 'package:angular_components/material_toggle/material_toggle.dart';
import 'package:angular_gallery_section/annotation/gallery_section_config.dart';
@GallerySectionConfig(
displayName: 'Material Checkbox',
docs: [MaterialCheckboxComponent],
demos: [MaterialCheckboxExample],
benchmarks: [
'material_checkbox_init',
],
showGeneratedDocs: true,
)
class MaterialCheckboxGalleryConfig {}
@Component(
selector: 'material-checkbox-example',
directives: [
MaterialButtonComponent,
MaterialCheckboxComponent,
MaterialIconComponent,
materialInputDirectives,
MaterialToggleComponent,
NgFor,
NgModel,
NgFormControl
],
templateUrl: 'material_checkbox_example.html',
styleUrls: ['material_checkbox_example.scss.css'],
preserveWhitespace: true,
)
class MaterialCheckboxExample {
/// Todo list example
List<Todo> todos;
String todoText;
MaterialCheckboxExample() {
todos = [
Todo('learn angular', true),
Todo('build an angular app', false),
Todo('profit!', false),
];
}
Control newTodo = Control("");
void addTodo() {
todos.add(Todo(newTodo.value, false));
newTodo.updateValue("");
}
int remaining() => todos.where((todo) => !todo.done).length;
/// Custom example
bool disabledState = false;
bool checkedState = false;
bool indeterminateState = false;
bool indeterminateBehavior = false;
String customLabel = "custom label";
Control newLabel = Control("");
String statusStr = "???";
void setLabel() {
customLabel = newLabel.value;
newLabel.updateValue("");
}
}
class Todo {
String text;
bool done;
Todo(this.text, this.done);
}