@@ -14,10 +14,9 @@ import '../../shared/primitives/utils.dart';
1414import 'logging_controller.dart' ;
1515
1616class MetadataChips extends StatelessWidget {
17- const MetadataChips ({super .key, required this .data, this .onKindTapped });
17+ const MetadataChips ({super .key, required this .data});
1818
1919 final LogData data;
20- final void Function (String kind)? onKindTapped;
2120
2221 @override
2322 Widget build (BuildContext context) {
@@ -92,7 +91,6 @@ class MetadataChips extends StatelessWidget {
9291 iconAsset: kindIcon.iconAsset,
9392 backgroundColor: kindColors.background,
9493 foregroundColor: kindColors.foreground,
95- onTap: onKindTapped != null ? () => onKindTapped !(data.kind) : null ,
9694 ),
9795 logLevelChip,
9896 if (elapsedFrameTimeAsString != null )
@@ -117,7 +115,6 @@ abstract class MetadataChip extends StatelessWidget {
117115 this .foregroundColor,
118116 this .outlined = false ,
119117 this .includeLeadingMargin = true ,
120- this .onTap,
121118 });
122119
123120 final IconData ? icon;
@@ -128,7 +125,6 @@ abstract class MetadataChip extends StatelessWidget {
128125 final Color ? foregroundColor;
129126 final bool outlined;
130127 final bool includeLeadingMargin;
131- final VoidCallback ? onTap;
132128
133129 static const horizontalPadding = densePadding;
134130 static const verticalPadding = borderPadding;
@@ -144,60 +140,50 @@ abstract class MetadataChip extends StatelessWidget {
144140 final foregroundColor =
145141 this .foregroundColor ?? theme.colorScheme.onSecondaryContainer;
146142
147- Widget chip = Container (
148- decoration: BoxDecoration (
149- color: backgroundColor,
150- borderRadius: BorderRadius .circular (_borderRadius),
151- border: outlined
152- ? Border .all (color: theme.colorScheme.subtleTextColor)
143+ return maybeWrapWithTooltip (
144+ tooltip: tooltip,
145+ child: Container (
146+ decoration: BoxDecoration (
147+ color: backgroundColor,
148+ borderRadius: BorderRadius .circular (_borderRadius),
149+ border: outlined
150+ ? Border .all (color: theme.colorScheme.subtleTextColor)
151+ : null ,
152+ ),
153+ margin: includeLeadingMargin
154+ ? const EdgeInsets .only (left: denseSpacing)
153155 : null ,
154- ),
155- margin: includeLeadingMargin
156- ? const EdgeInsets .only (left: denseSpacing)
157- : null ,
158- padding: const EdgeInsets .symmetric (
159- horizontal: horizontalPadding,
160- vertical: verticalPadding,
161- ),
162- child: Row (
163- mainAxisSize: MainAxisSize .min,
164- children: [
165- if (icon != null || iconAsset != null ) ...[
166- DevToolsIcon (
167- icon: icon,
168- iconAsset: iconAsset,
169- size: _metadataIconSize,
170- color: foregroundColor,
171- ),
172- const SizedBox (width: iconPadding),
173- ] else
174- // Include an empty SizedBox to ensure a consistent height for the
175- // chips, regardless of whether the chip includes an icon.
176- const SizedBox (height: _metadataIconSize),
177- RichText (
178- text: TextSpan (
179- text: text,
180- style: theme
181- .regularTextStyleWithColor (foregroundColor)
182- .copyWith (fontSize: smallFontSize),
156+ padding: const EdgeInsets .symmetric (
157+ horizontal: horizontalPadding,
158+ vertical: verticalPadding,
159+ ),
160+ child: Row (
161+ mainAxisSize: MainAxisSize .min,
162+ children: [
163+ if (icon != null || iconAsset != null ) ...[
164+ DevToolsIcon (
165+ icon: icon,
166+ iconAsset: iconAsset,
167+ size: _metadataIconSize,
168+ color: foregroundColor,
169+ ),
170+ const SizedBox (width: iconPadding),
171+ ] else
172+ // Include an empty SizedBox to ensure a consistent height for the
173+ // chips, regardless of whether the chip includes an icon.
174+ const SizedBox (height: _metadataIconSize),
175+ RichText (
176+ text: TextSpan (
177+ text: text,
178+ style: theme
179+ .regularTextStyleWithColor (foregroundColor)
180+ .copyWith (fontSize: smallFontSize),
181+ ),
183182 ),
184- ) ,
185- ] ,
183+ ] ,
184+ ) ,
186185 ),
187186 );
188-
189- if (onTap != null ) {
190- chip = MouseRegion (
191- cursor: SystemMouseCursors .click,
192- child: GestureDetector (
193- onTap: onTap,
194- behavior: HitTestBehavior .opaque,
195- child: chip,
196- ),
197- );
198- }
199-
200- return maybeWrapWithTooltip (tooltip: tooltip, child: chip);
201187 }
202188}
203189
@@ -209,7 +195,6 @@ class KindMetaDataChip extends MetadataChip {
209195 super .iconAsset,
210196 super .backgroundColor,
211197 super .foregroundColor,
212- super .onTap,
213198 }) : super (text: kind, includeLeadingMargin: false );
214199
215200 static ({IconData ? icon, String ? iconAsset}) generateIcon (String kind) {
0 commit comments