mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 09:16:54 +00:00
fix: Hide memory metrics card when there are none
This commit is contained in:
parent
e065463ffb
commit
751de80840
|
@ -39,49 +39,51 @@ class _Chart extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
FilledCard(
|
if (!(state is MetricsLoaded && state.memoryMetrics == null))
|
||||||
clipped: false,
|
FilledCard(
|
||||||
child: Padding(
|
clipped: false,
|
||||||
padding: const EdgeInsets.all(16.0),
|
child: Padding(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(16.0),
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
Text(
|
children: [
|
||||||
'resource_chart.memory'.tr(),
|
Text(
|
||||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
'resource_chart.memory'.tr(),
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||||
),
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
|
||||||
Stack(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
children: [
|
|
||||||
if (state is MetricsLoaded && state.memoryMetrics != null)
|
|
||||||
getMemoryChart(state),
|
|
||||||
AnimatedOpacity(
|
|
||||||
duration: const Duration(milliseconds: 200),
|
|
||||||
opacity: state is MetricsLoading ? 1 : 0,
|
|
||||||
child: const _GraphLoadingCardContent(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const Divider(),
|
|
||||||
ListTile(
|
|
||||||
title: Text('resource_chart.view_usage_by_service'.tr()),
|
|
||||||
leading: Icon(
|
|
||||||
Icons.area_chart_outlined,
|
|
||||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
|
||||||
),
|
),
|
||||||
onTap: () {
|
const SizedBox(height: 16),
|
||||||
context.pushRoute(
|
Stack(
|
||||||
const MemoryUsageByServiceRoute(),
|
alignment: Alignment.center,
|
||||||
);
|
children: [
|
||||||
},
|
if (state is MetricsLoaded && state.memoryMetrics != null)
|
||||||
),
|
getMemoryChart(state),
|
||||||
],
|
AnimatedOpacity(
|
||||||
|
duration: const Duration(milliseconds: 200),
|
||||||
|
opacity: state is MetricsLoading ? 1 : 0,
|
||||||
|
child: const _GraphLoadingCardContent(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
ListTile(
|
||||||
|
title: Text('resource_chart.view_usage_by_service'.tr()),
|
||||||
|
leading: Icon(
|
||||||
|
Icons.area_chart_outlined,
|
||||||
|
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
|
onTap: () {
|
||||||
|
context.pushRoute(
|
||||||
|
const MemoryUsageByServiceRoute(),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
enabled: state is MetricsLoaded,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
FilledCard(
|
FilledCard(
|
||||||
clipped: false,
|
clipped: false,
|
||||||
|
|
Loading…
Reference in a new issue