This repository has been archived by the owner on May 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 125
/
material_select_demo.dart
61 lines (53 loc) · 2.09 KB
/
material_select_demo.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
// 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_components/focus/focus_item.dart';
import 'package:angular_components/focus/focus_list.dart';
import 'package:angular_components/material_select/display_name.dart';
import 'package:angular_components/material_select/material_select.dart';
import 'package:angular_components/material_select/material_select_item.dart';
import 'package:angular_components/model/selection/selection_model.dart';
import 'package:angular_components/model/selection/selection_options.dart';
import 'package:angular_components/model/ui/display_name.dart';
@Component(
selector: 'material-select-demo',
directives: [
displayNameRendererDirective,
FocusItemDirective,
FocusListDirective,
MaterialSelectComponent,
MaterialSelectItemComponent,
NgFor,
],
templateUrl: 'material_select_demo.html',
styleUrls: ['material_select_demo.scss.css'],
)
class MaterialSelectDemoComponent {
final SelectionModel<String> defaultLanguageSelection =
SelectionModel.single();
final SelectionModel<Language> targetLanguageSelection =
SelectionModel.multi();
String proto;
static const protocols = ['ftp', 'http', 'https'];
static const languagesList = [
Language('en-US', 'US English'),
Language('en-UK', 'UK English'),
Language('fr-CA', 'Canadian French')
];
List<Language> get languages => languagesList;
final SelectionOptions<Language> languageOptions =
SelectionOptions.fromList(languagesList);
final languageOptionsGrouped = SelectionOptions([
OptionGroup<Language>.withLabel(languagesList, 'North America'),
OptionGroup<Language>.withLabel(
[Language('ja', 'Japanese'), Language('ko', 'Korean')], 'Asia')
]);
}
class Language implements HasUIDisplayName {
final String code;
final String label;
const Language(this.code, this.label);
@override
String get uiDisplayName => label;
}