Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/_data/mirrors.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
- group: 'China Flutter User Group'
mirror: 'flutter-io.cn'
urls:
pubhosted: 'https://pub.flutter-io.cn'
flutterstorage: 'https://storage.flutter-io.cn'
issues: 'https://github.com/cfug/flutter.cn/issues/new/choose'
group: https://github.com/cfug
- group: 'Shanghai Jiao Tong University *nix User Group'
mirror: 'mirror.sjtu.edu.cn'
urls:
pubhosted: 'https://mirror.sjtu.edu.cn/flutter-infra'
flutterstorage: 'https://mirror.sjtu.edu.cn'
issues: 'https://github.com/sjtug/mirror-requests'
group: https://github.com/sjtug
- group: 'Tsinghua University TUNA Association'
mirror: 'mirrors.tuna.tsinghua.edu.cn'
urls:
pubhosted: 'https://mirrors.tuna.tsinghua.edu.cn/dart-pub'
flutterstorage: 'https://mirrors.tuna.tsinghua.edu.cn/flutter'
issues: 'https://github.com/tuna/issues'
group: https://tuna.moe

6 changes: 6 additions & 0 deletions src/_includes/docs/china-notice-cn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{{site.alert.secondary}}
如果你正在中国的网络环境下配置 Flutter,
请参考 [在中国网络环境下使用 Flutter][] 文档.
{{site.alert.end}}

[在中国网络环境下使用 Flutter]: https://flutter.cn/community/china
4 changes: 2 additions & 2 deletions src/_includes/docs/china-notice.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{site.alert.important}}
If you're in China, read [Using Flutter in China][].
If you develop apps in China, check out [using Flutter in China][].
{{site.alert.end}}

[Using Flutter in China]: {{site.url}}/community/china
[using Flutter in China]: {{site.url}}/community/china
5 changes: 3 additions & 2 deletions src/assets/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ document.addEventListener("DOMContentLoaded", function(_) {
setupTabs($('#vscode-to-vs-setup'), 'dev.flutter.debug.vscode-to-vs');
setupTabs($('#add-to-app-android'), 'dev.flutter.add-to-app.android');
setupTabs($('#add-to-app-android-deps'), 'dev.flutter.add-to-app.android.deps');


setupTabs($('#ios-versions'), 'dev.flutter.ios-versions');
setupTabs($('#china-os-tabs'), 'dev.flutter.china-os');
setupTabs($('#china-os-dl-tabs'), 'dev.flutter.china-os-dl');
setupTabs($('#china-os-pub-tabs'), 'dev.flutter.china-os-pub');

prettyPrint();
});
Expand Down
79 changes: 0 additions & 79 deletions src/community/china.md

This file was deleted.

35 changes: 35 additions & 0 deletions src/community/china/_download-urls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

{% assign id = include.ref-os | downcase -%}
{% assign mainpath = include.filepath -%}
{%- case id %}
{% when 'windows','macos' %}
{%- assign file-format = 'zip' %}
{% else %}
{%- assign file-format = 'tar.xz' %}
{% endcase %}
{%- if id == 'chromeos' %}
{% assign plat = 'linux' %}
{%- else %}
{% assign plat = id %}
{% endif %}
{% capture filepath -%}{{mainpath | replace: "opsys", plat}}{{file-format}} {% endcapture -%}


<div id="{{id}}-dl" class="tab-pane
{%- if id == 'windows' %} active {% endif %}"
role="tabpanel" aria-labelledby="{{id}}-dl-tab" markdown="1">

To download the {{include.ref-os}} 3.13 version of the Flutter SDK,
you would change the original URL from:

```terminal
https://storage.googleapis.com/{{filepath}}
```

to the mirror URL:

```terminal
https://storage.flutter-io.cn/{{filepath}}
```

</div>
124 changes: 124 additions & 0 deletions src/community/china/_os-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{% assign id = include.ref-os | downcase -%}
{% assign jsonurl = 'https://storage.googleapis.com/flutter_infra_release/releases/releases_{{id}}.json' %}
{% assign os = include.ref-os -%}
{% assign sdk = include.sdk -%}

{% if id == 'windows' -%}
{% assign shell = 'Powershell' -%}
{% assign prompt = 'C:\>' -%}
{% assign comtoset = '$env:' -%}
{% assign installdirsuggestion = '`%USERPROFILE%\dev`' %}
{% capture envvarset -%}{{prompt}} {{comtoset}}{% endcapture -%}
{% capture setpath -%}{{envvarset}}PATH = $pwd.PATH + "/flutter/bin",$env:PATH -join ";"{% endcapture -%}
{% capture newdir -%}{{prompt}} New-Item -Path '{{installdirsuggestion}}' -ItemType Directory{% endcapture -%}
{% capture unzip -%} {{prompt}} Extract-Archive:{% endcapture -%}
{% capture permaddexample -%}
$newPath = $pwd.PATH + "/flutter/bin",$env:PATH -join ";"
[System.Environment]::SetEnvironmentVariable('Path',$newPath,User)
[System.Environment]::SetEnvironmentVariable('PUB_HOSTED_URL','https://pub.flutter-io.cn',User)
[System.Environment]::SetEnvironmentVariable('FLUTTER_STORAGE_BASE_URL','https://storage.flutter-io.cn',User)
{% endcapture -%}
{% else -%}
{% assign shell = 'your terminal' -%}
{% assign prompt = '$' -%}
{% assign comtoset = 'export ' -%}
{% assign installdirsuggestion = '`~/dev`' %}
{% capture envvarset -%}{{prompt}} {{comtoset}}{% endcapture -%}
{% capture setpath -%}{{envvarset}}PATH="$PWD/flutter/bin:$PATH"{% endcapture -%}
{% capture newdir -%}{{prompt}} mkdir ~/dev{% endcapture -%}
{% if id == 'macos' %}
{% capture unzip -%} {{prompt}} unzip{% endcapture -%}
{% else %}
{% capture unzip -%} {{prompt}} tar -xf{% endcapture -%}
{% endif %}
{% capture permaddexample -%}
cat <<EOT >> ~/.zprofile
{{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn"
{{envvarset}}FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
{{setpath}}
EOT
{% endcapture -%}
{% endif -%}
{%- case id %}
{% when 'windows','macos' %}
{%- assign file-format = 'zip' %}
{%- assign download-os = id %}
{% when 'linux','chromeos' %}
{%- assign download-os = 'linux' %}
{%- assign file-format = 'tar.xz' %}
{% endcase %}

<div id="{{id}}" class="tab-pane
{%- if id == 'windows' %} active {% endif %}"
role="tabpanel" aria-labelledby="{{id}}-tab" markdown="1">

This procedure requires using {{shell}}.

1. Open a new window in {{shell}} to prepare running scripts.

1. Set `PUB_HOSTED_URL` to your mirror site.

```terminal
{{envvarset}}PUB_HOSTED_URL="https://pub.flutter-io.cn"
```

1. Set `FLUTTER_STORAGE_BASE_URL` to your mirror site.

```terminal
{{envvarset}}FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
```

1. Download the Flutter archive from your mirror site.

@parlough parlough Nov 2, 2023

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Archive" implies the entire archive, perhaps "build" or "installation bundle".

Suggested change
1. Download the Flutter archive from your mirror site.
1. Download the Flutter installation bundle for
your platform from your desired mirror site.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A zip file or a tar file are archive file formats. Going to keep as-is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's technically true, but it's quite confusing since it uses "archive" to mean two different things in this same step. It reads as if it's telling me to download the entire archive page.

In your preferred browser, go to

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In your preferred browser, go to
In your preferred browser, go to the

[Flutter SDK archive](https://flutter.cn/docs/release/archive?tab={{id}}).
Comment thread
parlough marked this conversation as resolved.

1. Create a folder where you can install Flutter. then change into it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Create a folder where you can install Flutter. then change into it.
1. Create a folder where you can install Flutter, then change into it.


Consider a path like {{installdirsuggestion}}.

```terminal
{{newdir}}; cd {{installdirsuggestion}}
```

1. Extract the the SDK from the {{file-format}} archive file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Extract the the SDK from the {{file-format}} archive file.
1. Extract the the SDK from the `{{file-format}}` archive file.


This example assumes you downloaded the {{os}} version of the Flutter SDK.

```terminal
{{unzip}} {{sdk | replace: "opsys", download-os}}{{file-format}}
```

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recommend adding an extra sentence to explicitly explain that they need to use the exact name of the specific bundle they downloaded here. When there are terminal code blocks, readers often just copy paste without much consideration, or they may be new to this type of activity and may not know.


1. Add Flutter to your `PATH` environment variable.

```terminal
{{setpath}}
```

1. Run Flutter Doctor to verify your installation.

```terminal
{{prompt}} flutter doctor
```

1. Return to the [setting up Flutter]({{site.url}}/get-started/editor)
guide and continue from that procedure.

From this example, `flutter pub get` fetches packages from `flutter-io.cn`,
in any terminal where you set `PUB_HOSTED_URL` and `FLUTTER_STORAGE_BASE_URL`.
Comment on lines +106 to +107

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you intend to mean by "from this example"? "After completing the steps of this procedure"?


Any environment variables set using `{{comtoset}}` in this procedure
only apply to the current window.

To set these values on a permanent basis,
{% if id == 'windows' -%}
set the enviroment variables as in the following example:
{% else -%}
append those three `export` commands to the `*rc` or `*profile`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while since the export commands at this point. I wasn't sure what you were referring to at first.

Suggested change
append those three `export` commands to the `*rc` or `*profile`
append the previous three `export` commands to the `*rc` or `*profile`

file that your preferred shell uses. This would resemble the following:
{% endif -%}

```terminal
{{permaddexample}}
```

</div>
44 changes: 44 additions & 0 deletions src/community/china/_pub-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

{% assign id = include.os | downcase -%}

<div id="{{id}}-pub" class="tab-pane
{%- if id == 'windows' %} active {% endif %}"
role="tabpanel" aria-labelledby="{{id}}-tab" markdown="1">

1. Configure a proxy.
To configure a proxy, check out the [Dart documentation on proxies][].

{% comment %}
From https://github.com/flutter/website/issues/2556#issuecomment-481566476
{% endcomment %}

1. Verify that your `PUB_HOSTED_URL` environment variable is either unset
or empty.

{% if id == 'windows' -%}

```terminal
{{prompt}} echo $env:PUB_HOSTED_URL
```

If this command returns any value, unset it.

```terminal
{{prompt}} Remove-Item $env:PUB_HOSTED_URL
```

{% else -%}

```terminal
{{prompt}} echo $PUB_HOSTED_URL
```

If this command returns any value, unset it.

```terminal
{{prompt}} unset $PUB_HOSTED_URL
```

{% endif %}

</div>
Loading