Skip to content

Commit

Permalink
Update to latest flutter and fix a couple logging errors. (#8350)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll authored Sep 26, 2024
1 parent 47524bc commit d64046f
Show file tree
Hide file tree
Showing 15 changed files with 55 additions and 43 deletions.
2 changes: 1 addition & 1 deletion flutter-candidate.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9108b6d0cff1eb95377153559c01d48f725760ba
8925e1ffdfe880b06a8bc5877f017083d6652f5b
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ class _DebuggerScreenBodyWrapperState extends State<_DebuggerScreenBodyWrapper>
_shownFirstScript = false;
SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
if (!_shownFirstScript ||
controller.codeViewController.navigationInProgress) return;
controller.codeViewController.navigationInProgress) {
return;
}
final routerDelegate = DevToolsRouterDelegate.of(context);
routerDelegate.updateStateIfChanged(
CodeViewSourceLocationNavigationState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ class FlexLayoutProperties extends LayoutProperties {

if (crossAxisAlignment == CrossAxisAlignment.start ||
crossAxisAlignment == CrossAxisAlignment.stretch ||
maxDimension == usedDimension) return 0.0;
maxDimension == usedDimension) {
return 0.0;
}
final emptySpace = math.max(0.0, maxDimension - usedDimension);
if (crossAxisAlignment == CrossAxisAlignment.end) return emptySpace;
return emptySpace * 0.5;
Expand Down Expand Up @@ -678,7 +680,9 @@ class FlexLayoutProperties extends LayoutProperties {
if (dimension(crossAxisDirection) ==
displayChildren[i].dimension(crossAxisDirection) ||
childrenRenderProperties[i].crossAxisDimension ==
maxSizeAvailable(crossAxisDirection)) continue;
maxSizeAvailable(crossAxisDirection)) {
continue;
}

final renderProperties = childrenRenderProperties[i];
final space = renderProperties.clone()..isFreeSpace = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,9 @@ class FlexLayoutProperties extends LayoutProperties {

if (crossAxisAlignment == CrossAxisAlignment.start ||
crossAxisAlignment == CrossAxisAlignment.stretch ||
maxDimension == usedDimension) return 0.0;
maxDimension == usedDimension) {
return 0.0;
}
final emptySpace = math.max(0.0, maxDimension - usedDimension);
if (crossAxisAlignment == CrossAxisAlignment.end) return emptySpace;
return emptySpace * 0.5;
Expand Down Expand Up @@ -774,7 +776,9 @@ class FlexLayoutProperties extends LayoutProperties {
if (dimension(crossAxisDirection) ==
displayChildren[i].dimension(crossAxisDirection) ||
childrenRenderProperties[i].crossAxisDimension ==
maxSizeAvailable(crossAxisDirection)) continue;
maxSizeAvailable(crossAxisDirection)) {
continue;
}

final renderProperties = childrenRenderProperties[i];
final space = renderProperties.clone()..isFreeSpace = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ Future<EnumInstance?> _tryParseEnum(
required Setter? setter,
}) async {
if (instance.kind != InstanceKind.kPlainInstance ||
instance.fields?.length != 2) return null;
instance.fields?.length != 2) {
return null;
}

InstanceRef? findPropertyWithName(String name) {
return instance.fields
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ bool isRootForReferences(GenericInstanceRef? ref) {
}

if (ref.instanceRef?.length == 0 ||
isPrimitiveInstanceKind(ref.instanceRef?.kind)) return false;
isPrimitiveInstanceKind(ref.instanceRef?.kind)) {
return false;
}

return ref.refNodeType.isRoot;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,9 @@ class CustomPointerScrollableState extends State<CustomPointerScrollable>
@protected
void setCanDrag(bool canDrag) {
if (canDrag == _lastCanDrag &&
(!canDrag || widget.axis == _lastAxisDirection)) return;
(!canDrag || widget.axis == _lastAxisDirection)) {
return;
}
if (!canDrag) {
_gestureRecognizers = const <Type, GestureRecognizerFactory>{};
} else {
Expand Down
4 changes: 3 additions & 1 deletion packages/devtools_app/lib/src/shared/table/_tree_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,9 @@ class TreeTableState<T extends TreeNode<T>> extends State<TreeTable<T>>
LogicalKeyboardKey.arrowUp,
LogicalKeyboardKey.arrowLeft,
LogicalKeyboardKey.arrowRight,
].contains(event.logicalKey)) return KeyEventResult.ignored;
].contains(event.logicalKey)) {
return KeyEventResult.ignored;
}

// If there is no selected node, choose the first one.
if (widget.selectionNotifier.value.node == null) {
Expand Down
16 changes: 12 additions & 4 deletions packages/devtools_app/test/shared/ui_utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,27 @@ void main() {
equalsIgnoringHashCodes(
'TextSpan:\n'
' inherit: true\n'
' color: MaterialColor(primary value: Color(0xfff44336))\n'
' color: MaterialColor(primary value: Color(alpha: 1.0000, red:\n'
' 0.9569, green: 0.2627, blue: 0.2118, colorSpace:\n'
' ColorSpace.sRGB))\n'
' "parent"\n'
' TextSpan:\n'
' inherit: true\n'
' color: MaterialColor(primary value: Color(0xff2196f3))\n'
' color: MaterialColor(primary value: Color(alpha: 1.0000, red:\n'
' 0.1294, green: 0.5882, blue: 0.9529, colorSpace:\n'
' ColorSpace.sRGB))\n'
' "foo"\n'
' TextSpan:\n'
' inherit: true\n'
' color: MaterialColor(primary value: Color(0xff4caf50))\n'
' color: MaterialColor(primary value: Color(alpha: 1.0000, red:\n'
' 0.2980, green: 0.6863, blue: 0.3137, colorSpace:\n'
' ColorSpace.sRGB))\n'
' "bar"\n'
' TextSpan:\n'
' inherit: true\n'
' color: MaterialColor(primary value: Color(0xffffeb3b))\n'
' color: MaterialColor(primary value: Color(alpha: 1.0000, red:\n'
' 1.0000, green: 0.9216, blue: 0.2314, colorSpace:\n'
' ColorSpace.sRGB))\n'
' "b"\n',
),
);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/devtools_app/web/flutter_bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ async function bootstrapAppFor3P() {
console.log('Attempting to load DevTools with ' + rendererForLog + ' renderer.');

const rendererConfig = useSkwasm ? {} : { renderer: 'canvaskit' };
console.log(rendererConfig);
_flutter.loader.load({
serviceWorkerSettings: {
serviceWorkerVersion: {{flutter_service_worker_version}},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ final class ServiceExtensionManager with DisposerMixin {
final lastMainIsolate = _isolateManager.mainIsolate.value;
if (_checkForFirstFrameStarted ||
_firstFrameEventReceived ||
lastMainIsolate == null) return;
lastMainIsolate == null) {
return;
}
if (!isServiceExtensionAvailable(extensions.didSendFirstFrameEvent)) {
return;
}
Expand Down
37 changes: 11 additions & 26 deletions packages/devtools_extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,16 @@ Follow the instructions below to get started, and use the
for reference.

# Table of contents
1. [Setup your package hierarchy](#step-1-setup-your-package-hierarchy)
2. [Create a DevTools extension](#create-a-devtools-extension)
- [Step 1: Setup your package hierarchy](#setup-your-package-hierarchy)
1. [Create a DevTools extension](#create-a-devtools-extension)
- [Step 1: Setup your package hierarchy](#step-1-setup-your-package-hierarchy)
- [Standalone extensions](#standalone-extensions)
- [Companion extensions](#companion-extensions)
- [Step 2: Configure your extension](#step-2-configure-your-extension)
- [Step 3: Build your extension](#step-3-build-your-extension)
- [Step 4: Debug your extension](#step-4-debug-your-extension)
3. [Publish your package with a DevTools extension](#publish-your-package-with-a-devTools-extension)
4. [Resources and support](#resources-and-support)
5. [Testimonies from extension authors](#testimonies-from-extension-authors)

## Supported tools

With the DevTools extensions framework you can build many types of tools, including:
- Companion tools for existing packages
- New tools that are shipped as their own package
- Tools that require a running application
- Tools that **do not** require a running application

The DevTools Extensions framework comes with some out of the box features that make
distributing your extension to users seamless:
- Users can use your tool from DevTools in the browser
- Users can use your tool embedded directly in their IDE
- Users can discover and open your tool from Dart & Flutter supported IDEs
2. [Publish your package with a DevTools extension](#publish-your-package-with-a-devTools-extension)
3. [Resources and support](#resources-and-support)
4. [Testimonies from extension authors](#testimonies-from-extension-authors)

## Create a DevTools Extension

Expand Down Expand Up @@ -129,7 +114,7 @@ some_pkg
...
```

Under this directory, create the following structure:
Under the `extension` directory, create the following structure:
```
extension
devtools/
Expand Down Expand Up @@ -302,23 +287,23 @@ real DevTools environment. Build your flutter web app and copy the built assets
dart run devtools_extensions validate --package=../some_pkg
```

2. Prepare and a test environment with a dependency on your pub package that is providing the
2. Prepare a test environment with a dependency on your pub package that is providing the
extension.
- In the Dart or Flutter project where you are adding a dependency on your package, add a
[path](https://dart.dev/tools/pub/dependencies#path-packages) dependency that points to your
local package source code (the package that contains the `extension/devtools/` directory with
your extension's assets). Once you have done this, run `pub get` on the package.
- If your extension requires a running application, then you'll need to run the app that
- **If your extension requires a running application**, then you'll need to run the app that
depends on your extension.
- If your extension does not requires a running application, then you will need to
- **If your extension does not require a running application**, then you will need to
open the test Dart or Flutter project that depends on your package in a supported IDE
(VS Code or IntelliJ / Android Studio).

3. Start DevTools in one of the following ways:
- **If your extension requires a running app**, you can open DevTools either from the URI
- **If your extension requires a running application**, you can open DevTools either from the URI
that was printed to command line when you ran the test app, or from the IDE where you
ran your test app.
- **If your extension does not require a running app**, you can open your Dart or Flutter
- **If your extension does not require a running application**, you can open your Dart or Flutter
project that depends on your package in a supported IDE (VS Code or IntelliJ / Android Studio).
Open DevTools from the IDE to see your extension in the browser.
- Requires Dart SDK >= 3.5 and Flutter SDK >= 3.23
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ abstract class _SurveyHandler {
[apiParameterValueKey],
queryParams: queryParams,
api: api,
requestName: ReleaseNotesApi.setLastReleaseNotesVersion,
requestName: SurveyApi.setActiveSurvey,
);
if (missingRequiredParams != null) return missingRequiredParams;

Expand Down

0 comments on commit d64046f

Please sign in to comment.