diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1c382e452..d12902a26 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -33,7 +33,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44 + uses: github/codeql-action/init@807578363a7869ca324a79039e6db9c843e0e100 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -44,7 +44,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44 + uses: github/codeql-action/autobuild@807578363a7869ca324a79039e6db9c843e0e100 # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -58,4 +58,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44 + uses: github/codeql-action/analyze@807578363a7869ca324a79039e6db9c843e0e100 diff --git a/.github/workflows/scorecards-analysis.yml b/.github/workflows/scorecards-analysis.yml index 4d290f18c..2712d2a1f 100644 --- a/.github/workflows/scorecards-analysis.yml +++ b/.github/workflows/scorecards-analysis.yml @@ -49,6 +49,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44 + uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 with: sarif_file: results.sarif diff --git a/Dockerfile b/Dockerfile index 65c078dd5..c66abda86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3-slim-bullseye@sha256:7a82cbe60f2a9fe0ec6a5872d957f21b2faff23551df55b5c9511a7a5136a9b3 as base +FROM ruby:3-slim-bullseye@sha256:2fd51ded2c105603ad42099bc60a057ec93667a8ebefab75b780ea1d57efa517 as base ENV DEBIAN_FRONTEND=noninteractive ENV TZ=US/Pacific diff --git a/examples/misc/lib/effective_dart/design_bad.dart b/examples/misc/lib/effective_dart/design_bad.dart index c26e3ca28..a96335b2b 100644 --- a/examples/misc/lib/effective_dart/design_bad.dart +++ b/examples/misc/lib/effective_dart/design_bad.dart @@ -8,6 +8,13 @@ import 'package:examples_util/ellipsis.dart'; import 'design_good.dart'; +class Key {} + +class StatelessWidget { + final Key? key; + StatelessWidget({this.key}); +} + void miscDeclAnalyzedButNotTested() { (errors, monsters, subscription) { // #docregion code-like-prose @@ -161,6 +168,10 @@ class Point1 { double x, y; Point1(double this.x, double this.y); } + +class MyWidget extends StatelessWidget { + MyWidget({Key? super.key}); +} // #enddocregion dont-type-init-formals //---------------------------------------------------------------------------- diff --git a/examples/misc/lib/effective_dart/design_good.dart b/examples/misc/lib/effective_dart/design_good.dart index 44e9bbf78..a557a9af1 100644 --- a/examples/misc/lib/effective_dart/design_good.dart +++ b/examples/misc/lib/effective_dart/design_good.dart @@ -35,6 +35,13 @@ class Padding extends Widget { Padding({required double padding, required Widget child}); } +class Key {} + +class StatelessWidget { + final Key? key; + StatelessWidget({this.key}); +} + void miscDeclAnalyzedButNotTested() { (Iterable errors, Iterable monsters) { // #docregion code-like-prose @@ -349,6 +356,10 @@ class Point1 { double x, y; Point1(this.x, this.y); } + +class MyWidget extends StatelessWidget { + MyWidget({super.key}); +} // #enddocregion dont-type-init-formals //---------------------------------------------------------------------------- diff --git a/src/_guides/language/effective-dart/design.md b/src/_guides/language/effective-dart/design.md index d46f41c52..65f6c2a34 100644 --- a/src/_guides/language/effective-dart/design.md +++ b/src/_guides/language/effective-dart/design.md @@ -1849,8 +1849,11 @@ function's parameters. In those cases, you may need to annotate. {% include linter-rule-mention.md rule="type_init_formals" %} -If a constructor parameter is using `this.` to initialize a field, then the type -of the parameter is inferred to have the same type as the field. +If a constructor parameter is using `this.` to initialize a field, +or `super.` to forward a super parameter, +then the type of the parameter +is inferred to have the same type as +the field or super-constructor parameter respectively. {:.good} @@ -1859,6 +1862,10 @@ class Point { double x, y; Point(this.x, this.y); } + +class MyWidget extends StatelessWidget { + MyWidget({super.key}); +} {% endprettify %} {:.bad} @@ -1868,6 +1875,10 @@ class Point { double x, y; Point(double this.x, double this.y); } + +class MyWidget extends StatelessWidget { + MyWidget({Key? super.key}); +} {% endprettify %} diff --git a/src/_guides/libraries/_dart-html-tour.md b/src/_guides/libraries/_dart-html-tour.md index f54d71a38..3c2f7cfc9 100644 --- a/src/_guides/libraries/_dart-html-tour.md +++ b/src/_guides/libraries/_dart-html-tour.md @@ -335,7 +335,7 @@ The HttpRequest static method `getString()` is an easy way to get data from a web server. Use `await` with the `getString()` call to ensure that you have the data before continuing execution. -/void/g"?> + {% prettify dart tag=pre+code %} void main() async { String pageHtml = [!await HttpRequest.getString(url);!] @@ -359,7 +359,7 @@ If you need access to the HttpRequest, not just the text data it retrieves, you can use the `request()` static method instead of `getString()`. Here’s an example of reading XML data: -/void/g; /await.*;/[!$&!]/g"?> + ```dart void main() async { HttpRequest req = await HttpRequest.request( diff --git a/src/_guides/libraries/_dart-io-tour.md b/src/_guides/libraries/_dart-io-tour.md index 71fc12376..0876ccd95 100644 --- a/src/_guides/libraries/_dart-io-tour.md +++ b/src/_guides/libraries/_dart-io-tour.md @@ -206,7 +206,7 @@ This server listens on port 8888 and address 127.0.0.1 (localhost), responding to requests for the path `/dart`. For any other path, the response is status code 404 (page not found). -/void/g; /\b_//g"?> + ```dart void main() async { final requests = await HttpServer.bind('localhost', 8888); @@ -242,7 +242,7 @@ apps. When programming in the browser, use the [dart:html HttpRequest class.][HttpRequest] Here’s an example of using HttpClient: -/void/g"?> + ```dart void main() async { var url = Uri.parse('http://localhost:8888/dart'); diff --git a/src/_includes/get-sdk.md b/src/_includes/get-sdk.md index 8f5b75ac0..188b68a27 100644 --- a/src/_includes/get-sdk.md +++ b/src/_includes/get-sdk.md @@ -3,7 +3,7 @@ you need an SDK. You can either download the Dart SDK directly (as described below) or [download the Flutter SDK,][] -which (as of Flutter 1.21) includes the full Dart SDK. +which includes the full Dart SDK. [download the Flutter SDK,]: {{site.flutter-docs}}/get-started/install diff --git a/src/_sass/components/_banner.scss b/src/_sass/components/_banner.scss index e82deba51..105fd939b 100644 --- a/src/_sass/components/_banner.scss +++ b/src/_sass/components/_banner.scss @@ -1,7 +1,9 @@ .banner { + position: relative; background-color: #e7f8ff; padding: 12px 0; text-align: center; + z-index: 1000; } .banner__text { diff --git a/src/_sass/components/_search.scss b/src/_sass/components/_search.scss index 91a72fd6b..bf4af4eb5 100644 --- a/src/_sass/components/_search.scss +++ b/src/_sass/components/_search.scss @@ -89,7 +89,7 @@ input.gsc-search-button { right: 20px; font-size: 30px; cursor: pointer; - z-index: 999; + z-index: 5; &:hover { color: $gray; } diff --git a/src/_sass/components/_sidebar.scss b/src/_sass/components/_sidebar.scss index 13dd679c1..bfd4c891f 100644 --- a/src/_sass/components/_sidebar.scss +++ b/src/_sass/components/_sidebar.scss @@ -116,6 +116,10 @@ overflow-y: auto; z-index: 1; + .open_menu & { + z-index: 10000; + } + .site-sidebar { // override shared/_sidebar.scss padding: $top-content-padding 30px $content-padding; diff --git a/src/_sass/components/_toc.scss b/src/_sass/components/_toc.scss index 48f1af79f..363e0d58d 100644 --- a/src/_sass/components/_toc.scss +++ b/src/_sass/components/_toc.scss @@ -153,7 +153,7 @@ overflow-x: hidden; overflow-y: auto; overflow-wrap: break-word; - z-index: 999; + z-index: 5; // override shared/_toc.scss &.site-toc { diff --git a/src/_sass/main.scss b/src/_sass/main.scss index 63720ae95..9dbf9e24f 100644 --- a/src/_sass/main.scss +++ b/src/_sass/main.scss @@ -99,7 +99,7 @@ i.fa-external-link-alt { #page-footer { position: relative; - z-index: 5; + z-index: 1000; background-color: $site-color-footer; padding: 32px; @@ -193,7 +193,7 @@ i.fa-external-link-alt { margin-left: 20px; padding-right: 10px; cursor: pointer; - z-index: 9999; + z-index: 100; i { font-size: 32px; @@ -842,7 +842,7 @@ body.obsolete { min-width: 300px; max-width: calc(100vw - 60px); background: #fff; - z-index: 9999; + z-index: 100; box-shadow: 0 0 4px rgba(0,0,0,.14),0 4px 8px rgba(0,0,0,.28); transform: translateX(-100%); transition: transform 0.4s ease-in-out; @@ -864,7 +864,7 @@ body.obsolete { top: 0; bottom: 0; left: 0; right: 0; height: 100%; - z-index: 999; + z-index: 5; background-color: rgba($gray-base,0.5); cursor: pointer; pointer-events: none; diff --git a/src/get-dart/archive/index.md b/src/get-dart/archive/index.md index d3cf779b6..32f3258fd 100644 --- a/src/get-dart/archive/index.md +++ b/src/get-dart/archive/index.md @@ -6,7 +6,7 @@ short-title: 归档 description: Download specific stable, beta, dev, and main channel versions of the Dart SDK and the Dart API documentation. description: 下载特定的稳定版、测试版、开发版和主分支开发版的 Dart SDK 和 Dart API 文档。 js: -- url: /get-dart/archive/out/web/download_archive.dart_cn.js +- url: /get-dart/archive/assets/download_archive.dart_cn.js defer: true - url: /get-dart/archive/assets/install.js defer: true diff --git a/src/get-dart/index.md b/src/get-dart/index.md index 4ffcfc248..0c04e39b1 100644 --- a/src/get-dart/index.md +++ b/src/get-dart/index.md @@ -13,6 +13,10 @@ The Dart SDK has the libraries and command-line tools that you need to develop Dart command-line, server, and non-Flutter web apps. For details, see the [Dart SDK overview](/tools/sdk). +本页面主要引介绍如何下载 Dart SDK,Dart SDK 包含了各种 +库和命令行工具帮助你构建 Dart 命令行、服务端、以及 Web (非 Flutter) 应用。 +了解更多,请查看 [Dart SDK 概览](/tools/sdk)。 + ## Installing the Dart SDK {#install} ## 安装 Dart SDK {#install} @@ -111,8 +115,8 @@ Dart SDK 支持 Windows、Linux 和 macOS。 - macOS 11 (Big Sur) - macOS 12 (Monterey) - **支持的版本:**最新的三个主要版本。 - 截止 2021 年 11 月,支持以下版本: + **支持的版本:**最新的三个主要版本。 + 截止 2021 年 11 月,支持以下版本: - macOS 10.15 (Catalina) - macOS 11 (Big Sur) - macOS 12 (Monterey) @@ -132,7 +136,7 @@ Dart SDK 有三个发布渠道: * **Stable** channel: **stable releases**, updated roughly every three months; currently `[calculating]`{:.editor-build-rev-stable}. - 稳定版 (Stable)渠道:**稳定发行版**,每 **三个月** 更新一次; + 稳定版 (Stable) 渠道:**稳定发行版**,每 **三个月** 更新一次; 当前版本 `[calculating]`{:.editor-build-rev-stable}. Stable releases are suitable for production use. @@ -156,7 +160,7 @@ Dart SDK 有三个发布渠道: * **Dev** channel: **prereleases**, usually updated twice a week; currently `[calculating]`{:.editor-build-rev-dev}. - 开发版 (Dev)渠道:也称 **预发行版**,通常每 **双周** 更新一次; + 开发版 (Dev) 渠道:也称 **预发行版**,通常每 **双周** 更新一次; 当前版本 `[calculating]`{:.editor-build-rev-dev}. Dev channel releases are the most current with latest changes, may be broken, @@ -191,8 +195,11 @@ get stable, beta, or dev channel releases using [a package manager][] or [Dart Docker image][], or by [downloading the SDK as a zip file][]. -你可以通过 [instructions above](#install) 获得 stable 和 dev 渠道, -或者你也可以直接[下载 SDK 的压缩包](/tools/sdk/archive)。 +你可以通过本页面 [上方安装部分](#install) 的介绍来获取稳定版渠道的 Dart, +或者通过 [任一个包管理器 (如 brew、choco、apt get)][a package manager][] +或者通过 Dart 的 [Docker 镜像][Dart Docker image] 来获取 +稳定版 (Stable)、测试版 (Beta)、开发版 (Dev) 渠道的 Dart SDK, +再或者,你也可以直接 [下载各个版本的 SDK 压缩包][downloading the SDK as a zip file]。 For more information, see the [Dart 2 page.][Dart 2] diff --git a/src/tools/jetbrains-plugin.md b/src/tools/jetbrains-plugin.md index b1004b231..4d88b0478 100644 --- a/src/tools/jetbrains-plugin.md +++ b/src/tools/jetbrains-plugin.md @@ -91,11 +91,11 @@ Install a JetBrains IDE if you don't already have one. Choose one: If you don't already have the Dart SDK, install it. You can get it either by itself or by downloading the Flutter SDK, -which (as of Flutter 1.21) includes the Dart SDK. +which includes the full Dart SDK. 如果你还没有安装 Dart SDK,安装一下。 你可以选择下载 Dart SDK 或者下载安装 Flutter SDK, -在 Flutter 1.21 和之后的版本,Flutter SDK 已经包含了完整的 Dart SDK 。 +Flutter SDK 已经包含了完整的 Dart SDK 。 Choose one: