├── CHANGELOG.md ├── web ├── favicon.png ├── main.dart ├── styles.css └── index.html ├── AUTHORS ├── .gitignore ├── lib ├── app_component.css ├── app_component.html └── app_component.dart ├── analysis_options.yaml ├── README.md ├── pubspec.yaml ├── LICENSE └── CONTRIBUTING.md /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.0.1 4 | 5 | - Initial version 6 | -------------------------------------------------------------------------------- /web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dart-archive/io_2017_components_codelab/master/web/favicon.png -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | # Below is a list of people and organizations that have contributed 2 | # to the project. Names should be added to the list like so: 3 | # 4 | # Name/Organization 5 | 6 | Google Inc. 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .packages 3 | .pub/ 4 | build/ 5 | # Remove the following pattern if you wish to check in your lock file 6 | pubspec.lock 7 | 8 | # Directory created by dartdoc 9 | doc/api/ 10 | 11 | .idea/ 12 | -------------------------------------------------------------------------------- /lib/app_component.css: -------------------------------------------------------------------------------- 1 | :host { 2 | /* This is equivalent of the 'body' selector of a page. */ 3 | } 4 | 5 | .first { 6 | color: #2196F3; 7 | } 8 | 9 | .is-saved { 10 | color: #ccc; 11 | } 12 | 13 | .is-saved .first { 14 | color: #ddd; 15 | } 16 | -------------------------------------------------------------------------------- /web/main.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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. 4 | 5 | import 'package:angular/angular.dart'; 6 | 7 | import 'package:startup_namer/app_component.dart'; 8 | 9 | void main() { 10 | bootstrap(AppComponent); 11 | } 12 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | analyzer: 2 | strong-mode: true 3 | # exclude: 4 | # - path/to/excluded/files/** 5 | 6 | # Lint rules and documentation, see http://dart-lang.github.io/linter/lints 7 | linter: 8 | rules: 9 | - cancel_subscriptions 10 | - hash_and_equals 11 | - iterable_contains_unrelated_type 12 | - list_remove_unrelated_type 13 | - test_types_in_equals 14 | - unrelated_type_equality_checks 15 | - valid_regexps 16 | -------------------------------------------------------------------------------- /web/styles.css: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2017. All rights reserved. Use of this source code 2 | is governed by a BSD-style license that can be found in the LICENSE file. */ 3 | 4 | @import url(https://fonts.googleapis.com/css?family=Roboto); 5 | @import url(https://fonts.googleapis.com/css?family=Material+Icons); 6 | 7 | body { 8 | max-width: 600px; 9 | margin: 0 auto; 10 | padding: 5vw; 11 | } 12 | 13 | * { 14 | font-family: Roboto, Helvetica, Arial, sans-serif; 15 | } 16 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Startup Namer 2 | 3 | Created for a Google I/O 2017 codelab, this AngularDart app smashes together 4 | words, helping you brainstorm ideas for your naming your next startup. 5 | 6 | More information: 7 | * Codelab: [Write a Material Design AngularDart Web App](https://codelabs.developers.google.com/codelabs/your-first-angulardart-web-app/) 8 | * Documentation: [AngularDart](https://webdev.dartlang.org/angular), 9 | [AngularDart Components](https://webdev.dartlang.org/components) 10 | 11 | See LICENSE. 12 | -------------------------------------------------------------------------------- /web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | startup_namer 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

Name your next startup

14 | Loading... 15 | 16 | 17 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: startup_namer 2 | description: A web app that uses AngularDart Components 3 | version: 0.0.1 4 | 5 | environment: 6 | sdk: '>=1.24.0 <2.0.0' 7 | 8 | dependencies: 9 | angular: ^4.0.0 10 | angular_components: ^0.6.0 11 | english_words: ^2.0.4 12 | 13 | dev_dependencies: 14 | angular_test: ^1.0.0 15 | browser: ^0.10.0 16 | dart_to_js_script_rewriter: ^1.0.1 17 | test: ^0.12.0 18 | 19 | transformers: 20 | - angular: 21 | entry_points: 22 | - web/main.dart 23 | - test/**_test.dart 24 | - test/pub_serve: 25 | $include: test/**_test.dart 26 | - dart_to_js_script_rewriter 27 | -------------------------------------------------------------------------------- /lib/app_component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Get new ideas 4 | 5 | 6 | 7 |
8 | 11 | {{item.first}}{{item.second}}.com 12 | 13 |
14 |
15 |
Saved names
16 | 18 | {{item.first}}{{item.second}}.com 19 | 20 |
21 |
22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2017, the Dart project authors. All rights reserved. 2 | Redistribution and use in source and binary forms, with or without 3 | modification, are permitted provided that the following conditions are 4 | met: 5 | 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above 9 | copyright notice, this list of conditions and the following 10 | disclaimer in the documentation and/or other materials provided 11 | with the distribution. 12 | * Neither the name of Google Inc. nor the names of its 13 | contributors may be used to endorse or promote products derived 14 | from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /lib/app_component.dart: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 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. 4 | 5 | import 'package:angular/angular.dart'; 6 | import 'package:angular_components/angular_components.dart'; 7 | import 'package:english_words/english_words.dart'; 8 | 9 | // AngularDart info: https://webdev.dartlang.org/angular 10 | // Components info: https://webdev.dartlang.org/components 11 | 12 | @Component( 13 | selector: 'my-app', 14 | styleUrls: const ['app_component.css'], 15 | templateUrl: 'app_component.html', 16 | // TODO: Remove MaterialIconComponent from directives. 17 | // (Blocked on https://github.com/dart-lang/angular_components/issues/145.) 18 | directives: const [CORE_DIRECTIVES, materialDirectives, MaterialIconComponent], 19 | providers: const [materialProviders], 20 | ) 21 | class AppComponent implements OnInit { 22 | var names = []; 23 | final savedNames = new Set(); 24 | 25 | void generateNames() { 26 | names = generateWordPairs().take(5).toList(); 27 | } 28 | 29 | @override 30 | void ngOnInit() { 31 | generateNames(); 32 | } 33 | 34 | void addToSaved(WordPair name) { 35 | savedNames.add(name); 36 | } 37 | 38 | void removeFromSaved(WordPair name) { 39 | savedNames.remove(name); 40 | } 41 | 42 | void toggleSavedState(WordPair name) { 43 | if (savedNames.contains(name)) { 44 | removeFromSaved(name); 45 | return; 46 | } 47 | addToSaved(name); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Want to contribute? Great! First, read this page (including the small print at 2 | the end). 3 | 4 | ### Before you contribute 5 | 6 | Before we can use your code, you must sign the 7 | [Google Individual Contributor License Agreement][CLA] (CLA), which you can do 8 | online. The CLA is necessary mainly because you own the copyright to your 9 | changes, even after your contribution becomes part of our codebase, so we need 10 | your permission to use and distribute your code. We also need to be sure of 11 | various other things—for instance that you'll tell us if you know that your code 12 | infringes on other people's patents. You don't have to sign the CLA until after 13 | you've submitted your code for review and a member has approved it, but you must 14 | do it before we can put your code into our codebase. 15 | 16 | Before you start working on a larger contribution, you should get in touch with 17 | us first through the issue tracker with your idea so that we can help out and 18 | possibly guide you. Coordinating up front makes it much easier to avoid 19 | frustration later on. 20 | 21 | [CLA]: https://cla.developers.google.com/about/google-individual 22 | 23 | ### Code reviews 24 | 25 | All submissions, including submissions by project members, require review. We 26 | recommend [forking the repository][fork], making changes in your fork, and 27 | [sending us a pull request][pr] so we can review the changes and merge them into 28 | this repository. 29 | 30 | [fork]: https://help.github.com/articles/about-forks/ 31 | [pr]: https://help.github.com/articles/creating-a-pull-request/ 32 | 33 | Functional changes will require tests to be added or changed. The tests live in 34 | the `test/` directory, and are run with `pub run test`. If you need to create 35 | new tests, use the existing tests as a guideline for what they should look like. 36 | 37 | Before you send your pull request, make sure all the tests pass! 38 | 39 | ### File headers 40 | 41 | All files in the project must start with the following header. 42 | 43 | // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 44 | // for details. All rights reserved. Use of this source code is governed by a 45 | // BSD-style license that can be found in the LICENSE file. 46 | 47 | ### The small print 48 | 49 | Contributions made by corporations are covered by a different agreement than the 50 | one above, the 51 | [Software Grant and Corporate Contributor License Agreement][CCLA]. 52 | 53 | [CCLA]: https://developers.google.com/open-source/cla/corporate 54 | --------------------------------------------------------------------------------