Skip to content

Commit 99829a3

Browse files
committed
Node screen: Use ExpansionTile also for subsets
This avoids having a very large number of elements in the screen if lots of metrics are published.
1 parent 1847569 commit 99829a3

File tree

1 file changed

+24
-29
lines changed

1 file changed

+24
-29
lines changed

lib/screens/node.dart

+24-29
Original file line numberDiff line numberDiff line change
@@ -481,39 +481,34 @@ class Subset extends StatelessWidget {
481481
? 'Events'
482482
: 'Attributes';
483483

484+
Widget? icon = (node.hasReportingSetup(path))
485+
? IconButton(
486+
icon: const Icon(Icons.notifications, color: primaryColor),
487+
onPressed: () async {
488+
await _reportingSetupDialog(
489+
context, connector, node, subsetName, '_Reporting/$path');
490+
},
491+
)
492+
: null;
493+
484494
return Theme(
485495
data: Theme.of(context).copyWith(dividerColor: Colors.transparent),
486496
child: Card(
487-
child: Column(
488-
crossAxisAlignment: CrossAxisAlignment.start,
489-
children: <Widget>[
490-
Row(
491-
children: [
492-
Padding(
493-
padding: const EdgeInsets.all(15),
494-
child: Text(
495-
'$descr $subsetType',
496-
style: const TextStyle(
497-
fontWeight: FontWeight.bold,
498-
fontSize: 16,
499-
),
500-
),
501-
),
502-
const Spacer(),
503-
if (node.hasReportingSetup(path))
504-
Padding(
505-
padding: const EdgeInsets.symmetric(horizontal: 16),
506-
child: IconButton(
507-
icon:
508-
const Icon(Icons.notifications, color: primaryColor),
509-
onPressed: () async {
510-
await _reportingSetupDialog(context, connector, node,
511-
subsetName, '_Reporting/$path');
512-
},
513-
),
514-
),
515-
],
497+
clipBehavior: Clip.antiAlias,
498+
child: ExpansionTile(
499+
trailing: icon,
500+
controlAffinity: ListTileControlAffinity.leading,
501+
title: Padding(
502+
padding: const EdgeInsets.all(10),
503+
child: Text(
504+
'$descr $subsetType',
505+
style: const TextStyle(
506+
fontWeight: FontWeight.bold,
507+
),
516508
),
509+
),
510+
backgroundColor: Theme.of(context).colorScheme.surfaceContainerHigh,
511+
children: <Widget>[
517512
if (data is List && data.length > 0)
518513
Padding(
519514
padding: const EdgeInsets.all(8),

0 commit comments

Comments
 (0)