Improve share intake diagnostics
This commit is contained in:
@@ -520,11 +520,12 @@ class _ShareDiagnosticsDialog extends StatelessWidget {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: events
|
||||
.map(
|
||||
(ShareIntakeDebugEvent event) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: SelectableText(
|
||||
'${_debugTimeLabel(event.at)} ${event.stage}\n${event.message}',
|
||||
),
|
||||
(
|
||||
ShareIntakeDebugEvent event,
|
||||
) => _ShareDiagnosticsEventTile(
|
||||
event: event,
|
||||
label:
|
||||
'${_debugTimeLabel(event.at)} ${event.stage}\n${event.message}',
|
||||
),
|
||||
)
|
||||
.toList(growable: false),
|
||||
@@ -545,6 +546,51 @@ class _ShareDiagnosticsDialog extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _ShareDiagnosticsEventTile extends StatelessWidget {
|
||||
const _ShareDiagnosticsEventTile({required this.event, required this.label});
|
||||
|
||||
final ShareIntakeDebugEvent event;
|
||||
final String label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String? details = event.details;
|
||||
if (details == null || details.isEmpty) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: SelectableText(label),
|
||||
);
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 10),
|
||||
child: ExpansionTile(
|
||||
tilePadding: EdgeInsets.zero,
|
||||
childrenPadding: const EdgeInsets.only(top: 6, bottom: 8),
|
||||
title: SelectableText(label),
|
||||
subtitle: Text(
|
||||
'Tap to show raw shared text (${details.length} chars).',
|
||||
),
|
||||
children: <Widget>[
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(color: Theme.of(context).dividerColor),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SelectableText(details),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _debugTimeLabel(DateTime value) {
|
||||
return '${value.hour.toString().padLeft(2, '0')}:${value.minute.toString().padLeft(2, '0')}:${value.second.toString().padLeft(2, '0')}';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user