Text styling, download fix, small bugs

This commit is contained in:
exttex 2020-07-19 14:41:05 +02:00
parent 109fc6f54b
commit 6f250df004
8 changed files with 110 additions and 48 deletions

View File

@ -1,5 +1,7 @@
package f.f.freezer;
import android.content.Intent;
import android.net.Uri;
import android.util.Log;
import androidx.annotation.NonNull;
@ -47,6 +49,13 @@ public class MainActivity extends FlutterActivity {
decryptTrack(path, tid);
result.success(0);
}
//Android media scanner
if (call.method.equals("rescanLibrary")) {
String path = call.argument("path");
Uri uri = Uri.fromFile(new File(path));
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
result.success(0);
}
//Add tags to track
if (call.method.equals("tagTrack")) {
try {

View File

@ -543,6 +543,10 @@ class Download {
'cover': _cover,
'trackNumber': track.trackNumber
});
//Rescan android library
await platformChannel.invokeMethod('rescanLibrary', {
'path': path
});
}
//Remove encrypted
await File(path + '.ENC').delete();

View File

@ -78,6 +78,7 @@ class Settings {
accentColor: primaryColor,
sliderTheme: _sliderTheme,
toggleableActiveColor: primaryColor,
bottomAppBarColor: Color(0xfff7f7f7)
);
case Themes.Dark:
return ThemeData(

View File

@ -129,7 +129,7 @@ class _LoginWidgetState extends State<LoginWidget> {
"Please login using your Deezer account.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0
fontSize: 16.0
),
),
Container(height: 16.0,),
@ -183,7 +183,7 @@ class _LoginWidgetState extends State<LoginWidget> {
"If you don't have account, you can register on deezer.com for free.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0
fontSize: 16.0
),
),
Padding(
@ -202,7 +202,7 @@ class _LoginWidgetState extends State<LoginWidget> {
"By using this app, you don't agree with the Deezer ToS",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18.0
fontSize: 16.0
),
)
],

View File

@ -25,31 +25,34 @@ class PlayerBar extends StatelessWidget {
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => PlayerScreen())),
leading: CachedImage(
width: 50,
height: 50,
url: AudioService.currentMediaItem.artUri,
),
title: Text(
AudioService.currentMediaItem.displayTitle,
overflow: TextOverflow.clip,
maxLines: 1,
),
subtitle: Text(
AudioService.currentMediaItem.displaySubtitle,
overflow: TextOverflow.clip,
maxLines: 1,
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
PrevNextButton(iconSize, prev: true, hidePrev: true,),
PlayPauseButton(iconSize),
PrevNextButton(iconSize)
],
)
Container(
color: Theme.of(context).bottomAppBarColor,
child: ListTile(
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => PlayerScreen())),
leading: CachedImage(
width: 50,
height: 50,
url: AudioService.currentMediaItem.artUri,
),
title: Text(
AudioService.currentMediaItem.displayTitle,
overflow: TextOverflow.clip,
maxLines: 1,
),
subtitle: Text(
AudioService.currentMediaItem.displaySubtitle,
overflow: TextOverflow.clip,
maxLines: 1,
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
PrevNextButton(iconSize, prev: true, hidePrev: true,),
PlayPauseButton(iconSize),
PrevNextButton(iconSize)
],
)
),
),
Container(
height: 3.0,

View File

@ -10,6 +10,7 @@ import 'package:freezer/ui/menu.dart';
import 'package:freezer/ui/settings_screen.dart';
import 'package:freezer/ui/tiles.dart';
import 'package:async/async.dart';
import 'package:marquee/marquee.dart';
import 'cached_image.dart';
import '../api/definitions.dart';
@ -115,15 +116,29 @@ class _PlayerScreenHorizontalState extends State<PlayerScreenHorizontal> {
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
AudioService.currentMediaItem.displayTitle,
maxLines: 1,
textAlign: TextAlign.center,
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: ScreenUtil().setSp(40),
fontWeight: FontWeight.bold
),
Container(
height: ScreenUtil().setSp(40),
child: AudioService.currentMediaItem.displayTitle.length >= 22 ?
Marquee(
text: AudioService.currentMediaItem.displayTitle,
style: TextStyle(
fontSize: ScreenUtil().setSp(40),
fontWeight: FontWeight.bold
),
blankSpace: 32.0,
startPadding: 10.0,
accelerationDuration: Duration(seconds: 1),
pauseAfterRound: Duration(seconds: 2),
):
Text(
AudioService.currentMediaItem.displayTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: ScreenUtil().setSp(40),
fontWeight: FontWeight.bold
),
)
),
Container(height: 4,),
Text(
@ -241,15 +256,29 @@ class _PlayerScreenVerticalState extends State<PlayerScreenVertical> {
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
AudioService.currentMediaItem.displayTitle,
maxLines: 1,
textAlign: TextAlign.center,
overflow: TextOverflow.clip,
style: TextStyle(
Container(
height: ScreenUtil().setSp(64),
child: AudioService.currentMediaItem.displayTitle.length >= 24 ?
Marquee(
text: AudioService.currentMediaItem.displayTitle,
style: TextStyle(
fontSize: ScreenUtil().setSp(64),
fontWeight: FontWeight.bold
),
),
blankSpace: 32.0,
startPadding: 10.0,
accelerationDuration: Duration(seconds: 1),
pauseAfterRound: Duration(seconds: 2),
):
Text(
AudioService.currentMediaItem.displayTitle,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: ScreenUtil().setSp(64),
fontWeight: FontWeight.bold
),
)
),
Container(height: 4,),
Text(
@ -338,6 +367,7 @@ class _LyricsWidgetState extends State<LyricsWidget> {
Timer _timer;
int _currentIndex;
double _boxHeight;
double _lyricHeight = 128;
String _trackId;
Future _load() async {
@ -380,7 +410,7 @@ class _LyricsWidgetState extends State<LyricsWidget> {
//Scroll to current lyric
if (_currentIndex <= 0) return;
_scrollController.animateTo(
(_boxHeight * _currentIndex),
(_lyricHeight * _currentIndex) + (_lyricHeight / 2) - (_boxHeight / 2),
duration: Duration(milliseconds: 250),
curve: Curves.ease
);
@ -425,7 +455,7 @@ class _LyricsWidgetState extends State<LyricsWidget> {
child: Column(
children: List.generate(_l.lyrics.length, (i) {
return Container(
height: _boxHeight,
height: _lyricHeight,
child: Center(
child: Stack(
children: <Widget>[
@ -433,7 +463,7 @@ class _LyricsWidgetState extends State<LyricsWidget> {
_l.lyrics[i].text,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 36.0,
fontSize: 28.0,
fontWeight: (_currentIndex == i)?FontWeight.bold:FontWeight.normal,
foreground: Paint()
..strokeWidth = 6
@ -446,7 +476,7 @@ class _LyricsWidgetState extends State<LyricsWidget> {
textAlign: TextAlign.center,
style: TextStyle(
color: _textColor,
fontSize: 36.0,
fontSize: 28.0,
fontWeight: (_currentIndex == i)?FontWeight.bold:FontWeight.normal
),
),

View File

@ -239,6 +239,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
fading_edge_scrollview:
dependency: transitive
description:
name: fading_edge_scrollview
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.4"
file:
dependency: transitive
description:
@ -445,6 +452,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.11.4"
marquee:
dependency: "direct main"
description:
name: marquee
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
matcher:
dependency: transitive
description:

View File

@ -57,6 +57,7 @@ dependencies:
async: ^2.4.1
html: ^0.14.0+3
flutter_screenutil: ^2.3.0
marquee: ^1.5.2
just_audio:
git: https://notabug.org/exttex/just_audio.git