import 'package:flutter/material.dart'; import 'package:ocarina/api/subsonic/album.dart'; import 'package:ocarina/api/subsonic/artist.dart'; import 'package:ocarina/api/subsonic/subsonic.dart'; import 'package:ocarina/views/album_view.dart'; import 'package:ocarina/widgets/hero_banner.dart'; import 'package:ocarina/widgets/image_cover.dart'; import 'package:responsive_sizer/responsive_sizer.dart'; class ArtistView extends StatefulWidget { const ArtistView({required this.artist, super.key}); final Artist artist; @override State createState() => _ArtistViewState(); } class _ArtistViewState extends State { @override void initState() { super.initState(); loadArtistAlbums(); } final _albums = []; Future loadArtistAlbums() async { _albums ..clear() ..addAll(await SubsonicApiService().getAlbumList(widget.artist.id) ?? []); setState(() {}); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.transparent, ), body: SingleChildScrollView( child: SizedBox( width: 100.w, height: 100.h, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ HeroBanner( imageUrl: widget.artist.coverArt, title: widget.artist.name, description: "This could be a cool description soon", heroTag: widget.artist.name, ), Center( child: SizedBox( height: 70.h, width: 95.w, child: Wrap( alignment: WrapAlignment.spaceBetween, children: List.generate( _albums.length, (n) => InkWell( onTap: () async { await Navigator.of(context).push( MaterialPageRoute( builder: (c) => AlbumView( album: _albums[n], ), ), ); }, child: ImageCover( imageUrl: _albums[n].coverArtUrl, title: _albums[n].name, heroTag: _albums[n].name, ), ), ), ), ), ), ], ), ), ), ); } }