Upgraded DebugLogger with: - Log levels (debug, info, warning, error) for better filtering - Context parameter for categorizing log sources - generateBugReport() with device info, app version, and log stats - Increased log retention to 1000 entries Updated debug log screen: - Added share button to generate and share bug reports - Added level filter chips (All, Info+, Warnings, Errors) - Color-coded log entries by level - Shows filtered entry count Replaced raw print() statements with proper logging: - metadata_service.dart: API errors as warnings - artist_card.dart: Fallback image lookups as debug - palette_helper.dart: Palette extraction errors as warnings - theme_provider.dart: Color extraction as debug - system_theme_helper.dart: System color errors as warnings - playlist_details_screen.dart: Playlist operations as info/error Added dependencies: - package_info_plus: App version info for reports - device_info_plus: Device details for reports - share_plus: Native share functionality 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
47 lines
1.5 KiB
Dart
47 lines
1.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:dynamic_color/dynamic_color.dart';
|
|
import '../services/debug_logger.dart';
|
|
|
|
final _systemThemeLogger = DebugLogger();
|
|
|
|
class SystemThemeHelper {
|
|
/// Attempts to get system color schemes from the device (Android 12+)
|
|
/// Returns a tuple of (light, dark) ColorScheme if successful, null otherwise
|
|
static Future<(ColorScheme, ColorScheme)?> getSystemColorSchemes() async {
|
|
try {
|
|
// Try to get dynamic color schemes from the system
|
|
final corePalette = await DynamicColorPlugin.getCorePalette();
|
|
|
|
if (corePalette != null) {
|
|
// Generate color schemes from the core palette
|
|
final lightScheme = corePalette.toColorScheme(brightness: Brightness.light);
|
|
final darkScheme = corePalette.toColorScheme(brightness: Brightness.dark);
|
|
|
|
return (lightScheme, darkScheme);
|
|
} else {
|
|
// Fallback: try to get just the accent color
|
|
final accentColor = await DynamicColorPlugin.getAccentColor();
|
|
|
|
if (accentColor != null) {
|
|
// Generate color schemes from the accent color
|
|
final lightScheme = ColorScheme.fromSeed(
|
|
seedColor: accentColor,
|
|
brightness: Brightness.light,
|
|
);
|
|
|
|
final darkScheme = ColorScheme.fromSeed(
|
|
seedColor: accentColor,
|
|
brightness: Brightness.dark,
|
|
);
|
|
|
|
return (lightScheme, darkScheme);
|
|
}
|
|
}
|
|
} catch (e) {
|
|
_systemThemeLogger.warning('Failed to get system colors: $e', context: 'Theme');
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|