Skip to content

feat: songs ui #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
with:
flutter_channel: stable
coverage_excludes: "**/*.g.dart"

spell-check:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/spell_check.yml@v1
Expand Down
2 changes: 0 additions & 2 deletions lib/album/view/album_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import 'package:swiftify_repository/swiftify_repository.dart';
class AlbumPage extends StatelessWidget {
const AlbumPage({super.key});

static const routeName = '/album';

@override
Widget build(BuildContext context) {
return BlocProvider(
Expand Down
55 changes: 34 additions & 21 deletions lib/album/view/album_view.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:swiftify/album/bloc/album_bloc.dart';
import 'package:swiftify/album/album.dart';
import 'package:swiftify/app/app_router/router.dart';

class AlbumView extends StatelessWidget {
const AlbumView({super.key});
Expand All @@ -10,22 +11,26 @@ class AlbumView extends StatelessWidget {
final isLoading = context.select((AlbumBloc bloc) => bloc.state.isLoading);
final isSuccess = context.select((AlbumBloc bloc) => bloc.state.isSuccess);

return isLoading
? const Center(
child: CircularProgressIndicator(),
)
: isSuccess
? const Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
AlbumsHeader(),
Expanded(
child: AlbumsContent(),
),
],
)
: const Text('Failed to fetch albums');
if (isLoading) {
return const Center(
child: CircularProgressIndicator(),
);
} else {
if (isSuccess) {
return const Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
AlbumsHeader(),
Expanded(
child: AlbumsContent(),
),
],
);
} else {
return const Text('Failed to fetch albums');
}
}
}
}

Expand Down Expand Up @@ -79,10 +84,18 @@ class AlbumsContent extends StatelessWidget {
itemCount: albums.length,
itemBuilder: (context, index) {
final album = albums[index];
return AlbumItem(
title: album.title,
releaseDate: album.releaseDate,
coverAlbum: album.coverAlbum,
return GestureDetector(
onTap: () => SongsPageRoute(
albumId: album.albumId,
albumTitle: album.title,
coverAlbum: album.coverAlbum,
albumReleaseDate: album.releaseDate,
).push<void>(context),
child: AlbumItem(
title: album.title,
releaseDate: album.releaseDate,
coverAlbum: album.coverAlbum,
),
);
},
);
Expand Down
32 changes: 3 additions & 29 deletions lib/app/app_router/app_router.dart
Original file line number Diff line number Diff line change
@@ -1,39 +1,17 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:swiftify/album/album.dart';
import 'package:swiftify/app/app_router/routes/dashboard_routes.dart';
import 'package:swiftify/app/app_router/routes/theme_route.dart';
import 'package:swiftify/app/app_router/routes/routes.dart';

export 'go_router_observer.dart';

final rootNavigatorKey = GlobalKey<NavigatorState>();

class AppRoute extends GoRoute {
AppRoute({
required super.path,
super.name,
super.builder,
super.pageBuilder,
super.parentNavigatorKey,
super.routes = const <RouteBase>[],
});

@override
GoRouterRedirect get redirect => (context, state) {
return null;
};
}

class AppRouter {
AppRouter({
String? initialLocation = AlbumPage.routeName,
List<NavigatorObserver> navigatorObservers = const [],
GoRouter? goRouter,
}) {
_goRouter = goRouter ??
_routes(
initialLocation,
navigatorObservers,
);
}
Expand All @@ -42,18 +20,14 @@ class AppRouter {
GoRouter get routes => _goRouter;

GoRouter _routes(
String? initialLocation,
List<NavigatorObserver> navigatorObservers,
) {
return GoRouter(
initialLocation: initialLocation,
initialLocation: const AlbumPageRoute().location,
observers: navigatorObservers,
debugLogDiagnostics: kDebugMode,
navigatorKey: rootNavigatorKey,
routes: [
dashBoardRoutes,
themeRoute,
],
routes: $appRoutes,
);
}
}
35 changes: 0 additions & 35 deletions lib/app/app_router/modal_pop_up_page.dart

This file was deleted.

4 changes: 4 additions & 0 deletions lib/app/app_router/router.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export 'app_router.dart';
export 'go_router_observer.dart';
export 'routes/routes.dart';
export 'widgets/widgets.dart';
38 changes: 0 additions & 38 deletions lib/app/app_router/routes/dashboard_routes.dart

This file was deleted.

Loading
Loading