CSS Dart HTML JavaScript Ruby Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_data Add iOS download for VivaBem UOL (#1025) May 14, 2018
_diagrams Adding a page on staggered animations. (#763) Dec 21, 2017
_includes Remove references to `flutter run` in setup docs (#1057) Jun 6, 2018
_layouts Fix links in "File issue" links Apr 2, 2018
_plugins make the CLI prompt non-selectable (#669) Sep 14, 2017
_sass Fix word-wrapping of code (#1043) May 24, 2018
animations Addressing still-valid bugs in a PR (#1052) Jun 6, 2018
catalog/samples Reenable proper .md snippet extraction, fix analysis errors in cookbo… Apr 27, 2018
codelabs Adding MDC codelabs. (#1016) May 10, 2018
cookbook App Maintenance and more Navigation recipes (#995) May 21, 2018
css Add showcase section (#1007) May 7, 2018
downloads Update sheets to reflect removed full restart keyboard shortcut (#494) Apr 7, 2017
firebase_config default jekyll build location, default to staging server on non-maste… ( Apr 28, 2016
flutter-for-react-native Latest rn changes (#1054) Jun 5, 2018
get-started Update editor.md (#1044) May 29, 2018
images Add a doc for using Fastlane (#1026) May 18, 2018
js Combine Linux/Unix conditions Apr 23, 2018
showcase Fix download links (#1014) May 8, 2018
tool adjust analysis options (#1050) Jun 1, 2018
tutorials Addressing still-valid bugs in a PR (#1052) Jun 6, 2018
ui-performance Update IDE steps to be consistent with supported IDEs (#997) May 3, 2018
widgets Fixing missing material page contents (#810) Feb 21, 2018
.gitignore Ignore Jekyll metadata (#824) Feb 26, 2018
.travis.yml Update to latest rubygems (#960) Apr 16, 2018
404.md Fix Uri of 404 page (#776) Jan 8, 2018
AUTHORS Flutter for iOS — Page contents (squashed) (#993) May 21, 2018
Gemfile adding rake to Gemfile. Rake is used to validate links as described i… Apr 9, 2018
Gemfile.lock Update to latest rubygems (#960) Apr 16, 2018
README.md Add an extra troubleshooting tip for development on macOS (#1030) May 16, 2018
Rakefile Fix Apple.com links (#931) Apr 5, 2018
_config.yml Updated url property to use https Feb 4, 2016
accessiblity.md Initial accessibility docs (#902) Apr 24, 2018
analysis_options.yaml Fix Build (#916) Mar 29, 2018
android-release-build.md Android obfuscation (#1002) Jun 6, 2018
assets-and-images.md Tweaks to asset directory docs (#1049) May 31, 2018
bootstrap-into-dart.md Adding codelab links to website! (#578) May 26, 2017
bug_reports.md New homepage (#555) May 15, 2017
debugging.md Added sample code to enable Visual Debugging (#1033) May 18, 2018
design-principles.md Put brief justification right under summary (#1053) Jun 5, 2018
developing-packages.md Removing instances of "yourcompany" and replacing with "example". (co… May 16, 2018
docs.md Update docs.md (#1034) May 21, 2018
faq.md A few FAQ updates (#1031) May 18, 2018
fastlane.md Add a doc for using Fastlane (#1026) May 18, 2018
firebase.json Rename 'full start' to 'hot restart' (#1024) May 15, 2018
flutter-for-android.md Adding info on landscape view to Android page. (#1037) May 31, 2018
flutter-for-ios.md Adding info on landscape view to Android page. (#1037) May 31, 2018
formatting.md Update references from Dart Code to Flutter plugin (#1027) May 16, 2018
gestures.md Fix some more typos (#862) Mar 5, 2018
hot-reload.md Rename 'full start' to 'hot restart' (#1024) May 15, 2018
index.md Update interop list (#1021) May 30, 2018
inspector.md Reworked getting started experience (#800) Feb 26, 2018
ios-release-build.md Update apple icons link (#969) Apr 27, 2018
json.md Update dependencies for json_serializable (#1017) May 9, 2018
layout.md fix layout.md (#768) Dec 27, 2017
platform-channels.md Remove GeneratedPluginRegistrant (#1041) May 23, 2018
pubspec.yaml Reenable proper .md snippet extraction, fix analysis errors in cookbo… Apr 27, 2018
rendering.md New homepage (#555) May 15, 2017
sdk-archive.md Add new SDK archive page (#901) Mar 23, 2018
search.md adding a custom search engine Dec 9, 2015
support.md encourage people to thumbs up issues (#579) May 30, 2017
technical-overview.md Addressing still-valid bugs in a PR (#1052) Jun 6, 2018
testing.md Update testing.md (#1056) Jun 6, 2018
tos.md New homepage (#555) May 15, 2017
upgrading.md Change dev to beta (#837) Feb 28, 2018
using-ide-vscode.md Addressing still-valid bugs in a PR (#1052) Jun 6, 2018
using-ide.md Addressing still-valid bugs in a PR (#1052) Jun 6, 2018
using-packages.md Restart is needed after adding a plugin dependency (#1038) May 22, 2018
web-analogs.md Fix incorrect wordSpacing code markup (#1061) Jun 10, 2018
widgets-intro.md Addressing still-valid bugs in a PR (#1052) Jun 6, 2018
widgets.md Widgetindex & Duplicate removal (#558) May 22, 2017

README.md

Flutter's website

The website for Flutter.

Build Status

Issues, bugs, and requests

We welcome contributions and feedback on our website! Please file a request in our issue tracker and we'll take a look.

Developing

Install Jekyll and related tools by following the instructions provided by GitHub.

A tldr version follows:

  1. Ensure you have Ruby installed; you need version 2.2.2 or later:
    ruby --version

  2. Ensure you have Bundler installed; if not install with:
    gem install bundler

  3. Install all dependencies:
    bundle install

    • On macOS, if you encounter errors while building native Ruby extensions, see Installing Nokogiri for troubleshooting tips.
  4. Create a branch.

  5. Make your changes.

  6. Test your changes by serving the site locally:
    bundle exec jekyll serve (or jekyll serve -w --force_polling)

  7. Prior to submitting, run link validation:
    rake checklinks

Deploy to a staging site

For edits made directly in the GitHub web UI, the changes will be deployed to a staging site (such as https://flutter-io-deploy-three.firebaseapp.com/inspector) by the Travis job.

For edits you make locally (using the 'developing' steps above), you can deploy them to a personal staging site as follows (steps 1 and 2 need to be done only once):

  1. In the Firebase Console, create your own Firebase project (e.g. 'mit-flutter-staging')

  2. Tell Firebase about that project with the firebase use command:

    $ firebase use --add
    ? Which project do you want to add? <select the project you created>
    ? What alias do you want to use for this project? (e.g. staging) staging
    
  3. Tell Firebase that you want to deploy to staging:

    $ firebase use staging
    Now using alias staging (<your project name>)
    
  4. Tell Firebase to deploy:

    $ firebase use staging
    Now using alias staging (<your project name>)
    $ firebase deploy
    
    === Deploying to '<your project name>'...
    
    i  deploying hosting
    i  hosting: preparing _site directory for upload...
    ✔  hosting: 213 files uploaded successfully
    i  starting release process (may take several minutes)...
    
    ✔  Deploy complete!
    

Writing for flutter.io

(Eventually, this section should be expanded to its own page.)

Adding next/previous page links

If you have a document that spans multiple pages, you can add next and previous page links to make navigating these pages easier. It involves adding some information to the front matter of each page, and including some HTML.

---
layout: tutorial
title: "Constraints"

permalink: /tutorials/layout/constraints.html
prev-page: /tutorials/layout/properties.html
prev-page-title: "Container Properties"
next-page: /tutorials/layout/create.html
next-page-title: "Create a Layout"
---

{% include prev-next-nav.html %}

{:toc}

<!-- PAGE CONTENT -->

{% include prev-next-nav.html %}

Omit the "prev-page" info for the first page, and the "next-page" info for the last page.

Syntax highlighting

The flutter.io website uses prism.js for syntax highlighting. This section covers how to use syntax highlighting, and how to update our syntax highlighter for new languages.

Supported languages

This website can syntax highlight the following languages:

  • shell
  • dart
  • html
  • css
  • javascript
  • java
  • objectivec
  • swift

Using syntax highlighting

The easiest way to syntax highlight a block of code is to wrap it with triple backticks followed by the language.

Here's an example:

```dart
class ExampleWidget extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new Container();
  }
}
```

See the list of supported languages above for what to use following the first triple backticks.

Adding more languages for syntax highlighting

The flutter.io website uses a custom build of prism, which includes only the languages the website requires. To improve load times and user experience, we do not support every language that prism supports.

To add a new language for syntax highlighting, you will need to generate a new copy of the prism.js file.

Follow these steps to generate a new copy of prism.js:

  • Open js/prism.js
  • Copy the URL in the comment of the first line of the file
  • Paste it into a browser window/tab
  • Add the new language that you wish to syntax highlight
  • DO NOT change the other plugins, languages, or settings
  • Download the generated JavaScript, and use it to replace js/prism.js
  • Download the generated CSS, and use it to replace _sass/_prism.scss

Advanced stylization of code blocks

Do you want to highlight (make the background yellow) code inside a code block? Do you want to strike-through code inside a code block? We got that!

For syntax highlighting, plus yellow highlighting and strike-through formatting, use the prettify tag with additional custom inline markup.

If you want to highlight a specific bit of code, use the [[highlight]]highlight this text[[/highlight]] syntax with the prettify tag.

For example:

{% prettify dart %} void main() { print([[highlight]]'Hello World'[[/highlight]]); } {% endprettify %}

If you want to strike-through a specific bit of code, use the [[strike]]highlight this text[[/strike]] syntax with the prettify tag.

For example:

{% prettify dart %} void main() { print([[strike]]'Hello World'[[/strike]]); } {% endprettify %}

The prettify plugin will also unindent your code.

If you want to see how this functionality was added to this site, refer to this commit.

Including a region of a file

You can include a specific range of lines from a file:

{% include includelines filename=PATH start=INT count=INT %}

PATH must be inside of _include. If you are including source code, place that code into _include/code to follow our convention.

Code snippet validation

The code snippets in the markdown documentation are validated as part of the build process. Anything within a '```dart' code fence will be extracted into its own file and checked for analysis issues. Some ways to tweak that:

  • If a code snippet should not be analyzed, immediately proceed it with a <!-- skip --> comment
  • To include code to be analyzed, but not displayed, add that in a comment immediately proceeding the snippet (e.g., <!-- someCodeHere(); -->)
  • A snippet without any import statements will have an import ('package:flutter/material.dart') automatically added to it
  • We ignore special formatting tags like [[highlight]].

Updating the Sample Catalog

The sample catalog's markdown files are generated by running sample_page.dart from the Flutter github repo. Starting from the root of the Flutter repo:

cd examples/catalog
dart bin/sample_page.dart '<commit hashcode here>'
cp examples/catalog/.generated/*.md <your website repo>/catalog/samples

The generated markdown files will contain cloud storage links for sample app screenshots. Screenshots for each sample app are automatically generated for each Flutter repo commit. Choose a recent commit hashcode and confirm that the screenshots look OK.

If new sample apps have been added, update _data/catalog/widget.json. The entry for each widget class that's featured in a sample app should contain "sample" line like:

"sample": "ListView_index",

The sample_page.dart app will print a list of all of the "sample" properties that should appear in the widget.json file.

Preventing broken links

Some form of broken links prevention is done automatically by rake checklinks on every commit (through tool/travis.sh). But this won't see any Firebase redirects (rake checklinks doesn't run the Firebase server) and it won't check incoming links.

Before we can move the more complete automated linkcheck solution from dartlang.org, we recommend manually running the following.

  • First time setup:

    pub global activate linkcheck
    npm install -g superstatic
    
  • Start the localhost Firebase server:

    superstatic --port 3474
    
  • Run the link checker:

    linkcheck :3474
    

    Even better, to check that old URLs are correctly redirected:

    linkcheck :3474 --input-file tool/sitemap.txt