a89c7894cf
Backend: - FastAPI avec PostgreSQL et Redis - Authentification JWT complète - API REST pour musique, playlists, recherche - Streaming audio via yt-dlp - SQLAlchemy 2.0 async Frontend: - Flutter avec thème néon cyberpunk - State management Riverpod - Layout adaptatif desktop/mobile - Lecteur audio avec mini-player Infrastructure: - Docker Compose (PostgreSQL + Redis) - Scripts d'installation automatisés - Scripts de build pour exécutables Fichiers ajoutés: - BUILD_CLIENT_*.bat/sh: Scripts de compilation - BUILD_CLIENT_README.md: Documentation compilation - CHECK_FLUTTER.sh: Vérificateur d'environnement - requirements.txt mis à jour pour Python 3.13 - Modèles SQLAlchemy corrigés (metadata -> extra_metadata) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
6.7 KiB
6.7 KiB
Settings Page Implementation - Spotify Le 2
Overview
Complete Settings Page implementation with neon cyberpunk theme for user profile management, audio settings, and app preferences.
Files Created
1. Provider Layer
File: frontend/lib/presentation/providers/settings_provider.dart
Features:
- SettingsState: Manages user data, audio quality, download preferences, and cache
- SettingsNotifier: Handles all settings operations
- Load user profile from API
- Update profile (display name, avatar URL)
- Audio quality management (Low/Medium/High/Lossless)
- Cache calculation and clearing
- Persistent settings with SharedPreferences
- AudioQuality Enum: low, medium, high, lossless
2. Widgets Layer
frontend/lib/presentation/widgets/settings/settings_tile.dart
Reusable components:
- SettingsTile: Basic settings item with title, subtitle, icon, and trailing widget
- SettingsToggleTile: Settings item with toggle switch
- SettingsSectionHeader: Section title with uppercase styling
- SettingsCard: Container with neon glow border
frontend/lib/presentation/widgets/settings/profile_section.dart
Features:
- User avatar with gradient glow
- Display name, username, and email
- Premium badge indicator
- Edit Profile button
- Gradient background with cyberpunk styling
frontend/lib/presentation/widgets/settings/audio_quality_selector.dart
Features:
- Four audio quality options (Low/Medium/High/Lossless)
- Bitrate display (96/160/320 kbps / FLAC)
- Premium lock for Lossless quality
- Visual selection indicator
- Description for each quality level
frontend/lib/presentation/widgets/settings/cache_management_tile.dart
Features:
- Cache size calculation and display
- Format bytes (B/KB/MB/GB)
- Clear cache button with confirmation dialog
- Loading state during cache clearing
- Success/error snackbar notifications
frontend/lib/presentation/widgets/settings/edit_profile_dialog.dart
Features:
- Edit display name
- Avatar image picker
- Image preview
- Save/Cancel buttons
- Validation and error handling
- Note about server-side avatar upload
3. Page Layer
File: frontend/lib/presentation/pages/settings/settings_page.dart
Complete settings page with sections:
- Profile Section: User info with avatar
- Audio Section: Audio quality selector
- Playback Section:
- Crossfade toggle with duration slider
- Gapless playback toggle
- Normalize volume toggle
- Downloads Section:
- Download on mobile data toggle
- Show explicit content toggle
- Storage Section: Cache management
- About Section:
- App version (with package_info_plus)
- Licenses page
- Logout: Confirmation dialog
Dependencies Added
package_info_plus: ^5.0.1 # For app version info
image_picker: ^1.0.7 # For avatar image selection
Key Features
1. Persistent Storage
All settings are persisted using SharedPreferences:
- Audio quality
- Download on mobile data
- Show explicit content
- Crossfade settings
- Gapless playback
- Normalize volume
2. Cache Management
- Automatic cache size calculation
- Temporary and documents directory scanning
- Human-readable size formatting
- Clear cache functionality
3. Profile Management
- Integration with AuthApiService
- Load profile from
/api/v1/auth/me - Update profile with PUT request
- Display name and avatar URL updates
- Error handling with snackbar notifications
4. Neon Cyberpunk Theme
- Cyan glow effects
- Gradient backgrounds
- Border styling with transparency
- Custom toggle switches
- Elevated and outlined button styles
- Consistent with existing app theme
5. Responsive Design
- CustomScrollView with SliverAppBar
- Card-based layout
- Proper spacing and padding
- Responsive width constraints
- Mobile-optimized
API Integration
GET /api/v1/auth/me
final user = await _authApiService.getCurrentUser();
PUT /api/v1/auth/me
final updatedUser = await _authApiService.updateProfile(
displayName: displayName,
avatarUrl: avatarUrl,
);
Usage Example
Navigate to Settings Page
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SettingsPage(),
),
);
Using Settings Provider
final settingsState = ref.watch(settingsProvider);
// Update audio quality
ref.read(settingsProvider.notifier).setAudioQuality(AudioQuality.high);
// Toggle setting
ref.read(settingsProvider.notifier).toggleCrossfade(true);
// Update profile
await ref.read(settingsProvider.notifier).updateProfile(
displayName: 'New Name',
);
// Clear cache
await ref.read(settingsProvider.notifier).clearCache();
Theme Integration
All widgets follow the neon cyberpunk theme:
- Primary Colors: Cyan (#00F0FF), Violet (#BF00FF), Rose (#FF006E)
- Backgrounds: Dark blue tones (#0A0E27, #1A1F3A)
- Text: OnBackground (#E0E6FF), OnSurface (#B0B8D4)
- Effects: Glow shadows, gradients, borders
Error Handling
- Network errors caught and displayed
- Snackbar notifications for user feedback
- Loading states during async operations
- Validation for profile updates
- Graceful fallbacks for missing data
Future Enhancements
- Avatar Upload: Implement server-side image upload
- Equalizer: Add customizable EQ presets
- Language: Add language selector
- Theme: Add light/dark theme toggle
- Notifications: Add notification settings
- Privacy: Add privacy settings page
- Account: Add account deletion
- Social: Add social links management
Testing Recommendations
- Profile Updates: Test display name changes
- Audio Quality: Test all quality levels
- Cache: Test cache clearing on different devices
- Toggles: Test all toggle switches persist
- Logout: Test logout flow
- Network: Test with poor network conditions
- Validation: Test empty display names
- Image Picker: Test on iOS and Android
File Structure
frontend/lib/
├── presentation/
│ ├── providers/
│ │ └── settings_provider.dart
│ ├── pages/
│ │ └── settings/
│ │ └── settings_page.dart
│ └── widgets/
│ └── settings/
│ ├── settings_tile.dart
│ ├── profile_section.dart
│ ├── audio_quality_selector.dart
│ ├── cache_management_tile.dart
│ ├── edit_profile_dialog.dart
│ └── settings_widgets.dart
Notes
- Avatar upload requires server implementation
- Image picker requires permissions in AndroidManifest.xml and Info.plist
- Cache clearing may take time on large caches
- Premium features should be validated on backend
- Audio quality changes should take effect on next track load