Skip to content

Commit

Permalink
[sync] 2024/11/02 (#1519)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmosHuKe authored Nov 2, 2024
2 parents 61f4bf5 + 8dcb35c commit 6d843dc
Show file tree
Hide file tree
Showing 126 changed files with 5,755 additions and 1,469 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
experimental: false
continue-on-error: ${{ matrix.experimental }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
Expand All @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
Expand All @@ -73,12 +73,12 @@ jobs:
if: |
github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
runs-on: ubuntu-latest
if: github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
- uses: dart-lang/setup-dart@0a8a0fc875eb934c15d08629302413c671d3f672
Expand All @@ -126,14 +126,14 @@ jobs:
github.ref == 'refs/heads/main' &&
github.repository == 'cfug/flutter.cn'
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
# docs.flutter.cn | https://github.com/cfug/flutter.cn/pull/1518
fetch-depth: 0
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.head.repo.full_name == 'cfug/flutter.cn' }}
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
submodules: recursive
# docs.flutter.cn | https://github.com/cfug/flutter.cn/pull/1518
fetch-depth: 0
- name: Enable Corepack
run: corepack enable
- uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ node_modules
package-lock.json
pubspec.lock
tmp/

# Temporary as codelabs used to be a submodule
examples/codelabs
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,3 @@
path = site-shared
url = https://github.com/dart-lang/site-shared
branch = main
[submodule "examples/codelabs"]
path = examples/codelabs
url = https://github.com/flutter/codelabs
2 changes: 1 addition & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
analyzer:
exclude: [flutter, site-shared, src, tmp, 'examples/codelabs']
exclude: [flutter, site-shared, src, tmp]
2 changes: 1 addition & 1 deletion eleventy.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default function (eleventyConfig) {

eleventyConfig.addPassthroughCopy('src/content/assets/js');
// inject_dartpad 暂时放置在本地 tool/inject_dartpad/
// eleventyConfig.addPassthroughCopy({'site-shared/packages/inject_dartpad/lib/inject_dartpad.js': 'assets/js/inject_dartpad.js'});
// eleventyConfig.addPassthroughCopy({'site-shared/pkgs/inject_dartpad/lib/inject_dartpad.js': 'assets/js/inject_dartpad.js'});
eleventyConfig.addPassthroughCopy('src/content/assets/images', { expand: true });
// docs.flutter.cn - translator
eleventyConfig.addPassthroughCopy('src/content/assets/translator');
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions examples/accessibility/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';

void main() => runApp(const AccessibleApp());

class AccessibleApp extends StatelessWidget {
const AccessibleApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Your accessible app',
home: Scaffold(
appBar: AppBar(
title: const Text('Your accessible app'),
),
),
);
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: null_safety_basics
description: Some code to demonstrate null safety.
name: your_accessible_app
description: A Flutter project to contain accessibility-related code excerpts.
version: 1.0.0
publish_to: none

environment:
sdk: ^3.5.0
Expand Down
26 changes: 26 additions & 0 deletions examples/accessibility/test/a11y_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:your_accessible_app/main.dart';

void main() {
testWidgets('Follows a11y guidelines', (tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(const AccessibleApp());

// Checks that tappable nodes have a minimum size of 48 by 48 pixels
// for Android.
await expectLater(tester, meetsGuideline(androidTapTargetGuideline));

// Checks that tappable nodes have a minimum size of 44 by 44 pixels
// for iOS.
await expectLater(tester, meetsGuideline(iOSTapTargetGuideline));

// Checks that touch targets with a tap or long press action are labeled.
await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));

// Checks whether semantic nodes meet the minimum text contrast levels.
// The recommended text contrast is 3:1 for larger text
// (18 point and above regular).
await expectLater(tester, meetsGuideline(textContrastGuideline));
handle.dispose();
});
}
38 changes: 0 additions & 38 deletions examples/basics/lib/main.dart

This file was deleted.

1 change: 0 additions & 1 deletion examples/codelabs
Submodule codelabs deleted from ad3196
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ Route step2() {
);
}

// #docregion step3
var curve = Curves.ease;
var curveTween = CurveTween(curve: curve);
// #enddocregion step3
void createCurves() {
// #docregion step3
var curve = Curves.ease;
var curveTween = CurveTween(curve: curve);
// #enddocregion step3
}

Route step4() {
return PageRouteBuilder(
Expand Down
102 changes: 52 additions & 50 deletions examples/cookbook/effects/nested_nav/lib/add_navigator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void main() {
),
// #docregion OnGenerateRoute
onGenerateRoute: (settings) {
late Widget page;
final Widget page;
if (settings.name == routeHome) {
page = const HomeScreen();
} else if (settings.name == routeSettings) {
Expand Down Expand Up @@ -71,7 +71,7 @@ class SetupFlow extends StatefulWidget {
}

class SetupFlowState extends State<SetupFlow> {
// #docregion AddNavigator
// #docregion AddNavigator
final _navigatorKey = GlobalKey<NavigatorState>();

void _onDiscoveryComplete() {
Expand Down Expand Up @@ -134,7 +134,7 @@ class SetupFlowState extends State<SetupFlow> {
settings: settings,
);
}
// #enddocregion AddNavigator
// #enddocregion AddNavigator

@override
void initState() {
Expand Down Expand Up @@ -304,56 +304,58 @@ class FinishedPage extends StatelessWidget {
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 250,
height: 250,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF222222),
),
child: const Center(
child: Icon(
Icons.lightbulb,
size: 175,
color: Colors.white,
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 200,
height: 200,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF222222),
),
child: const Center(
child: Icon(
Icons.lightbulb,
size: 140,
color: Colors.white,
),
),
),
),
const SizedBox(height: 32),
const Text(
'Bulb added!',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 32),
ElevatedButton(
style: ButtonStyle(
padding: WidgetStateProperty.resolveWith((states) {
return const EdgeInsets.symmetric(
horizontal: 24, vertical: 12);
}),
backgroundColor: WidgetStateColor.resolveWith((states) {
return const Color(0xFF222222);
}),
shape: WidgetStateProperty.resolveWith((states) {
return const StadiumBorder();
}),
),
onPressed: onFinishPressed,
child: const Text(
'Finish',
const SizedBox(height: 32),
const Text(
'Bulb added!',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
),
],
const SizedBox(height: 32),
ElevatedButton(
style: ButtonStyle(
padding: WidgetStateProperty.resolveWith((states) {
return const EdgeInsets.symmetric(
horizontal: 24, vertical: 12);
}),
backgroundColor: WidgetStateColor.resolveWith((states) {
return const Color(0xFF222222);
}),
shape: WidgetStateProperty.resolveWith((states) {
return const StadiumBorder();
}),
),
onPressed: onFinishPressed,
child: const Text(
'Finish',
style: TextStyle(
fontSize: 24,
),
),
),
],
),
),
),
),
Expand All @@ -378,16 +380,16 @@ class HomeScreen extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 250,
height: 250,
width: 200,
height: 200,
decoration: const BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF222222),
),
child: Center(
child: Icon(
Icons.lightbulb,
size: 175,
size: 140,
color: Theme.of(context).scaffoldBackgroundColor,
),
),
Expand Down
Loading

0 comments on commit 6d843dc

Please sign in to comment.