diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 8b73c5d..a9f16ff 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -24,7 +24,8 @@ + android:exported="true" + android:process=':downloads'> ImageDetails( fullUrl: 'https://e-cdns-images.dzcdn.net/images/$type/$art/1400x1400-000000-80-0-0.jpg', - thumbUrl: 'https://e-cdns-images.dzcdn.net/images/$type/$art/180x180-000000-80-0-0.jpg' + thumbUrl: 'https://e-cdns-images.dzcdn.net/images/$type/$art/140x140-000000-80-0-0.jpg' ); factory ImageDetails.fromPrivateJson(Map json) => ImageDetails.fromPrivateString( json['MD5'].split('-').first, diff --git a/lib/ui/home_screen.dart b/lib/ui/home_screen.dart index 507ed22..ed4f15e 100644 --- a/lib/ui/home_screen.dart +++ b/lib/ui/home_screen.dart @@ -148,69 +148,79 @@ class _HomePageScreenState extends State { physics: NeverScrollableScrollPhysics(), itemCount: _homePage.sections.length, itemBuilder: (context, i) { - HomePageSection section = _homePage.sections[i]; - return Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - child: Text( - section.title, - textAlign: TextAlign.left, - maxLines: 2, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.w900 - ), - ), - padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0) - ), - - SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: Row( - children: List.generate(section.items.length + 1, (i) { - //Has more items - if (i == section.items.length) { - if (section.hasMore??false) { - return FlatButton( - child: Text( - 'Show more'.i18n, - textAlign: TextAlign.center, - style: TextStyle( - fontSize: 20.0 - ), - ), - onPressed: () => Navigator.of(context).push(MaterialPageRoute( - builder: (context) => Scaffold( - appBar: FreezerAppBar(section.title), - body: SingleChildScrollView( - child: HomePageScreen( - channel: DeezerChannel(target: section.pagePath) - ) - ), - ), - )), - ); - } - return Container(height: 0, width: 0); - } - - //Show item - HomePageItem item = section.items[i]; - return HomePageItemWidget(item); - }), - ), - ), - Container(height: 8.0), - ], - ); + return HomepageSectionWidget(_homePage.sections[i]); }, ); } } +class HomepageSectionWidget extends StatelessWidget { + + final HomePageSection section; + HomepageSectionWidget(this.section); + + @override + Widget build(BuildContext context) { + return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + child: Text( + section.title, + textAlign: TextAlign.left, + maxLines: 2, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.w900 + ), + ), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 8.0) + ), + + SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: List.generate(section.items.length + 1, (i) { + //Has more items + if (i == section.items.length) { + if (section.hasMore??false) { + return FlatButton( + child: Text( + 'Show more'.i18n, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20.0 + ), + ), + onPressed: () => Navigator.of(context).push(MaterialPageRoute( + builder: (context) => Scaffold( + appBar: FreezerAppBar(section.title), + body: SingleChildScrollView( + child: HomePageScreen( + channel: DeezerChannel(target: section.pagePath) + ) + ), + ), + )), + ); + } + return Container(height: 0, width: 0); + } + //Show item + HomePageItem item = section.items[i]; + return HomePageItemWidget(item); + }), + ), + ), + Container(height: 8.0), + ], + ); + } +} + + class HomePageItemWidget extends StatelessWidget { diff --git a/lib/ui/player_screen.dart b/lib/ui/player_screen.dart index 4ccc3ee..8c82792 100644 --- a/lib/ui/player_screen.dart +++ b/lib/ui/player_screen.dart @@ -182,16 +182,18 @@ class _PlayerScreenHorizontalState extends State { setState(() => _lyrics = !_lyrics); }, ), - FlatButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute(builder: (context) => QualitySettings()) + if (AudioService.currentMediaItem.extras['qualityString'] != null) + FlatButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => QualitySettings()) + ), + child: Text( + AudioService.currentMediaItem.extras['qualityString'] ?? '', + style: TextStyle(fontSize: ScreenUtil().setSp(24)), + ), ), - child: Text( - AudioService.currentMediaItem.extras['qualityString'] ?? '', - style: TextStyle(fontSize: ScreenUtil().setSp(24)), - ), - ), + RepeatButton(ScreenUtil().setWidth(32)), IconButton( icon: Icon(Icons.more_vert, size: ScreenUtil().setWidth(32)), onPressed: () { @@ -305,27 +307,20 @@ class _PlayerScreenVerticalState extends State { setState(() => _lyrics = !_lyrics); }, ), - FlatButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute(builder: (context) => QualitySettings()) - ), - child: Text( - AudioService.currentMediaItem.extras['qualityString'] ?? '', - style: TextStyle( - fontSize: ScreenUtil().setSp(32), + if (AudioService.currentMediaItem.extras['qualityString'] != null) + FlatButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute(builder: (context) => QualitySettings()) + ), + child: Text( + AudioService.currentMediaItem.extras['qualityString'] ?? '', + style: TextStyle( + fontSize: ScreenUtil().setSp(32), + ), ), ), - ), - IconButton( - icon: Icon(Icons.sentiment_very_dissatisfied, size: ScreenUtil().setWidth(46)), - onPressed: () async { - await deezerAPI.dislikeTrack(AudioService.currentMediaItem.id); - if (playerHelper.queueIndex < (AudioService.queue??[]).length - 1) { - AudioService.skipToNext(); - } - } - ), + RepeatButton(ScreenUtil().setWidth(46)), IconButton( icon: Icon(Icons.more_vert, size: ScreenUtil().setWidth(46)), onPressed: () { @@ -342,6 +337,54 @@ class _PlayerScreenVerticalState extends State { } } + +class RepeatButton extends StatefulWidget { + + final double iconSize; + RepeatButton(this.iconSize, {Key key}): super(key: key); + + @override + _RepeatButtonState createState() => _RepeatButtonState(); +} + +class _RepeatButtonState extends State { + + Icon get repeatIcon { + switch (playerHelper.repeatType) { + case LoopMode.off: + return Icon( + Icons.repeat, + size: widget.iconSize + ); + case LoopMode.all: + return Icon( + Icons.repeat, + color: Theme.of(context).primaryColor, + size: widget.iconSize + ); + case LoopMode.one: + return Icon( + Icons.repeat_one, + color: Theme.of(context).primaryColor, + size: widget.iconSize + ); + } + } + + + @override + Widget build(BuildContext context) { + return IconButton( + icon: repeatIcon, + onPressed: () async { + await playerHelper.changeRepeat(); + setState(() {}); + }, + ); + } +} + + class PlaybackControls extends StatefulWidget { final double iconSize; @@ -353,28 +396,6 @@ class PlaybackControls extends StatefulWidget { class _PlaybackControlsState extends State { - Icon get repeatIcon { - switch (playerHelper.repeatType) { - case LoopMode.off: - return Icon( - Icons.repeat, - size: widget.iconSize * 0.64 - ); - case LoopMode.all: - return Icon( - Icons.repeat, - color: Theme.of(context).primaryColor, - size: widget.iconSize * 0.64 - ); - case LoopMode.one: - return Icon( - Icons.repeat_one, - color: Theme.of(context).primaryColor, - size: widget.iconSize * 0.64, - ); - } - } - Icon get libraryIcon { if (cache.checkTrackFavorite(Track.fromMediaItem(AudioService.currentMediaItem))) { return Icon(Icons.favorite, size: widget.iconSize * 0.64); @@ -391,11 +412,13 @@ class _PlaybackControlsState extends State { mainAxisSize: MainAxisSize.max, children: [ IconButton( - icon: repeatIcon, - onPressed: () async { - await playerHelper.changeRepeat(); - setState(() {}); - }, + icon: Icon(Icons.sentiment_very_dissatisfied, size: ScreenUtil().setWidth(46)), + onPressed: () async { + await deezerAPI.dislikeTrack(AudioService.currentMediaItem.id); + if (playerHelper.queueIndex < (AudioService.queue??[]).length - 1) { + AudioService.skipToNext(); + } + } ), PrevNextButton(widget.iconSize, prev: true), PlayPauseButton(widget.iconSize * 1.25), diff --git a/lib/ui/tiles.dart b/lib/ui/tiles.dart index 3939c7b..eb32ca9 100644 --- a/lib/ui/tiles.dart +++ b/lib/ui/tiles.dart @@ -134,9 +134,8 @@ class ArtistTile extends StatelessWidget { Widget build(BuildContext context) { return SizedBox( width: 150, - child: Card( + child: Container( color: Theme.of(context).scaffoldBackgroundColor, - elevation: 0.0, child: InkWell( onTap: onTap, onLongPress: onHold, @@ -245,9 +244,8 @@ class PlaylistCardTile extends StatelessWidget { @override Widget build(BuildContext context) { - return Card( + return Container( color: Theme.of(context).scaffoldBackgroundColor, - elevation: 0.0, child: InkWell( onTap: onTap, onLongPress: onHold, @@ -291,8 +289,7 @@ class SmartTrackListTile extends StatelessWidget { @override Widget build(BuildContext context) { - return Card( - elevation: 0, + return Container( color: Theme.of(context).scaffoldBackgroundColor, child: InkWell( onTap: onTap, @@ -338,9 +335,8 @@ class AlbumCard extends StatelessWidget { @override Widget build(BuildContext context) { - return Card( + return Container( color: Theme.of(context).scaffoldBackgroundColor, - elevation: 0.0, child: InkWell( onTap: onTap, onLongPress: onHold, diff --git a/pubspec.yaml b/pubspec.yaml index e6a6ad5..062475f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.6.1+1 +version: 0.6.2+1 environment: sdk: ">=2.8.0 <3.0.0" @@ -69,7 +69,7 @@ dependencies: share: ^0.6.5+2 numberpicker: ^1.2.1 quick_actions: ^0.4.0+10 - photo_view: + photo_view: ^0.10.2 audio_session: ^0.0.9 audio_service: