Skip to content

feat: implement error event detail view for all events panel and upda… - #15

Merged
buivietphi merged 1 commit into
mainfrom
feat/error-detail-copy-and-select-hint
Jul 6, 2026
Merged

buivietphi merged 1 commit into
mainfrom
feat/error-detail-copy-and-select-hint

Conversation

@buivietphi

@buivietphi buivietphi commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

…te selection styling

Description

Related Issue

Type of Change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation update
  • Performance improvement
  • CI/CD or build configuration
  • Other (describe below)

Testing

  • Tested on macOS
  • Tested on Windows
  • Flutter analyze passes
  • SDK build passes (if applicable)

Screenshots (if applicable)

Summary by CodeRabbit

  • New Features

    • Added dedicated error details views with severity/platform badges, metadata, and improved single-page scrolling.
    • Added copy-to-clipboard actions for error message and stack trace, with toast confirmation.
    • Introduced reusable copy controls and visual badge styling for error states.
  • Bug Fixes

    • Improved error list selection behavior so selected items refresh correctly and show updated styling.
    • Enhanced detail panels to better handle error content and display stack traces only when available.

@buivietphi
buivietphi merged commit fde8f1b into main Jul 6, 2026
1 of 5 checks passed
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 2c7b8983-d078-47ed-9415-6ae5b915e2c2

📥 Commits

Reviewing files that changed from the base of the PR and between a537d18 and bb5443b.

📒 Files selected for processing (9)
  • lib/features/all_events/presentation/detail/error_detail.dart
  • lib/features/all_events/presentation/detail/error_tokens.dart
  • lib/features/all_events/presentation/detail/event_detail_panel.dart
  • lib/features/all_events/presentation/detail/platform_badge.dart
  • lib/features/all_events/presentation/detail/severity_badge.dart
  • lib/features/error_inspector/presentation/detail/error_detail_panel.dart
  • lib/features/error_inspector/presentation/event_row/error_list_item.dart
  • lib/features/error_inspector/presentation/pages/error_inspector_page.dart
  • lib/features/error_inspector/presentation/shared/copy_button.dart

📝 Walkthrough

Walkthrough

Adds an ErrorDetail widget with severity/platform badges and token helpers for rendering error events in the all_events detail panel, wires it into EventDetailPanel, and adds a shared CopyButton widget wired into copy-to-clipboard actions in both the new ErrorDetail and existing error_detail_panel.dart. Also updates ErrorListItem selection styling and ErrorInspectorPage selection-change rebuild logic.

Changes

Error Detail Presentation (all_events)

Layer / File(s) Summary
Severity/platform tokens
lib/features/all_events/presentation/detail/error_tokens.dart
Adds severityColor, platformLabel, platformColor functions mapping ErrorSeverity/ErrorPlatform enums to colors/labels via switch statements.
Badge widgets
lib/features/all_events/presentation/detail/severity_badge.dart, platform_badge.dart
New SeverityBadge and PlatformBadge stateless widgets rendering tinted pill labels using the token helpers.
ErrorDetail widget
lib/features/all_events/presentation/detail/error_detail.dart
New ErrorDetail StatefulWidget with a SmoothScrollController, copy-to-clipboard actions with toast feedback, header badges, message/stack trace rows, a details section, and a private _DetailRow formatter.
EventDetailPanel wiring
lib/features/all_events/presentation/detail/event_detail_panel.dart
Imports ErrorEvent/ErrorDetail; _buildContent() returns ErrorDetail for EventType.error when rawData is ErrorEvent, else FallbackDetail.

Copy Button and Error Inspector Panel Updates

Layer / File(s) Summary
Shared CopyButton
lib/features/error_inspector/presentation/shared/copy_button.dart
New stateful CopyButton with tooltip, hover animation, tap callback, and default copy icon.
Error inspector panel copy actions
lib/features/error_inspector/presentation/detail/error_detail_panel.dart
Adds clipboard/toast imports and a _copyText helper; wires CopyButton into Message and Stack Trace tab layouts.
List item selection & page rebuild
lib/features/error_inspector/presentation/event_row/error_list_item.dart, pages/error_inspector_page.dart
ErrorListItem uses ColorTokens.selectedBg/selectedAccent for selection styling; ErrorInspectorPage registers a listener bumping _generation and calling setState on selection change.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Poem

A rabbit hops through panels bright,
Copying errors left and right. 📋
Badges glow in red and blue,
Cross-platform tags shine clear and true.
Click, toast, and scroll with care —
Stack traces now beyond compare! 🐇

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/error-detail-copy-and-select-hint

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a dedicated ErrorDetail view for error events in the all_events side panel, complete with platform and severity badges, copy buttons, and improved selection styling in the error list. Feedback focuses on internationalizing hardcoded strings, adding a missing metadata section to the new error detail panel, and ensuring that screenshot generation logic is updated to support the new error event type instead of falling back to a generic layout.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +125 to +130
_DetailRow('Platform', entry.platform.name),
_DetailRow('Severity', entry.severity.name),
_DetailRow('Source', entry.source ?? 'unknown'),
_DetailRow('Device ID', entry.deviceId),
if (entry.deviceInfo != null)
_DetailRow('Device Info', entry.deviceInfo!),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Improve user-facing details by using localized labels and properly formatted values (e.g., uppercase severity and platformLabel for platforms). Additionally, include the missing metadata section to match the ErrorDetailPanel functionality.

          _DetailRow(S.of(context).platform, platformLabel(entry.platform)),
          _DetailRow(S.of(context).severity, entry.severity.name.toUpperCase()),
          _DetailRow(S.of(context).source, entry.source ?? 'unknown'),
          _DetailRow(S.of(context).deviceId, entry.deviceId),
          if (entry.deviceInfo != null)
            _DetailRow(S.of(context).deviceInfo, entry.deviceInfo!),
          if (entry.metadata != null && entry.metadata!.isNotEmpty) ...[
            const SizedBox(height: 12),
            Text(
              'Metadata',
              style: TextStyle(
                fontSize: 11,
                fontWeight: FontWeight.w600,
                color: Colors.grey[500],
              ),
            ),
            const SizedBox(height: 4),
            Container(
              width: double.infinity,
              padding: const EdgeInsets.all(12),
              decoration: BoxDecoration(
                color: isDark ? Colors.black26 : Colors.grey.shade100,
                borderRadius: BorderRadius.circular(8),
              ),
              child: Text(
                entry.metadata.toString(),
                style: TextStyle(
                  fontFamily: AppConstants.monoFontFamily,
                  fontSize: 11,
                  color: isDark ? Colors.white70 : Colors.black87,
                ),
              ),
            ),
          ],

Comment on lines +4 to +11
import '../../../../core/constants/app_constants.dart';
import '../../../../core/utils/smooth_scroll_controller.dart';
import '../../../../core/utils/toast_utils.dart';
import '../../../../models/log/error_event.dart';
import '../shared/copy_button.dart';
import '../shared/error_block.dart';
import 'platform_badge.dart';
import 'severity_badge.dart';

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Import app_localizations.dart and error_tokens.dart to support internationalization and proper formatting of platform labels.

Suggested change
import '../../../../core/constants/app_constants.dart';
import '../../../../core/utils/smooth_scroll_controller.dart';
import '../../../../core/utils/toast_utils.dart';
import '../../../../models/log/error_event.dart';
import '../shared/copy_button.dart';
import '../shared/error_block.dart';
import 'platform_badge.dart';
import 'severity_badge.dart';
import '../../../../core/constants/app_constants.dart';
import '../../../../core/utils/smooth_scroll_controller.dart';
import '../../../../core/utils/toast_utils.dart';
import '../../../../l10n/app_localizations.dart';
import '../../../../models/log/error_event.dart';
import '../shared/copy_button.dart';
import '../shared/error_block.dart';
import 'error_tokens.dart' show platformLabel;
import 'platform_badge.dart';
import 'severity_badge.dart';

Comment on lines +63 to +75
Text(
'Message',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Colors.grey[500],
),
),
const Spacer(),
CopyButton(
tooltip: 'Copy message',
onTap: () => _copyText(context, entry.message, 'Message'),
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Use localized strings from S.of(context) instead of hardcoded 'Message' to adhere to internationalization standards.

Suggested change
Text(
'Message',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Colors.grey[500],
),
),
const Spacer(),
CopyButton(
tooltip: 'Copy message',
onTap: () => _copyText(context, entry.message, 'Message'),
),
Text(
S.of(context).message,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Colors.grey[500],
),
),
const Spacer(),
CopyButton(
tooltip: 'Copy message',
onTap: () => _copyText(context, entry.message, S.of(context).message),
),

Comment on lines +116 to +123
Text(
'Details',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Colors.grey[500],
),
),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Use localized strings from S.of(context) instead of hardcoded 'Details' to adhere to internationalization standards.

Suggested change
Text(
'Details',
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Colors.grey[500],
),
),
Text(
S.of(context).details,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w600,
color: Colors.grey[500],
),
),

Comment on lines 1432 to 1436
case EventType.error:
if (widget.event.rawData is ErrorEvent) {
return ErrorDetail(entry: widget.event.rawData as ErrorEvent);
}
return FallbackDetail(event: widget.event);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While ErrorDetail is now correctly returned for the live UI, the screenshot generation logic in _buildScreenshotContent (which is outside this diff) still falls back to _fallbackScreenshot for EventType.error.

To ensure that screenshots of error events match the beautifully formatted live UI instead of rendering a generic fallback layout, please update _buildScreenshotContent to handle EventType.error by extracting the ErrorEvent and rendering a dedicated layout (similar to how it's done for log, network, state, and storage).

@coderabbitai coderabbitai Bot mentioned this pull request Jul 11, 2026
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant