Skip to content

Commit

Permalink
Merge pull request #388 from chenglu/master
Browse files Browse the repository at this point in the history
[sync] 2022/10/17
  • Loading branch information
Vadaski authored Oct 18, 2022
2 parents 64719bc + 0564683 commit 07ee1ed
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 27 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -58,4 +58,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@e0e5ded33cabb451ae0a9768fc7b0410bad9ad44
uses: github/codeql-action/analyze@807578363a7869ca324a79039e6db9c843e0e100
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 11 additions & 0 deletions examples/misc/lib/effective_dart/design_bad.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

//----------------------------------------------------------------------------
Expand Down
11 changes: 11 additions & 0 deletions examples/misc/lib/effective_dart/design_good.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Monster> monsters) {
// #docregion code-like-prose
Expand Down Expand Up @@ -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

//----------------------------------------------------------------------------
Expand Down
15 changes: 13 additions & 2 deletions src/_guides/language/effective-dart/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
<?code-excerpt "design_good.dart (dont-type-init-formals)"?>
Expand All @@ -1859,6 +1862,10 @@ class Point {
double x, y;
Point(this.x, this.y);
}

class MyWidget extends StatelessWidget {
MyWidget({super.key});
}
{% endprettify %}

{:.bad}
Expand All @@ -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 %}


Expand Down
4 changes: 2 additions & 2 deletions src/_guides/libraries/_dart-html-tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<?code-excerpt "html/test/html_test.dart (getString)" plaster="none" replace="/await.*;/[!$&!]/g; /Future\<void\>/void/g"?>
<?code-excerpt "html/test/html_test.dart (getString)" plaster="none" replace="/await.*;/[!$&!]/g; /Future<\w+\W/void/g"?>
{% prettify dart tag=pre+code %}
void main() async {
String pageHtml = [!await HttpRequest.getString(url);!]
Expand All @@ -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:

<?code-excerpt "html/test/html_test.dart (request)" replace="/Future\<void\>/void/g; /await.*;/[!$&!]/g"?>
<?code-excerpt "html/test/html_test.dart (request)" replace="/Future<\w+\W/void/g; /await.*;/[!$&!]/g"?>
```dart
void main() async {
HttpRequest req = await HttpRequest.request(
Expand Down
4 changes: 2 additions & 2 deletions src/_guides/libraries/_dart-io-tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

<?code-excerpt "misc/lib/library_tour/io/http_server.dart" replace="/Future\<void\>/void/g; /\b_//g"?>
<?code-excerpt "misc/lib/library_tour/io/http_server.dart" replace="/Future<\w+\W/void/g; /\b_//g"?>
```dart
void main() async {
final requests = await HttpServer.bind('localhost', 8888);
Expand Down Expand Up @@ -242,7 +242,7 @@ apps. When programming in the browser, use the
[dart:html HttpRequest class.][HttpRequest]
Here’s an example of using HttpClient:

<?code-excerpt "misc/test/library_tour/io_test.dart (client)" replace="/Future\<void\>/void/g"?>
<?code-excerpt "misc/test/library_tour/io_test.dart (client)" replace="/Future<\w+\W/void/g"?>
```dart
void main() async {
var url = Uri.parse('http://localhost:8888/dart');
Expand Down
2 changes: 1 addition & 1 deletion src/_includes/get-sdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/_sass/components/_banner.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.banner {
position: relative;
background-color: #e7f8ff;
padding: 12px 0;
text-align: center;
z-index: 1000;
}

.banner__text {
Expand Down
2 changes: 1 addition & 1 deletion src/_sass/components/_search.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ input.gsc-search-button {
right: 20px;
font-size: 30px;
cursor: pointer;
z-index: 999;
z-index: 5;
&:hover {
color: $gray;
}
Expand Down
4 changes: 4 additions & 0 deletions src/_sass/components/_sidebar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/_sass/components/_toc.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions src/_sass/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/get-dart/archive/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 13 additions & 6 deletions src/get-dart/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)
Expand All @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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]

Expand Down
4 changes: 2 additions & 2 deletions src/tools/jetbrains-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit 07ee1ed

Please sign in to comment.