OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library survey.models; | 5 library survey.models; |
6 | 6 |
7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
8 | 8 |
9 final appModel = new SurveyApp(); | 9 final appModel = new SurveyApp(); |
10 | 10 |
11 /* | 11 /* |
12 * The model for the SurveyApp. | 12 * The model for the SurveyApp. |
13 */ | 13 */ |
14 class SurveyApp extends ObservableBase { | 14 class SurveyApp extends Observable { |
15 @observable String title = ''; | 15 @observable String title = ''; |
16 @observable String description = ''; | 16 @observable String description = ''; |
17 @observable List<Question> questions; | 17 @observable List<Question> questions; |
18 | 18 |
19 SurveyApp(); | 19 SurveyApp(); |
20 } | 20 } |
21 | 21 |
22 /* | 22 /* |
23 * Model for a survey question. [answerOptions] is the list of options from | 23 * Model for a survey question. [answerOptions] is the list of options from |
24 * which the user picks one or more [answers]. | 24 * which the user picks one or more [answers]. |
25 */ | 25 */ |
26 class Question extends ObservableBase { | 26 class Question extends Observable { |
27 @observable String text; | 27 @observable String text; |
28 @observable String helpText; | 28 @observable String helpText; |
29 @observable List<String> answerOptions = []; | 29 @observable List<String> answerOptions = []; |
30 @observable List<String> answers = []; | 30 @observable List<String> answers = []; |
31 | 31 |
32 Question([this.text = '', this.helpText = '']); | 32 Question([this.text = '', this.helpText = '']); |
33 | 33 |
34 bool get isValid => text.isNotEmpty; | 34 bool get isValid => text.isNotEmpty; |
35 } | 35 } |
OLD | NEW |