Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import '../../../../shared/theme.dart';
import '../../../../shared/utils.dart';
import '../../memory_controller.dart';
import '../../primitives/ui.dart';
import '../../shared/constants.dart';
import 'chart_pane_controller.dart';
import 'interval_dropdown.dart';

Expand Down Expand Up @@ -97,7 +96,6 @@ class _ChartControlPaneState extends State<ChartControlPane>
ValueListenableBuilder<bool>(
valueListenable: controller.legendVisibleNotifier,
builder: (_, legendVisible, __) => IconLabelButton(
key: legendKey,
onPressed: () {
controller.toggleLegendVisibility();
if (legendVisible) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ import 'package:flutter/material.dart';

import '../../../../shared/common_widgets.dart';
import '../../../../shared/theme.dart';
import '../../../../shared/utils.dart';
import '../../primitives/painting.dart';
import '../../shared/constants.dart';
import 'chart_pane_controller.dart';
import 'memory_android_chart.dart';
import 'memory_charts.dart';
import 'memory_events_pane.dart';
import 'memory_vm_chart.dart';

late final _legendWidth = scaleByFontFactor(200.0);
late final _legendTextWidth = scaleByFontFactor(55.0);
late final _legendHeight1Chart = scaleByFontFactor(200.0);
late final _legendHeight2Charts = scaleByFontFactor(323.0);

/// Padding for each title in the legend.
const _legendTitlePadding = EdgeInsets.fromLTRB(5, 0, 0, 4);

class MemoryChartLegend extends StatelessWidget {
const MemoryChartLegend({
super.key,
Expand All @@ -35,7 +43,7 @@ class MemoryChartLegend extends StatelessWidget {
final events = eventLegendContent(colorScheme.isLight);
legendRows.add(
Container(
padding: legendTitlePadding,
padding: _legendTitlePadding,
child: Text('Events Legend', style: legendHeading),
),
);
Expand All @@ -56,7 +64,7 @@ class MemoryChartLegend extends StatelessWidget {
final vms = vmLegendContent(chartController.vm);
legendRows.add(
Container(
padding: legendTitlePadding,
padding: _legendTitlePadding,
child: Text('Memory Legend', style: legendHeading),
),
);
Expand All @@ -74,7 +82,7 @@ class MemoryChartLegend extends StatelessWidget {
final androids = androidLegendContent(chartController.android);
legendRows.add(
Container(
padding: legendTitlePadding,
padding: _legendTitlePadding,
child: Text('Android Legend', style: legendHeading),
),
);
Expand All @@ -90,10 +98,10 @@ class MemoryChartLegend extends StatelessWidget {
}

return Container(
width: legendWidth,
width: _legendWidth,
// The height is specified here,
// because [legendRows] are designed to take all available space.
height: isAndroidVisible ? legendHeight2Charts : legendHeight1Chart,
height: isAndroidVisible ? _legendHeight2Charts : _legendHeight1Chart,
padding: const EdgeInsets.fromLTRB(0, densePadding, densePadding, 0),
decoration: BoxDecoration(
color: colorScheme.defaultBackgroundColor,
Expand Down Expand Up @@ -135,7 +143,7 @@ class LegendRow extends StatelessWidget {
Expanded(
child: Container(
padding: EdgeInsets.fromLTRB(leftEdge, 0, 0, 2),
width: legendTextWidth + leftEdge,
width: _legendTextWidth + leftEdge,
child: Text(name, style: legendEntry),
),
),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/foundation.dart';

const memorySourceMenuItemPrefix = 'Source: ';
const sourcesDropdownKey = Key('Sources Dropdown');
const sourcesKey = Key('Sources');
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import '../../memory_controller.dart';
import '../../primitives/ui.dart';
import '../../shared/constants.dart';
import '../chart/chart_pane_controller.dart';
import 'primitives.dart';
import 'settings_dialog.dart';
import 'source_dropdown.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter/material.dart';
import '../../../../shared/common_widgets.dart';
import '../../../../shared/utils.dart';
import '../../memory_controller.dart';
import '../../shared/constants.dart';
import 'primitives.dart';

class SourceDropdownMenuItem<T> extends DropdownMenuItem<T> {
const SourceDropdownMenuItem({T? value, required Widget child})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/material.dart';

import '../../../shared/utils.dart';

/// When to have verbose Dropdown based on media width.
const verboseDropDownMinimumWidth = 950;

const legendXOffset = 20;
const legendYOffset = 7.0;
double get legendWidth => scaleByFontFactor(200.0);
double get legendTextWidth => scaleByFontFactor(55.0);
double get legendHeight1Chart => scaleByFontFactor(200.0);
double get legendHeight2Charts => scaleByFontFactor(323.0);

const memorySourceMenuItemPrefix = 'Source: ';
final legendKey = GlobalKey(debugLabel: 'Legend Button');
const sourcesDropdownKey = Key('Sources Dropdown');
const sourcesKey = Key('Sources');

/// Padding for each title in the legend.
const legendTitlePadding = EdgeInsets.fromLTRB(5, 0, 0, 4);
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import 'package:devtools_app/src/screens/memory/memory_screen.dart';
import 'package:devtools_app/src/screens/memory/panes/chart/chart_control_pane.dart';
import 'package:devtools_app/src/screens/memory/panes/chart/memory_events_pane.dart';
import 'package:devtools_app/src/screens/memory/panes/chart/memory_vm_chart.dart';
import 'package:devtools_app/src/screens/memory/panes/control/primitives.dart';
import 'package:devtools_app/src/screens/memory/panes/control/source_dropdown.dart';
import 'package:devtools_app/src/screens/memory/shared/constants.dart';
import 'package:devtools_app/src/service/service_manager.dart';
import 'package:devtools_app/src/shared/common_widgets.dart';
import 'package:devtools_app/src/shared/globals.dart';
Expand Down