Minor improvements

This commit is contained in:
exttex 2020-11-01 20:23:24 +01:00
parent 563a460e48
commit 5725737385
6 changed files with 155 additions and 125 deletions

View File

@ -24,7 +24,8 @@
<service
android:name=".DownloadService"
android:enabled="true"
android:exported="true"></service>
android:exported="true"
android:process=':downloads'></service>
<activity
android:name=".MainActivity"

View File

@ -430,7 +430,7 @@ class ImageDetails {
//JSON
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',
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(
json['MD5'].split('-').first,

View File

@ -148,69 +148,79 @@ class _HomePageScreenState extends State<HomePageScreen> {
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 {

View File

@ -182,16 +182,18 @@ class _PlayerScreenHorizontalState extends State<PlayerScreenHorizontal> {
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<PlayerScreenVertical> {
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<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 {
final double iconSize;
@ -353,28 +396,6 @@ class PlaybackControls extends StatefulWidget {
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 {
if (cache.checkTrackFavorite(Track.fromMediaItem(AudioService.currentMediaItem))) {
return Icon(Icons.favorite, size: widget.iconSize * 0.64);
@ -391,11 +412,13 @@ class _PlaybackControlsState extends State<PlaybackControls> {
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),

View File

@ -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,

View File

@ -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: