9c504d2c3d
Features: - Frontend Flutter avec thème néon cyberpunk - Backend FastAPI avec streaming YouTube - Base de données PostgreSQL + Redis - Authentification JWT complète - Recherche multi-source (DB + YouTube) - Playlists CRUD avec drag & drop - Queue management - Settings avec audio quality - Interface adaptative (Desktop + Mobile) Tech Stack: - Frontend: Flutter 3.2+, Riverpod - Backend: Python 3.11+, FastAPI - Database: PostgreSQL 15+ - Cache: Redis 7+ - Streaming: yt-dlp + FFmpeg 🚀 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
145 lines
3.4 KiB
Dart
145 lines
3.4 KiB
Dart
/// Example: How to integrate Settings Page into your app
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:spotify_le_2/presentation/pages/settings/settings_page.dart';
|
|
|
|
// Example 1: Navigate from home page
|
|
class HomePage extends StatelessWidget {
|
|
const HomePage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text('Home'),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.settings),
|
|
onPressed: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => const SettingsPage(),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body: const Center(child: Text('Home Page')),
|
|
);
|
|
}
|
|
}
|
|
|
|
// Example 2: Using Go Router
|
|
/*
|
|
In your router configuration:
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
final router = GoRouter(
|
|
routes: [
|
|
GoRoute(
|
|
path: '/',
|
|
builder: (context, state) => const HomePage(),
|
|
),
|
|
GoRoute(
|
|
path: '/settings',
|
|
builder: (context, state) => const SettingsPage(),
|
|
),
|
|
],
|
|
);
|
|
|
|
// Then navigate:
|
|
context.push('/settings');
|
|
*/
|
|
|
|
// Example 3: Bottom navigation bar
|
|
class MainNavigation extends StatefulWidget {
|
|
const MainNavigation({super.key});
|
|
|
|
@override
|
|
State<MainNavigation> createState() => _MainNavigationState();
|
|
}
|
|
|
|
class _MainNavigationState extends State<MainNavigation> {
|
|
int _currentIndex = 0;
|
|
|
|
final List<Widget> _pages = [
|
|
const HomePage(),
|
|
const SearchPage(),
|
|
const LibraryPage(),
|
|
const SettingsPage(), // Settings as a main tab
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: _pages[_currentIndex],
|
|
bottomNavigationBar: NavigationBar(
|
|
currentIndex: _currentIndex,
|
|
onDestinationSelected: (index) {
|
|
setState(() {
|
|
_currentIndex = index;
|
|
});
|
|
},
|
|
destinations: const [
|
|
NavigationDestination(
|
|
icon: Icon(Icons.home),
|
|
label: 'Home',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.search),
|
|
label: 'Search',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.library_music),
|
|
label: 'Library',
|
|
),
|
|
NavigationDestination(
|
|
icon: Icon(Icons.settings),
|
|
label: 'Settings',
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
// Example 4: From a profile button in player widget
|
|
class PlayerWidget extends StatelessWidget {
|
|
const PlayerWidget({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () => _navigateToSettings(context),
|
|
child: const CircleAvatar(
|
|
child: Icon(Icons.person),
|
|
),
|
|
);
|
|
}
|
|
|
|
void _navigateToSettings(BuildContext context) {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => const SettingsPage(),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
// Placeholder classes for example
|
|
class SearchPage extends StatelessWidget {
|
|
const SearchPage({super.key});
|
|
@override
|
|
Widget build(BuildContext context) => const Scaffold(body: Center(child: Text('Search')));
|
|
}
|
|
|
|
class LibraryPage extends StatelessWidget {
|
|
const LibraryPage({super.key});
|
|
@override
|
|
Widget build(BuildContext context) => const Scaffold(body: Center(child: Text('Library')));
|
|
}
|