Compare commits

...
2 Commits
Author SHA1 Message Date
Jeroen SchweitzerandClaude Opus 4.5 eefb491e87 fix: log environment API user only once per session
Build and Push / release (push) Successful in 3s
Build and Push / build (push) Successful in 3m11s
- Store user in static variable for reuse
- Only debugPrint on first successful load

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 15:40:06 +01:00
Jeroen SchweitzerandClaude Opus 4.5 9b2000efc2 fix: sun position arc overflow and revert user display
Build and Push / release (push) Successful in 3s
Build and Push / build (push) Successful in 3m14s
- Constrain arc height to fit within card boundaries
- Scale radius down when arc would overflow on wider displays
- Revert user display in section header, use debugPrint instead

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 15:26:51 +01:00
4 changed files with 82 additions and 69 deletions
+19 -3
View File
@@ -7,13 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.5.6] - 2026-01-07
### Changed
- **Environment user logging** - Now logs API user only once per session instead of on every refresh
## [1.5.5] - 2026-01-07
### Fixed
- **Sun position arc overflow** - Arc now constrained to fit within card boundaries
- Prevents arc and sun/moon from overflowing on wider displays
- Scales radius down when arc height exceeds available space
### Added
- **Debug logging for environment user** - Logs authenticated user on environment data load
## [1.5.4] - 2026-01-07 ## [1.5.4] - 2026-01-07
### Added ### Added
- **User display in environment section** - Shows authenticated user in section header for debugging - User display in environment section header (reverted in 1.5.5)
- Displays `user: {username}` next to "Environment" header when data loads
- Helps diagnose user resolution issues with OIDC authentication
## [1.5.3] - 2026-01-07 ## [1.5.3] - 2026-01-07
@@ -26,6 +26,13 @@ class _DashboardContentState extends ConsumerState<DashboardContent> {
Timer? _systemStatsTimer; Timer? _systemStatsTimer;
Timer? _environmentTimer; Timer? _environmentTimer;
/// Tracks if we've logged the environment API user (log once per session)
static bool _hasLoggedEnvUser = false;
static String? _envApiUser;
/// Get the environment API user (available after first load)
static String? get envApiUser => _envApiUser;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@@ -129,62 +136,47 @@ class _DashboardContentState extends ConsumerState<DashboardContent> {
const SizedBox(height: 24), const SizedBox(height: 24),
// Environment - Sun, Weather, Forecast, Air Quality // Environment - Sun, Weather, Forecast, Air Quality
const _SectionHeader(title: 'Environment', icon: Icons.eco),
const SizedBox(height: 8),
environmentAsync.when( environmentAsync.when(
data: (envData) => Column( data: (envData) {
crossAxisAlignment: CrossAxisAlignment.start, // Store and log user once per session
children: [ if (!_hasLoggedEnvUser && envData.user != null) {
_SectionHeader( _envApiUser = envData.user;
title: 'Environment', _hasLoggedEnvUser = true;
icon: Icons.eco, debugPrint('Environment API user: ${envData.user}');
subtitle: envData.user != null ? 'user: ${envData.user}' : null, }
), return _EnvironmentSection(
const SizedBox(height: 8), envData: envData,
_EnvironmentSection( onRefresh: () => ref.invalidate(environmentProvider),
envData: envData, );
onRefresh: () => ref.invalidate(environmentProvider), },
), loading: () => const Card(
], child: Padding(
padding: EdgeInsets.all(32),
child: Center(child: CircularProgressIndicator()),
),
), ),
loading: () => Column( error: (error, _) => Card(
crossAxisAlignment: CrossAxisAlignment.start, child: Padding(
children: [ padding: const EdgeInsets.all(16),
const _SectionHeader(title: 'Environment', icon: Icons.eco), child: Row(
const SizedBox(height: 8), children: [
const Card( Icon(Icons.error_outline, color: colorScheme.error),
child: Padding( const SizedBox(width: 12),
padding: EdgeInsets.all(32), Expanded(
child: Center(child: CircularProgressIndicator()), child: Text(
), 'Failed to load environment data',
), style: TextStyle(color: colorScheme.error),
], ),
),
error: (error, _) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const _SectionHeader(title: 'Environment', icon: Icons.eco),
const SizedBox(height: 8),
Card(
child: Padding(
padding: const EdgeInsets.all(16),
child: Row(
children: [
Icon(Icons.error_outline, color: colorScheme.error),
const SizedBox(width: 12),
Expanded(
child: Text(
'Failed to load environment data',
style: TextStyle(color: colorScheme.error),
),
),
IconButton(
icon: const Icon(Icons.refresh),
onPressed: () => ref.invalidate(environmentProvider),
),
],
), ),
), IconButton(
icon: const Icon(Icons.refresh),
onPressed: () => ref.invalidate(environmentProvider),
),
],
), ),
], ),
), ),
), ),
const SizedBox(height: 24), const SizedBox(height: 24),
@@ -208,12 +200,10 @@ class _SectionHeader extends StatelessWidget {
const _SectionHeader({ const _SectionHeader({
required this.title, required this.title,
required this.icon, required this.icon,
this.subtitle,
}); });
final String title; final String title;
final IconData icon; final IconData icon;
final String? subtitle;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -234,15 +224,6 @@ class _SectionHeader extends StatelessWidget {
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
if (subtitle != null) ...[
const SizedBox(width: 8),
Text(
subtitle!,
style: Theme.of(context).textTheme.labelSmall?.copyWith(
color: colorScheme.outline,
),
),
],
], ],
); );
} }
+18 -2
View File
@@ -386,7 +386,15 @@ class _SunArcPainter extends CustomPainter {
// Calculate radius so arc endpoints touch horizon // Calculate radius so arc endpoints touch horizon
// For a chord of width W and arc angle θ: R = W / (2 * sin(θ/2)) // For a chord of width W and arc angle θ: R = W / (2 * sin(θ/2))
final radius = horizonWidth / (2 * math.sin(clampedAngle / 2)); var radius = horizonWidth / (2 * math.sin(clampedAngle / 2));
// Constrain arc height to fit within available space (leave 25px margin for sun)
final maxArcHeight = size.height - horizonY - 25;
final arcHeight = radius * (1 - math.cos(clampedAngle / 2));
if (arcHeight > maxArcHeight) {
// Scale radius down to fit
radius = maxArcHeight / (1 - math.cos(clampedAngle / 2));
}
// Arc center is below the horizon for an upward-bulging arc // Arc center is below the horizon for an upward-bulging arc
// Distance from chord to center = R * cos(θ/2) // Distance from chord to center = R * cos(θ/2)
@@ -491,7 +499,15 @@ class _SunArcPainter extends CustomPainter {
final clampedAngle = arcAngle.clamp(math.pi / 6, math.pi); final clampedAngle = arcAngle.clamp(math.pi / 6, math.pi);
// Calculate radius so arc endpoints touch horizon // Calculate radius so arc endpoints touch horizon
final radius = horizonWidth / (2 * math.sin(clampedAngle / 2)); var radius = horizonWidth / (2 * math.sin(clampedAngle / 2));
// Constrain arc height to fit within available space (leave 20px margin for moon)
final maxArcHeight = size.height - horizonY - 20;
final arcHeight = radius * (1 - math.cos(clampedAngle / 2));
if (arcHeight > maxArcHeight) {
// Scale radius down to fit
radius = maxArcHeight / (1 - math.cos(clampedAngle / 2));
}
// Arc center is below the horizon for an upward-bulging arc // Arc center is below the horizon for an upward-bulging arc
final horizonYPos = size.height - horizonY; final horizonYPos = size.height - horizonY;
+1 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 1.5.4+1 version: 1.5.6+1
environment: environment:
sdk: ^3.10.4 sdk: ^3.10.4