mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-23 23:18:06 +02:00
feat: Implement playlist selection screen with dynamic loading, error handling, and interactive playlist cards.
This commit is contained in:
1 parent
887b44b29d
commit
d3f6d3a65e
1 file changed
+12
-8
@@ -21,6 +21,7 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
|||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final currentUser = ref.watch(authProvider).currentUser;
|
final currentUser = ref.watch(authProvider).currentUser;
|
||||||
final playlistsAsync = ref.watch(playlistsProvider);
|
final playlistsAsync = ref.watch(playlistsProvider);
|
||||||
|
final scrollController = ScrollController();
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
@@ -37,8 +38,8 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
|||||||
actions: [
|
actions: [
|
||||||
if (currentUser?.isAdmin ?? false)
|
if (currentUser?.isAdmin ?? false)
|
||||||
IconButton(
|
IconButton(
|
||||||
icon:
|
icon: const Icon(Icons.admin_panel_settings,
|
||||||
const Icon(Icons.admin_panel_settings, color: AppColors.textSecondary),
|
color: AppColors.textSecondary),
|
||||||
onPressed: () => context.go('/admin'),
|
onPressed: () => context.go('/admin'),
|
||||||
tooltip: 'Admin Panel',
|
tooltip: 'Admin Panel',
|
||||||
),
|
),
|
||||||
@@ -109,8 +110,9 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Content
|
// Content - Explicitly filled to provide bounded constraints
|
||||||
playlistsAsync.when(
|
Positioned.fill(
|
||||||
|
child: playlistsAsync.when(
|
||||||
loading: () => const Center(
|
loading: () => const Center(
|
||||||
child: CircularProgressIndicator(color: AppColors.primary),
|
child: CircularProgressIndicator(color: AppColors.primary),
|
||||||
),
|
),
|
||||||
@@ -174,13 +176,16 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GridView needs a controller in some Flutter Web environments
|
||||||
|
// to avoid NaN scroll offset issues during initial layout
|
||||||
return GridView.builder(
|
return GridView.builder(
|
||||||
|
controller: scrollController,
|
||||||
padding: const EdgeInsets.fromLTRB(
|
padding: const EdgeInsets.fromLTRB(
|
||||||
48,
|
48,
|
||||||
100,
|
120, // Increased top padding for AppBar
|
||||||
48,
|
48,
|
||||||
48,
|
48,
|
||||||
), // More padding for cinematic feel
|
),
|
||||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount:
|
crossAxisCount:
|
||||||
MediaQuery.of(context).size.width > 1200 ? 4 : 3,
|
MediaQuery.of(context).size.width > 1200 ? 4 : 3,
|
||||||
@@ -194,10 +199,8 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
|||||||
return _PlaylistCard(
|
return _PlaylistCard(
|
||||||
playlist: playlist,
|
playlist: playlist,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Update current selected playlist provider first
|
|
||||||
ref.read(selectedPlaylistProvider.notifier).state =
|
ref.read(selectedPlaylistProvider.notifier).state =
|
||||||
playlist;
|
playlist;
|
||||||
// Then navigate to dashboard
|
|
||||||
context.go('/dashboard');
|
context.go('/dashboard');
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -205,6 +208,7 @@ class PlaylistSelectionScreen extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user