-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a750a52
commit cb2aadc
Showing
5 changed files
with
261 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:mucke/presentation/pages/album_details_page.dart'; | ||
import 'package:mucke/presentation/state/navigation_store.dart'; | ||
import 'package:mucke/presentation/widgets/album_art_grid_tile.dart'; | ||
|
||
import '../../domain/entities/album.dart'; | ||
|
||
class AlbumArtGrid extends StatelessWidget { | ||
const AlbumArtGrid({ | ||
Key? key, | ||
required this.albums, | ||
required this.scrollController, | ||
required this.navStore, | ||
}) : super(key: key); | ||
|
||
final List<Album> albums; | ||
final ScrollController scrollController; | ||
final NavigationStore navStore; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SliverGrid.builder( | ||
itemCount: albums.length, | ||
gridDelegate: | ||
const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2), | ||
itemBuilder: (_, int index) { | ||
final Album album = albums[index]; | ||
return AlbumArtGridTile( | ||
title: album.title, | ||
subtitle: album.artist, | ||
albumArtPath: album.albumArtPath, | ||
onTap: () { | ||
navStore.push( | ||
context, | ||
MaterialPageRoute<Widget>( | ||
builder: (BuildContext context) => AlbumDetailsPage( | ||
album: album, | ||
), | ||
), | ||
); | ||
}); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import '../theming.dart'; | ||
import '../utils.dart' as utils; | ||
|
||
class AlbumArtGridTile extends StatelessWidget { | ||
const AlbumArtGridTile({ | ||
Key? key, | ||
required this.title, | ||
required this.subtitle, | ||
required this.onTap, | ||
this.albumArtPath, | ||
this.highlight = false, | ||
}) : super(key: key); | ||
|
||
final String title; | ||
final String subtitle; | ||
final String? albumArtPath; | ||
final Function onTap; | ||
final bool highlight; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: () => onTap(), | ||
child: Padding( | ||
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 20), | ||
child: Column( | ||
children: [ | ||
SizedBox( | ||
width: 128, | ||
height: 128, | ||
child: Container( | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(4.0), | ||
boxShadow: const [ | ||
BoxShadow( | ||
color: Colors.black54, | ||
blurRadius: 8, | ||
offset: Offset(0, 2), | ||
), | ||
], | ||
), | ||
clipBehavior: Clip.antiAlias, | ||
child: Image( | ||
image: utils.getAlbumImage(albumArtPath), | ||
fit: BoxFit.cover, | ||
), | ||
), | ||
), | ||
const Padding(padding: EdgeInsets.symmetric(vertical: 3, horizontal: 0)), | ||
Text( | ||
title, | ||
style: const TextStyle(fontWeight: FontWeight.bold), | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
), | ||
Text( | ||
subtitle, | ||
style: TEXT_SMALL_SUBTITLE.copyWith(color: Colors.white), | ||
maxLines: 1, | ||
overflow: TextOverflow.ellipsis, | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:mucke/presentation/state/navigation_store.dart'; | ||
|
||
import '../../domain/entities/album.dart'; | ||
import 'album_art_list_tile.dart'; | ||
|
||
class AlbumArtList extends StatelessWidget { | ||
const AlbumArtList({ | ||
Key? key, | ||
required this.albums, | ||
required this.scrollController, | ||
required this.navStore, | ||
}) : super(key: key); | ||
|
||
final List<Album> albums; | ||
final ScrollController scrollController; | ||
final NavigationStore navStore; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return SliverList.separated( | ||
itemCount: albums.length, | ||
itemBuilder: (_, int index) { | ||
final Album album = albums[index]; | ||
return AlbumArtListTile( | ||
title: album.title, | ||
subtitle: album.artist, | ||
albumArtPath: album.albumArtPath, | ||
onTap: () {}, | ||
); | ||
}, | ||
separatorBuilder: (BuildContext context, int index) => const SizedBox( | ||
height: 4.0, | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.