Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 8, 2025

Thanks a lot for contributing!

TalkerScreen displayed empty entries and grey colors for custom logs that override generateTextMessage() and pen properties. Console output worked correctly, but the Flutter UI ignored custom implementations.

Changes

Core Fixes:

  • data_card.dart: Enhanced _message getter to detect custom generateTextMessage() overrides via heuristics (newlines or significant length deltas)
  • talker_data.dart: Added pen color conversion as fallback in getFlutterColor() lookup chain: key → logLevel → pen → grey

New Utility:

  • ansi_color_converter.dart: Converts AnsiPen terminal colors to Flutter Colors
    • Parses ANSI escape codes (standard, bright, xterm-256, RGB)
    • Includes caching for performance
    • Color mappings extracted to static const maps

Example:

class CustomLog extends TalkerLog {
  @override
  String generateTextMessage({TimeFormat timeFormat = TimeFormat.timeAndSeconds}) {
    return '[$title] $message\nExtra: $data';  // Now displays in UI
  }

  @override
  AnsiPen get pen => AnsiPen()..magenta();  // Auto-converts to Flutter Color
}

Previously required duplicate color configuration in TalkerSettings.colors and TalkerScreenTheme.logColors. Now pen colors are automatically converted when key not found in theme.

Documentation:

  • Added docs/TALKER_SCREEN_FIXES.md with migration guide
  • Updated CHANGELOG.md
  • Added example custom logs in example/lib/custom_logs_example.dart

All changes backward compatible.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/flutter_infra_release/flutter/a5cb96369ef86c7e85abf5d662a1ca5d89775053/dart-sdk-linux-x64.zip
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /tmp/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED packages/talker_-l ndor/bin/grep grep -l xterm\|rgb est.dart grep class.*extends Tbash (http block)
    • Triggering command: /usr/bin/curl curl --retry 3 --continue-at - --location --output /home/REDACTED/flutter/bin/cache/dart-sdk-linux-x64.zip REDACTED d_guarded_native-f grep grep -l xterm\|rgb .dart /usr/bin/grep rs s/bloc/bloc.dart--nonblock rgo/bin/grep grep (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Incorrect colors and empty logs in TalkerScreen</issue_title>
<issue_description>When using a custom log implementation that overrides generateTextMessage, pen, and key, the TalkerScreen displays incorrect colors and shows empty log entries.

Steps to Reproduce

  1. Create a custom log and override generateTextMessage.
  2. Create a custom log and override pen and key.
  3. Open TalkerScreen.
  4. Observe incorrect colors and empty logs.

Expected Behavior
The colors on TalkerScreen should be displayed correctly.

Screenshots
Image
Image

issue.zip</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 5 commits December 8, 2025 10:15
- Modified data_card.dart to use generateTextMessage() for custom logs
- Created ansi_color_converter.dart utility to convert AnsiPen to Flutter Colors
- Enhanced talker_data.dart extension to try converting pen field when key not in theme

Co-authored-by: Frezyx <[email protected]>
- Created custom_logs_example.dart with examples of custom logs
- Updated main.dart to use the example logs
- Demonstrates both generateTextMessage() override and pen color conversion

Co-authored-by: Frezyx <[email protected]>
- Created TALKER_SCREEN_FIXES.md with detailed explanation
- Updated CHANGELOG.md with fix descriptions
- Documented migration guide and examples

Co-authored-by: Frezyx <[email protected]>
- Improved custom log detection heuristic to be more robust
- Made color definitions consistent using Color(0xFFxxx) format
- Added caching to AnsiColorConverter to improve performance

Co-authored-by: Frezyx <[email protected]>
- Added named constants for magic numbers
- Extracted color mappings to static const maps
- Improved code maintainability and readability

Co-authored-by: Frezyx <[email protected]>
Copilot AI changed the title [WIP] Fix incorrect colors and empty logs in TalkerScreen Fix TalkerScreen empty logs and incorrect colors for custom logs Dec 8, 2025
Copilot AI requested a review from Frezyx December 8, 2025 10:25
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.

Incorrect colors and empty logs in TalkerScreen

2 participants