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; package f.f.freezer;
import android.content.Intent;
import android.net.Uri;
import android.util.Log; import android.util.Log;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -47,6 +49,13 @@ public class MainActivity extends FlutterActivity {
decryptTrack(path, tid); decryptTrack(path, tid);
result.success(0); 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 //Add tags to track
if (call.method.equals("tagTrack")) { if (call.method.equals("tagTrack")) {
try { try {

View File

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

View File

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

View File

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

View File

@ -25,7 +25,9 @@ class PlayerBar extends StatelessWidget {
return Column( return Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
ListTile( Container(
color: Theme.of(context).bottomAppBarColor,
child: ListTile(
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => PlayerScreen())), onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (BuildContext context) => PlayerScreen())),
leading: CachedImage( leading: CachedImage(
width: 50, width: 50,
@ -51,6 +53,7 @@ class PlayerBar extends StatelessWidget {
], ],
) )
), ),
),
Container( Container(
height: 3.0, height: 3.0,
child: LinearProgressIndicator( child: LinearProgressIndicator(

View File

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

View File

@ -239,6 +239,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.3" 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: file:
dependency: transitive dependency: transitive
description: description:
@ -445,6 +452,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.11.4" version: "0.11.4"
marquee:
dependency: "direct main"
description:
name: marquee
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.2"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:

View File

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