Skip to content

Commit

Permalink
Merge branch 'main' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
manishwalia15 authored Oct 17, 2024
2 parents de8480c + 31da761 commit 45c9ed5
Show file tree
Hide file tree
Showing 18 changed files with 61 additions and 36 deletions.
2 changes: 1 addition & 1 deletion examples/accessibility/test/a11y_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:your_accessible_app/main.dart';
void main() {
testWidgets('Follows a11y guidelines', (tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(AccessibleApp());
await tester.pumpWidget(const AccessibleApp());

// Checks that tappable nodes have a minimum size of 48 by 48 pixels
// for Android.
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// ignore_for_file: lines_longer_than_80_chars, avoid_classes_with_only_static_members
import 'package:firebase_core/firebase_core.dart' show FirebaseOptions;
import 'package:flutter/foundation.dart'
show defaultTargetPlatform, kIsWeb, TargetPlatform;
show TargetPlatform, defaultTargetPlatform, kIsWeb;

/// Default [FirebaseOptions] for use with your Firebase apps.
///
Expand Down
12 changes: 8 additions & 4 deletions examples/example_utils/lib/analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,27 @@ linter:
- avoid_types_on_closure_parameters
- avoid_void_async
- cancel_subscriptions
- comment_references
- close_sinks
- combinators_ordering
- comment_references
- directives_ordering
- invalid_case_patterns
- library_annotations
- matching_super_parameters
- no_self_assignments
- no_wildcard_variable_uses
- one_member_abstracts
- package_api_docs
- only_throw_errors
- prefer_const_constructors
- prefer_const_declarations
- prefer_const_literals_to_create_immutables
- prefer_relative_imports
- prefer_single_quotes
- only_throw_errors
- sort_unnamed_constructors_first
- test_types_in_equals
- throw_in_finally
- type_annotate_public_apis
- unawaited_futures
- unnecessary_breaks
- unnecessary_library_directive
- unnecessary_statements
- use_is_even_rather_than_modulo
2 changes: 1 addition & 1 deletion examples/get-started/codelab_web/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ class _AnimatedProgressIndicatorState extends State<AnimatedProgressIndicator>
}

@override
void didUpdateWidget(oldWidget) {
void didUpdateWidget(AnimatedProgressIndicator oldWidget) {
super.didUpdateWidget(oldWidget);
_controller.animateTo(widget.value);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/get-started/codelab_web/lib/step3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class _AnimatedProgressIndicatorState extends State<AnimatedProgressIndicator>
}

@override
void didUpdateWidget(oldWidget) {
void didUpdateWidget(AnimatedProgressIndicator oldWidget) {
super.didUpdateWidget(oldWidget);
_controller.animateTo(widget.value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class _SampleAppPageState extends State<SampleAppPage> {
// The 'echo' isolate sends its SendPort as the first message.
SendPort sendPort = await receivePort.first;

List msg = await sendReceive(
final msg = await sendReceive(
sendPort,
'https://jsonplaceholder.typicode.com/posts',
);
) as List<Object?>;

setState(() {
widgets = msg;
Expand All @@ -116,7 +116,7 @@ class _SampleAppPageState extends State<SampleAppPage> {
}
}

Future sendReceive(SendPort port, msg) {
Future<Object?> sendReceive(SendPort port, Object? msg) {
ReceivePort response = ReceivePort();
port.send([msg, response.sendPort]);
return response.first;
Expand Down
2 changes: 1 addition & 1 deletion examples/get-started/flutter-for/ios_devs/lib/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Person {
Person(this.name);
}

var items = [
final List<Person> items = [
Person('Person 1'),
Person('Person 2'),
Person('Person 3'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class AdaptiveDataTablePage extends StatelessWidget {
child: Column(
children: items.map((i) {
return Container(
color: i % 2 == 0 ? Colors.grey.shade300 : null,
color: i.isEven ? Colors.grey.shade300 : null,
child: Row(
children: [
_TableRowItem('Item $i, Column 1'),
Expand Down
2 changes: 1 addition & 1 deletion firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
{ "source": "/tools/devtools/codeSize", "destination": "/tools/devtools/app-size", "type": 301 },
{ "source": "/tools/devtools/overview", "destination": "/tools/devtools", "type": 301 },
{ "source": "/tools/devtools/timeline", "destination": "/tools/devtools/performance", "type": 301 },
{ "source": "/tools/ide", "destination": "/tools/android-studio", "type": 301 },
{ "source": "/tools/ide", "destination": "/tools/vs-code", "type": 301 },
{ "source": "/tools/ide/android-studio", "destination": "/tools/android-studio", "type": 301 },
{ "source": "/tools/ide/vs-code", "destination": "/tools/vs-code", "type": 301 },
{ "source": "/tools/inspector", "destination": "/tools/devtools/inspector", "type": 301 },
Expand Down
2 changes: 2 additions & 0 deletions src/_data/sidenav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@
permalink: /platform-integration/android/c-interop
- title: Host a native Android view
permalink: /platform-integration/android/platform-views
- title: Launch a Jetpack Compose activity
permalink: /platform-integration/android/compose-activity
- title: Restore state on Android
permalink: /platform-integration/android/restore-state-android
- title: Target ChromeOS with Android
Expand Down
4 changes: 2 additions & 2 deletions src/content/get-started/codelab-web.md
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ class _AnimatedProgressIndicatorState extends State<AnimatedProgressIndicator>
}
@override
void didUpdateWidget(oldWidget) {
void didUpdateWidget(AnimatedProgressIndicator oldWidget) {
super.didUpdateWidget(oldWidget);
_controller.animateTo(widget.value);
}
Expand Down Expand Up @@ -1068,7 +1068,7 @@ class _AnimatedProgressIndicatorState extends State<AnimatedProgressIndicator>
}
@override
void didUpdateWidget(oldWidget) {
void didUpdateWidget(AnimatedProgressIndicator oldWidget) {
super.didUpdateWidget(oldWidget);
_controller.animateTo(widget.value);
}
Expand Down
12 changes: 6 additions & 6 deletions src/content/get-started/flutter-for/android-devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,10 +926,10 @@ Future<void> loadData() async {
// The 'echo' isolate sends its SendPort as the first message.
SendPort sendPort = await receivePort.first;
List msg = await sendReceive(
final msg = await sendReceive(
sendPort,
'https://jsonplaceholder.typicode.com/posts',
);
) as List<Object?>;
setState(() {
widgets = msg;
Expand All @@ -955,7 +955,7 @@ static Future<void> dataLoader(SendPort sendPort) async {
}
}
Future sendReceive(SendPort port, msg) {
Future<Object?> sendReceive(SendPort port, Object? msg) {
ReceivePort response = ReceivePort();
port.send([msg, response.sendPort]);
return response.first;
Expand Down Expand Up @@ -1060,10 +1060,10 @@ class _SampleAppPageState extends State<SampleAppPage> {
// The 'echo' isolate sends its SendPort as the first message.
SendPort sendPort = await receivePort.first;
List msg = await sendReceive(
final msg = await sendReceive(
sendPort,
'https://jsonplaceholder.typicode.com/posts',
);
) as List<Object?>;
setState(() {
widgets = msg;
Expand All @@ -1089,7 +1089,7 @@ class _SampleAppPageState extends State<SampleAppPage> {
}
}
Future sendReceive(SendPort port, msg) {
Future<Object?> sendReceive(SendPort port, Object? msg) {
ReceivePort response = ReceivePort();
port.send([msg, response.sendPort]);
return response.first;
Expand Down
2 changes: 1 addition & 1 deletion src/content/get-started/flutter-for/swiftui-devs.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class Person {
Person(this.name);
}
var items = [
final List<Person> items = [
Person('Person 1'),
Person('Person 2'),
Person('Person 3'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ import 'package:your_accessible_app/main.dart';
void main() {
testWidgets('Follows a11y guidelines', (tester) async {
final SemanticsHandle handle = tester.ensureSemantics();
await tester.pumpWidget(AccessibleApp());
await tester.pumpWidget(const AccessibleApp());
// Checks that tappable nodes have a minimum size of 48 by 48 pixels
// for Android.
Expand Down
21 changes: 18 additions & 3 deletions src/content/ui/navigation/url-strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,23 @@ For example, `flutterexample.dev/#/path/to/screen`.
## Configuring the URL strategy

To configure Flutter to use the path instead, use the
[usePathUrlStrategy][] function provided by the [flutter_web_plugins][] library
in the SDK:
[usePathUrlStrategy][] function provided by the [flutter_web_plugins][] library,
which is part of the Flutter SDK.

You can't directly add `flutter_web_plugins` using `pub add`.
Include it as a Flutter [SDK dependency][] in your `pubspec.yaml` file:

```yaml highlightLines=4-5
dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter
```
Then call the `usePathUrlStrategy` function before `runApp`:

```dart
```dart highlightLines=4
import 'package:flutter_web_plugins/url_strategy.dart';
void main() {
Expand All @@ -29,6 +42,8 @@ void main() {
}
```

[SDK dependency]: {{site.dart-site}}/tools/pub/dependencies#sdk

## Configuring your web server

PathUrlStrategy uses the [History API][], which requires additional
Expand Down
10 changes: 6 additions & 4 deletions tool/flutter_site/lib/src/commands/analyze_dart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ int analyzeDart({
...exampleProjectDirectories,
];

print('Analyzing code...');
if (!verboseLogging) {
print('Analyzing code...');
}

for (final directory in directoriesToAnalyze) {
if (verboseLogging) {
print('Analyzing code in $directory...');
print("Analyzing code in '$directory' directory...");
}

final flutterAnalyzeOutput = Process.runSync(
Expand All @@ -59,11 +61,11 @@ int analyzeDart({

stderr.write(normalOutput);
stderr.write(errorOutput);
stderr.writeln('Error: Analysis on $directory failed.');
stderr.writeln("Error: Analysis on '$directory' directory failed.");
return 1;
} else {
if (verboseLogging) {
print('Successfully analyzed code in $directory!');
print("Successfully analyzed code in '$directory' directory!");
}
}
}
Expand Down

0 comments on commit 45c9ed5

Please sign in to comment.