Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll committed Dec 12, 2024
2 parents f08443f + 2da31a2 commit c6fc673
Show file tree
Hide file tree
Showing 43 changed files with 1,030 additions and 443 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class EmbeddedExtensionControllerImpl extends EmbeddedExtensionController
: ExtensionEventParameters.themeValueLight,
if (dtdManager.uri != null) 'dtdUri': dtdManager.uri.toString(),
};
return Uri.parse(baseUri).copyWith(queryParameters: queryParams).toString();
return Uri.parse(baseUri).replace(queryParameters: queryParams).toString();
}

HTMLIFrameElement get extensionIFrame => _extensionIFrame;
Expand Down
2 changes: 1 addition & 1 deletion packages/devtools_app/lib/src/framework/release_notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class ReleaseNotesController extends SidePanelController {
markdown.value = null;
toggleVisibility(false);
if (message != null) {
_log.warning('Warning: $message');
_log.warning(message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class DevToolsAboutDialog extends StatelessWidget {
),
],
),
actions: const [DialogCloseButton()],
actions: const [DialogLicenseButton(), DialogCloseButton()],
);
}
}
Expand Down Expand Up @@ -144,3 +144,30 @@ class OpenAboutAction extends ScaffoldAction {
},
);
}

// Since [DevToolsAboutDialog] is not actually an [AboutDialog], there is no
// built-in way to add a 'View Licenses' button.
// So, adding a custom [DialogTextButton] to view licenses.
// Since this action is very specific to just the [DevToolsAboutDialog],
// providing implementation in about_dialog.dart and not in
// dialogs.dart which contains the definition of [DevToolsDialog].
// TODO(mossmana): We may want to consider refactoring [DevToolsAboutDialog] to
// be an [AboutDialog].
// https://api.flutter.dev/flutter/material/AboutDialog-class.html
final class DialogLicenseButton extends StatelessWidget {
const DialogLicenseButton({super.key});

@override
Widget build(BuildContext context) {
return DialogTextButton(
onPressed: () {
showLicensePage(
context: context,
applicationName: 'DevTools',
useRootNavigator: true,
);
},
child: const Text('VIEW LICENSES'),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ class _ProgramExplorerRow extends StatelessWidget {
/// Builds a string representation of a field declaration.
///
/// Examples:
/// - final String
/// - static const int
/// - List<X0>
/// - `final String`
/// - `static const int`
/// - `List<X0>`
String _buildFieldTypeText(Field field) {
final buffer = StringBuffer();
if (field.isStatic!) {
Expand All @@ -117,10 +117,10 @@ class _ProgramExplorerRow extends StatelessWidget {
/// Builds a string representation of a function signature
///
/// Examples:
/// - Foo<T>(T) -> dynamic
/// - Bar(String, int) -> void
/// - Baz(String, [int]) -> void
/// - Faz(String, {String? bar, required int baz}) -> int
/// - `Foo<T>(T) -> dynamic`
/// - `Bar(String, int) -> void`
/// - `Baz(String, [int]) -> void`
/// - `Faz(String, {String? bar, required int baz}) -> int`
String _buildFunctionTypeText(
InstanceRef signature, {
bool isInstanceMethod = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'dart:math' as math;
import 'package:flutter/rendering.dart';

import '../../shared/diagnostics/diagnostics_node.dart';
import '../../shared/primitives/enum_utils.dart';
import '../../shared/primitives/math_utils.dart';
import '../../shared/primitives/utils.dart';
import 'layout_explorer/flex/utils.dart';
Expand Down Expand Up @@ -367,21 +366,19 @@ class FlexLayoutProperties extends LayoutProperties {

return FlexLayoutProperties._fromNode(
node,
direction: _directionUtils.enumEntry(data['direction']) ?? Axis.vertical,
mainAxisAlignment: _mainAxisAlignmentUtils.enumEntry(
data['mainAxisAlignment'],
),
mainAxisSize: _mainAxisSizeUtils.enumEntry(data['mainAxisSize']),
crossAxisAlignment: _crossAxisAlignmentUtils.enumEntry(
data['crossAxisAlignment'],
),
direction: _directionNamesToValues[data['direction']] ?? Axis.vertical,
mainAxisAlignment:
_mainAxisAlignmentNamesToValues[data['mainAxisAlignment']],
mainAxisSize: _mainAxisSizeNamesToValues[data['mainAxisSize']],
crossAxisAlignment:
_crossAxisAlignmentNamesToValues[data['crossAxisAlignment']],
textDirection:
_textDirectionUtils.enumEntry(data['textDirection']) ??
_textDirectionNamesToValues[data['textDirection']] ??
TextDirection.ltr,
verticalDirection:
_verticalDirectionUtils.enumEntry(data['verticalDirection']) ??
_verticalDirectionNamesToValues[data['verticalDirection']] ??
VerticalDirection.down,
textBaseline: _textBaselineUtils.enumEntry(data['textBaseline']),
textBaseline: _textBaselineNamesToValues[data['textBaseline']],
);
}

Expand Down Expand Up @@ -722,25 +719,16 @@ class FlexLayoutProperties extends LayoutProperties {
return spaces;
}

static final _directionUtils = EnumUtils<Axis>(Axis.values);
static final _mainAxisAlignmentUtils = EnumUtils<MainAxisAlignment>(
MainAxisAlignment.values,
);
static final _mainAxisSizeUtils = EnumUtils<MainAxisSize>(
MainAxisSize.values,
);
static final _crossAxisAlignmentUtils = EnumUtils<CrossAxisAlignment>(
CrossAxisAlignment.values,
);
static final _textDirectionUtils = EnumUtils<TextDirection>(
TextDirection.values,
);
static final _verticalDirectionUtils = EnumUtils<VerticalDirection>(
VerticalDirection.values,
);
static final _textBaselineUtils = EnumUtils<TextBaseline>(
TextBaseline.values,
);
static final _directionNamesToValues = Axis.values.asNameMap();
static final _mainAxisAlignmentNamesToValues =
MainAxisAlignment.values.asNameMap();
static final _mainAxisSizeNamesToValues = MainAxisSize.values.asNameMap();
static final _crossAxisAlignmentNamesToValues =
CrossAxisAlignment.values.asNameMap();
static final _textDirectionNamesToValues = TextDirection.values.asNameMap();
static final _verticalDirectionNamesToValues =
VerticalDirection.values.asNameMap();
static final _textBaselineNamesToValues = TextBaseline.values.asNameMap();
}

/// RenderProperties contains information for rendering a [LayoutProperties] node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class FlutterInspectorSettingsDialog extends StatelessWidget {
notifier:
preferences.inspector.autoRefreshEnabled
as ValueNotifier<bool?>,
title: 'Enable auto-refreshing of the widget tree',
title: 'Enable widget tree auto-refreshing',
description:
'The widget tree will automatically be refreshed after a hot-reload.',
'The widget tree will automatically refresh after a hot-reload or navigation event.',
gaItem: gac.inspectorAutoRefreshEnabled,
),
] else ...[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -445,16 +445,23 @@ class InspectorController extends DisposableController
}

bool _receivedIsolateReloadEvent = false;
bool _receivedFlutterNavigationEvent = false;

Future<void> _maybeAutoRefreshInspector(Event event) async {
if (!preferences.inspector.autoRefreshEnabled.value) return;

// It is not sufficent to wait for the isolate reload event, because Flutter
// might not have re-painted the app. Instead, we need to wait for the first
// frame AFTER the isolate reload event in order to request the new tree.
// It is not sufficent to wait for the navigation and isolate reload events
// only, because Flutter might not have re-painted the app. Instead, we need
// to wait for the first frame AFTER the isolate reload or navigation event
// in order to request the new tree.
if (event.kind == EventKind.kExtension) {
if (!_receivedIsolateReloadEvent) return;
if (event.extensionKind == 'Flutter.Frame') {
final extensionEventKind = event.extensionKind;
if (extensionEventKind == 'Flutter.Navigation') {
_receivedFlutterNavigationEvent = true;
}
if ((_receivedFlutterNavigationEvent || _receivedIsolateReloadEvent) &&
extensionEventKind == 'Flutter.Frame') {
_receivedFlutterNavigationEvent = false;
_receivedIsolateReloadEvent = false;
await refreshInspector();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import 'dart:math' as math;
import 'package:flutter/rendering.dart';

import '../../shared/diagnostics/diagnostics_node.dart';
import '../../shared/primitives/enum_utils.dart';
import '../../shared/primitives/math_utils.dart';
import '../../shared/primitives/utils.dart';
import 'layout_explorer/flex/utils.dart';
Expand Down Expand Up @@ -459,21 +458,19 @@ class FlexLayoutProperties extends LayoutProperties {

return FlexLayoutProperties._fromNode(
node,
direction: _directionUtils.enumEntry(data['direction']) ?? Axis.vertical,
mainAxisAlignment: _mainAxisAlignmentUtils.enumEntry(
data['mainAxisAlignment'],
),
mainAxisSize: _mainAxisSizeUtils.enumEntry(data['mainAxisSize']),
crossAxisAlignment: _crossAxisAlignmentUtils.enumEntry(
data['crossAxisAlignment'],
),
direction: _directionNamesToValues[data['direction']] ?? Axis.vertical,
mainAxisAlignment:
_mainAxisAlignmentNamesToValues[data['mainAxisAlignment']],
mainAxisSize: _mainAxisSizeNamesToValues[data['mainAxisSize']],
crossAxisAlignment:
_crossAxisAlignmentNamesToValues[data['crossAxisAlignment']],
textDirection:
_textDirectionUtils.enumEntry(data['textDirection']) ??
_textDirectionNamesToValues[data['textDirection']] ??
TextDirection.ltr,
verticalDirection:
_verticalDirectionUtils.enumEntry(data['verticalDirection']) ??
_verticalDirectionNamesToValues[data['verticalDirection']] ??
VerticalDirection.down,
textBaseline: _textBaselineUtils.enumEntry(data['textBaseline']),
textBaseline: _textBaselineNamesToValues[data['textBaseline']],
);
}

Expand Down Expand Up @@ -814,25 +811,16 @@ class FlexLayoutProperties extends LayoutProperties {
return spaces;
}

static final _directionUtils = EnumUtils<Axis>(Axis.values);
static final _mainAxisAlignmentUtils = EnumUtils<MainAxisAlignment>(
MainAxisAlignment.values,
);
static final _mainAxisSizeUtils = EnumUtils<MainAxisSize>(
MainAxisSize.values,
);
static final _crossAxisAlignmentUtils = EnumUtils<CrossAxisAlignment>(
CrossAxisAlignment.values,
);
static final _textDirectionUtils = EnumUtils<TextDirection>(
TextDirection.values,
);
static final _verticalDirectionUtils = EnumUtils<VerticalDirection>(
VerticalDirection.values,
);
static final _textBaselineUtils = EnumUtils<TextBaseline>(
TextBaseline.values,
);
static final _directionNamesToValues = Axis.values.asNameMap();
static final _mainAxisAlignmentNamesToValues =
MainAxisAlignment.values.asNameMap();
static final _mainAxisSizeNamesToValues = MainAxisSize.values.asNameMap();
static final _crossAxisAlignmentNamesToValues =
CrossAxisAlignment.values.asNameMap();
static final _textDirectionNamesToValues = TextDirection.values.asNameMap();
static final _verticalDirectionNamesToValues =
VerticalDirection.values.asNameMap();
static final _textBaselineNamesToValues = TextBaseline.values.asNameMap();
}

/// RenderProperties contains information for rendering a [LayoutProperties] node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import 'package:vm_service_protos/vm_service_protos.dart';

import '../../../../performance_model.dart';

/// A change notifer that contains a Perfetto trace binary object [Uint8List].
/// A change notifier that contains a Perfetto trace binary object [Uint8List].
///
/// We use this custom change notifier instead of a raw
/// ValueNotifier<Uint8List?> so that listeners are notified when the content of
/// the [Uint8List] changes, even if the [Uint8List] object does not change.
/// We use this custom change notifier instead of
/// a raw `ValueNotifier<Uint8List?>` so that listeners are
/// notified when the content of the [Uint8List] changes, even if
/// the [Uint8List] object does not change.
class PerfettoTrace extends ChangeNotifier {
PerfettoTrace(Uint8List? traceBinary) : _traceBinary = traceBinary;

Expand Down
Loading

0 comments on commit c6fc673

Please sign in to comment.