Minor improvements
This commit is contained in:
parent
563a460e48
commit
5725737385
|
@ -24,7 +24,8 @@
|
||||||
<service
|
<service
|
||||||
android:name=".DownloadService"
|
android:name=".DownloadService"
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true"></service>
|
android:exported="true"
|
||||||
|
android:process=':downloads'></service>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
|
|
|
@ -430,7 +430,7 @@ class ImageDetails {
|
||||||
//JSON
|
//JSON
|
||||||
factory ImageDetails.fromPrivateString(String art, {String type='cover'}) => ImageDetails(
|
factory ImageDetails.fromPrivateString(String art, {String type='cover'}) => ImageDetails(
|
||||||
fullUrl: 'https://e-cdns-images.dzcdn.net/images/$type/$art/1400x1400-000000-80-0-0.jpg',
|
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<dynamic, dynamic> json) => ImageDetails.fromPrivateString(
|
factory ImageDetails.fromPrivateJson(Map<dynamic, dynamic> json) => ImageDetails.fromPrivateString(
|
||||||
json['MD5'].split('-').first,
|
json['MD5'].split('-').first,
|
||||||
|
|
|
@ -148,69 +148,79 @@ class _HomePageScreenState extends State<HomePageScreen> {
|
||||||
physics: NeverScrollableScrollPhysics(),
|
physics: NeverScrollableScrollPhysics(),
|
||||||
itemCount: _homePage.sections.length,
|
itemCount: _homePage.sections.length,
|
||||||
itemBuilder: (context, i) {
|
itemBuilder: (context, i) {
|
||||||
HomePageSection section = _homePage.sections[i];
|
return HomepageSectionWidget(_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),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
class HomePageItemWidget extends StatelessWidget {
|
||||||
|
|
||||||
|
|
|
@ -182,16 +182,18 @@ class _PlayerScreenHorizontalState extends State<PlayerScreenHorizontal> {
|
||||||
setState(() => _lyrics = !_lyrics);
|
setState(() => _lyrics = !_lyrics);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FlatButton(
|
if (AudioService.currentMediaItem.extras['qualityString'] != null)
|
||||||
onPressed: () => Navigator.push(
|
FlatButton(
|
||||||
context,
|
onPressed: () => Navigator.push(
|
||||||
MaterialPageRoute(builder: (context) => QualitySettings())
|
context,
|
||||||
|
MaterialPageRoute(builder: (context) => QualitySettings())
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
AudioService.currentMediaItem.extras['qualityString'] ?? '',
|
||||||
|
style: TextStyle(fontSize: ScreenUtil().setSp(24)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Text(
|
RepeatButton(ScreenUtil().setWidth(32)),
|
||||||
AudioService.currentMediaItem.extras['qualityString'] ?? '',
|
|
||||||
style: TextStyle(fontSize: ScreenUtil().setSp(24)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.more_vert, size: ScreenUtil().setWidth(32)),
|
icon: Icon(Icons.more_vert, size: ScreenUtil().setWidth(32)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
@ -305,27 +307,20 @@ class _PlayerScreenVerticalState extends State<PlayerScreenVertical> {
|
||||||
setState(() => _lyrics = !_lyrics);
|
setState(() => _lyrics = !_lyrics);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FlatButton(
|
if (AudioService.currentMediaItem.extras['qualityString'] != null)
|
||||||
onPressed: () => Navigator.push(
|
FlatButton(
|
||||||
context,
|
onPressed: () => Navigator.push(
|
||||||
MaterialPageRoute(builder: (context) => QualitySettings())
|
context,
|
||||||
),
|
MaterialPageRoute(builder: (context) => QualitySettings())
|
||||||
child: Text(
|
),
|
||||||
AudioService.currentMediaItem.extras['qualityString'] ?? '',
|
child: Text(
|
||||||
style: TextStyle(
|
AudioService.currentMediaItem.extras['qualityString'] ?? '',
|
||||||
fontSize: ScreenUtil().setSp(32),
|
style: TextStyle(
|
||||||
|
fontSize: ScreenUtil().setSp(32),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
RepeatButton(ScreenUtil().setWidth(46)),
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
),
|
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(Icons.more_vert, size: ScreenUtil().setWidth(46)),
|
icon: Icon(Icons.more_vert, size: ScreenUtil().setWidth(46)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
@ -342,6 +337,54 @@ class _PlayerScreenVerticalState extends State<PlayerScreenVertical> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class RepeatButton extends StatefulWidget {
|
||||||
|
|
||||||
|
final double iconSize;
|
||||||
|
RepeatButton(this.iconSize, {Key key}): super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_RepeatButtonState createState() => _RepeatButtonState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _RepeatButtonState extends State<RepeatButton> {
|
||||||
|
|
||||||
|
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 {
|
class PlaybackControls extends StatefulWidget {
|
||||||
|
|
||||||
final double iconSize;
|
final double iconSize;
|
||||||
|
@ -353,28 +396,6 @@ class PlaybackControls extends StatefulWidget {
|
||||||
|
|
||||||
class _PlaybackControlsState extends State<PlaybackControls> {
|
class _PlaybackControlsState extends State<PlaybackControls> {
|
||||||
|
|
||||||
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 {
|
Icon get libraryIcon {
|
||||||
if (cache.checkTrackFavorite(Track.fromMediaItem(AudioService.currentMediaItem))) {
|
if (cache.checkTrackFavorite(Track.fromMediaItem(AudioService.currentMediaItem))) {
|
||||||
return Icon(Icons.favorite, size: widget.iconSize * 0.64);
|
return Icon(Icons.favorite, size: widget.iconSize * 0.64);
|
||||||
|
@ -391,11 +412,13 @@ class _PlaybackControlsState extends State<PlaybackControls> {
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: repeatIcon,
|
icon: Icon(Icons.sentiment_very_dissatisfied, size: ScreenUtil().setWidth(46)),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await playerHelper.changeRepeat();
|
await deezerAPI.dislikeTrack(AudioService.currentMediaItem.id);
|
||||||
setState(() {});
|
if (playerHelper.queueIndex < (AudioService.queue??[]).length - 1) {
|
||||||
},
|
AudioService.skipToNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
),
|
),
|
||||||
PrevNextButton(widget.iconSize, prev: true),
|
PrevNextButton(widget.iconSize, prev: true),
|
||||||
PlayPauseButton(widget.iconSize * 1.25),
|
PlayPauseButton(widget.iconSize * 1.25),
|
||||||
|
|
|
@ -134,9 +134,8 @@ class ArtistTile extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 150,
|
width: 150,
|
||||||
child: Card(
|
child: Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
elevation: 0.0,
|
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
onLongPress: onHold,
|
onLongPress: onHold,
|
||||||
|
@ -245,9 +244,8 @@ class PlaylistCardTile extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
elevation: 0.0,
|
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
onLongPress: onHold,
|
onLongPress: onHold,
|
||||||
|
@ -291,8 +289,7 @@ class SmartTrackListTile extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
elevation: 0,
|
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
|
@ -338,9 +335,8 @@ class AlbumCard extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return Container(
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
color: Theme.of(context).scaffoldBackgroundColor,
|
||||||
elevation: 0.0,
|
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
onLongPress: onHold,
|
onLongPress: onHold,
|
||||||
|
|
|
@ -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.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 0.6.1+1
|
version: 0.6.2+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.8.0 <3.0.0"
|
sdk: ">=2.8.0 <3.0.0"
|
||||||
|
@ -69,7 +69,7 @@ dependencies:
|
||||||
share: ^0.6.5+2
|
share: ^0.6.5+2
|
||||||
numberpicker: ^1.2.1
|
numberpicker: ^1.2.1
|
||||||
quick_actions: ^0.4.0+10
|
quick_actions: ^0.4.0+10
|
||||||
photo_view:
|
photo_view: ^0.10.2
|
||||||
|
|
||||||
audio_session: ^0.0.9
|
audio_session: ^0.0.9
|
||||||
audio_service:
|
audio_service:
|
||||||
|
|
Loading…
Reference in New Issue