mirror of
https://github.com/flutter/samples.git
synced 2025-11-10 14:58:34 +00:00
Add samples index (#359)
* add samples_index to web/ directory Co-authored-by: Thea Flowers <theaflowers@google.com> * add pub_get.dart script * build sample index in peanut post build * re-generate sample index with web demos * print more details in peanut_post_build.dart * add images for demos * run generator * update README * add animations and provider shopper as symlinks * add links to symlinked web demos * use relative paths * update cookbook images, urls, and description CSS * use relative URL for navbar link * unstage HTML files * .gitignore generated HTML files * add margin to toolbar * rename escape functions * add and update copyright headers Co-authored-by: Thea Flowers <theaflowers@google.com>
This commit is contained in:
@@ -1,40 +1,68 @@
|
||||
Web samples
|
||||
# Sample Index and Web Demos
|
||||
|
||||
## See the samples in action
|
||||
This directory contains the index hosted at [flutter.github.io/samples][samples]
|
||||
and web demos hosted with it.
|
||||
|
||||
## See the demos in action
|
||||
|
||||
Compiled versions of the samples are hosted at
|
||||
[flutter.github.io/samples][samples].
|
||||
[flutter.github.io/samples/#?platform=web][samples].
|
||||
|
||||
## Building samples code
|
||||
|
||||
Go into one of the sample directories, get packages, and run using the `chrome`
|
||||
device:
|
||||
Update Flutter and enable web support
|
||||
|
||||
```console
|
||||
$ flutter channel dev
|
||||
$ flutter upgrade
|
||||
$ cd gallery
|
||||
$ flutter pub get
|
||||
$ flutter config --enable-web
|
||||
```
|
||||
|
||||
Run the demo using the `chrome` device type:
|
||||
|
||||
```console
|
||||
$ cd slide_puzzle
|
||||
$ flutter packages get
|
||||
$ flutter run -d chrome
|
||||
```
|
||||
|
||||
You should see a message printing the URL to access: `http://localhost:8080`
|
||||
|
||||
Web support is available as a technical preview and is only available in the
|
||||
`dev` or `master` channels.
|
||||
|
||||
You should see a message printing the URL to access: `http://localhost:8080`
|
||||
|
||||
## Deploying to GitHub Pages
|
||||
|
||||
This project uses [peanut][peanut] to build the samples and commit the output
|
||||
to the gh-pages branch. To deploy, run these commands in the `web/` directory:
|
||||
|
||||
Install the peanut command:
|
||||
|
||||
```console
|
||||
$ flutter pub global activate peanut
|
||||
```
|
||||
|
||||
Verify `pub get` has been run on each demo:
|
||||
|
||||
```console
|
||||
$ dart _tool/verify_packages
|
||||
```
|
||||
|
||||
Build all demos, along with the sample index:
|
||||
|
||||
```console
|
||||
$ flutter pub global run peanut
|
||||
```
|
||||
|
||||
Deploy to GitHub Pages:
|
||||
|
||||
```console
|
||||
$ git push origin gh-pages:gh-pages
|
||||
```
|
||||
|
||||
Note: `flutter packages get` must be run in each sample before running `peanut`.
|
||||
## Building the sample index
|
||||
|
||||
See sample_index/README.md for details
|
||||
|
||||
[web]: https://flutter.dev/web
|
||||
[samples]: https://flutter.github.io/samples/
|
||||
|
||||
Reference in New Issue
Block a user