feat: update login, event detail, theme, and API client

- Improved event detail page with carousel, map, and layout fixes
- Updated login screen with video background and glassmorphism
- API client development mode with mock responses
- Theme manager and main app updates

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-14 08:57:25 +05:30
parent 4acf75902c
commit e0f34398c2
6 changed files with 662 additions and 268 deletions

View File

@@ -6,6 +6,8 @@ import '../storage/token_storage.dart';
class ApiClient {
static const Duration _timeout = Duration(seconds: 30);
// Set to true to enable mock/offline development mode (useful when backend is unavailable)
static const bool _developmentMode = true;
/// POST request
///
@@ -34,6 +36,30 @@ class ApiClient {
.timeout(_timeout);
} catch (e) {
if (kDebugMode) debugPrint('ApiClient.post network error: $e');
// Development mode: return mock responses for common endpoints on network errors
if (_developmentMode) {
if (url.contains('/user/login/')) {
if (kDebugMode) debugPrint('Development mode: returning mock login response');
final email = finalBody['username'] ?? 'test@example.com';
return {
'token': 'mock_token_${DateTime.now().millisecondsSinceEpoch}',
'username': email,
'email': email,
'phone_number': '+1234567890',
};
} else if (url.contains('/user/register/')) {
if (kDebugMode) debugPrint('Development mode: returning mock register response');
final email = finalBody['email'] ?? 'test@example.com';
return {
'token': 'mock_token_${DateTime.now().millisecondsSinceEpoch}',
'username': email,
'email': email,
'phone_number': finalBody['phone_number'] ?? '+1234567890',
};
}
}
throw Exception('Network error: $e');
}