Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c committed Apr 25, 2024
1 parent fc42147 commit 02c2c06
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ import '../../../shared/primitives/painting.dart';
import '../controller/chart_pane_controller.dart';
import '../data/charts.dart';
import 'chart_control_pane.dart';
import 'charts/android_chart.dart';
import 'charts/events_chart.dart';
import 'memory_chart.dart';
import 'legend.dart';
import 'memory_chart.dart';

class MemoryChartPane extends StatefulWidget {
const MemoryChartPane({
Expand Down Expand Up @@ -144,6 +142,7 @@ class _MemoryChartPaneState extends State<MemoryChartPane>

@override
Widget build(BuildContext context) {
final sampleAdded = widget.chart.data.timeline.sampleAdded;
const memoryEventsPainHeight = 70.0;
return ValueListenableBuilder<bool>(
valueListenable: preferences.memory.showChart,
Expand All @@ -168,16 +167,13 @@ class _MemoryChartPaneState extends State<MemoryChartPane>
children: [
SizedBox(
height: memoryEventsPainHeight,
child: MemoryEventsPane(widget.chart.event),
child: MemoryChart(widget.chart.event, sampleAdded),
),
MemoryVMChart(widget.chart.vm),
MemoryChart(widget.chart.vm, sampleAdded),
if (widget.chart.isAndroidChartVisible.value)
SizedBox(
height: defaultChartHeight,
child: MemoryAndroidChart(
widget.chart.android,
widget.chart.data.timeline,
),
child: MemoryChart(widget.chart.android, sampleAdded),
),
],
),
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,24 @@

import 'package:devtools_app_shared/ui.dart';
import 'package:devtools_app_shared/utils.dart';
import 'package:devtools_shared/devtools_shared.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import '../../../../../shared/charts/chart.dart';
import '../../../../../shared/charts/chart_controller.dart';
import '../controller/charts/vm_chart_controller.dart';

class MemoryVMChart extends StatefulWidget {
const MemoryVMChart(this.chart, {super.key});
class MemoryChart extends StatefulWidget {
const MemoryChart(this.chart, this.sampleAdded, {super.key});

final VMChartController chart;
final ChartController chart;
final ValueListenable<HeapSample?> sampleAdded;

@override
MemoryVMChartState createState() => MemoryVMChartState();
MemoryChartState createState() => MemoryChartState();
}

class MemoryVMChartState extends State<MemoryVMChart> with AutoDisposeMixin {
class MemoryChartState extends State<MemoryChart> with AutoDisposeMixin {
@override
void initState() {
super.initState();
Expand All @@ -28,11 +30,11 @@ class MemoryVMChartState extends State<MemoryVMChart> with AutoDisposeMixin {

void _init() {
cancelListeners();
addAutoDisposeListener(widget.chart.memoryTimeline.sampleAdded);
addAutoDisposeListener(widget.sampleAdded);
}

@override
void didUpdateWidget(covariant MemoryVMChart oldWidget) {
void didUpdateWidget(covariant MemoryChart oldWidget) {
super.didUpdateWidget(oldWidget);
if (oldWidget.chart == widget.chart) return;
_init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void main() {

expect(find.text('GC'), findsOneWidget);

expect(find.byType(MemoryVMChart), findsOneWidget);
expect(find.byType(MemoryChart), findsOneWidget);
},
);
});
Expand Down

0 comments on commit 02c2c06

Please sign in to comment.