fix lyrics off-centered

fix fonts
This commit is contained in:
Pato05 2024-04-29 21:21:19 +02:00
parent 50717ebbd3
commit 7110533af3
No known key found for this signature in database
GPG Key ID: F53CA394104BA0CB
6 changed files with 27 additions and 63 deletions

View File

@ -148,6 +148,9 @@ void main() async {
//Do on BG
await playerHelper.initAudioHandler();
// make database migrations to avoid problems
if (settings.font == 'Deezer') settings.font = 'Mabry Pro';
runApp(const FreezerApp());
}

View File

@ -110,7 +110,7 @@ class Settings {
@HiveField(27)
bool blurPlayerBackground = false;
@HiveField(28)
String font = 'Deezer';
String font = 'System';
@HiveField(29)
bool lyricsVisualizer = false;
@HiveField(30)
@ -221,7 +221,7 @@ class Settings {
return _themeData[theme] ?? ThemeData();
}
final customFonts = ['System', 'YouTube Sans', 'Deezer'];
static const customFonts = ['System', 'Mabry Pro', 'YouTube Sans'];
//Get all available fonts
List<String> get fonts {
return [...customFonts, ...GoogleFonts.asMap().keys];
@ -313,7 +313,7 @@ class Settings {
? null
: GoogleFonts.getTextTheme(font,
isDark ? ThemeData.dark().textTheme : ThemeData.light().textTheme);
String? get fontFamily => (font == 'Deezer') ? 'Mabry Pro' : null;
String? get fontFamily => (font == 'System') ? null : font;
final _elevation1Black = Color.alphaBlend(Colors.white12, Colors.black);

View File

@ -136,15 +136,9 @@ class _LyricsWidgetState extends State<LyricsWidget>
//Lyric height, screen height, appbar height
final actualHeight =
height + (_showTranslation ? additionalTranslationHeight : 0.0);
double scrollTo;
if (_widgetConstraints == null) {
scrollTo = (actualHeight * _currentIndex!) -
(MediaQuery.of(context).size.height / 4 + height / 2);
} else {
final widgetHeight = _widgetConstraints!.maxHeight;
final minScroll = actualHeight * _currentIndex!;
scrollTo = minScroll + height / 2;
}
// _currentIndex + 1 because there's also the initial one
final minScroll = actualHeight * (_currentIndex + 1);
double scrollTo = minScroll + height / 2;
if (scrollTo < 0.0) scrollTo = 0.0;
if (scrollTo > _controller.position.maxScrollExtent) {
@ -168,13 +162,13 @@ class _LyricsWidgetState extends State<LyricsWidget>
if (_currentIndex < _lyrics!.lyrics!.length - 1) {
// update nextOffset
_nextOffset = _lyrics!.lyrics![_currentIndex! + 1].offset!;
_nextOffset = _lyrics!.lyrics![_currentIndex + 1].offset!;
} else {
// dummy position so that the before-hand condition always returns false
_nextOffset = const Duration(days: 69);
}
_currentOffset = _lyrics!.lyrics![_currentIndex!].offset!;
_currentOffset = _lyrics!.lyrics![_currentIndex].offset!;
setState(() => _currentIndex);
if (_freeScroll) return;

View File

@ -645,16 +645,13 @@ class PlayerMenuButtonDesktop extends StatelessWidget {
@override
Widget build(BuildContext context) {
print(Theme.of(context).iconTheme.color);
return InkWell(
customBorder: const CircleBorder(),
onTapUp: _onMenuPressedCallback(context),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(
Icons.more_vert,
semanticLabel: "Options".i18n,
size: size,
),
padding: const EdgeInsets.all(10.0),
child: Icon(Icons.more_vert, size: size),
),
);
}
@ -1170,10 +1167,11 @@ class PlayerScreenTopRow extends StatelessWidget {
],
style: Theme.of(context)
.textTheme
.bodySmall!
.bodyLarge!
.copyWith(fontSize: textSize ?? 38.sp)));
}),
),
PlayerMenuButtonDesktop(size: size),
desktopMode
? PlayerMenuButtonDesktop(size: size)
: PlayerMenuButton(size: size)

View File

@ -42,7 +42,7 @@ packages:
source: hosted
version: "1.5.2"
async:
dependency: "direct main"
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
@ -954,19 +954,12 @@ packages:
mini_music_visualizer:
dependency: "direct main"
description:
name: mini_music_visualizer
sha256: "095b3c5e12f4c045544432829a044a7fe1c5a7789a6d0003347c73d9bf3170cc"
url: "https://pub.dev"
source: hosted
path: "."
ref: HEAD
resolved-ref: "86f6fcb3908f634760af06c916f87a19b36cfa4b"
url: "https://github.com/Pato05/mini_music_visualizer.git"
source: git
version: "1.1.0"
move_to_background:
dependency: "direct main"
description:
name: move_to_background
sha256: "00caad17a6ce149910777131503f43f8ed80025681f94684e3a6a87d979b914c"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
nested:
dependency: transitive
description:
@ -1279,14 +1272,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.6"
random_string:
dependency: "direct main"
description:
name: random_string
sha256: "03b52435aae8cbdd1056cf91bfc5bf845e9706724dd35ae2e99fa14a1ef79d02"
url: "https://pub.dev"
source: hosted
version: "2.3.1"
rxdart:
dependency: "direct main"
description:

View File

@ -1,20 +1,6 @@
name: freezer
description: Freezer
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# 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
publish_to: "none"
version: 0.6.14+1
environment:
@ -30,7 +16,7 @@ dependencies:
crypto: ^3.0.3
http: ^1.1.0
cookie_jar: ^4.0.8
json_annotation: ^4.8.1
json_annotation: ^4.9.0
path_provider: ^2.0.15
path: ^1.6.4
sqflite: ^2.0.0+3
@ -41,12 +27,9 @@ dependencies:
palette_generator: ^0.3.0
flutter_material_color_picker: ^1.0.5
country_pickers: ^2.0.0
move_to_background: ^1.0.1
flutter_local_notifications: ^17.1.0
collection: ^1.17.1
random_string: ^2.0.1
async: ^2.6.1
html: ^0.15.0
html: ^0.15.4
flutter_screenutil: ^5.0.0+2
marquee: ^2.2.0
flutter_cache_manager: ^3.3.2
@ -114,7 +97,8 @@ dependencies:
get_it: ^7.6.7
freezed_annotation:
^2.4.1
mini_music_visualizer: ^1.1.0
mini_music_visualizer:
git: https://github.com/Pato05/mini_music_visualizer.git
fading_edge_scrollview: ^3.0.0
#deezcryptor:
#path: deezcryptor/