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 //Do on BG
await playerHelper.initAudioHandler(); await playerHelper.initAudioHandler();
// make database migrations to avoid problems
if (settings.font == 'Deezer') settings.font = 'Mabry Pro';
runApp(const FreezerApp()); runApp(const FreezerApp());
} }

View file

@ -110,7 +110,7 @@ class Settings {
@HiveField(27) @HiveField(27)
bool blurPlayerBackground = false; bool blurPlayerBackground = false;
@HiveField(28) @HiveField(28)
String font = 'Deezer'; String font = 'System';
@HiveField(29) @HiveField(29)
bool lyricsVisualizer = false; bool lyricsVisualizer = false;
@HiveField(30) @HiveField(30)
@ -221,7 +221,7 @@ class Settings {
return _themeData[theme] ?? ThemeData(); return _themeData[theme] ?? ThemeData();
} }
final customFonts = ['System', 'YouTube Sans', 'Deezer']; static const customFonts = ['System', 'Mabry Pro', 'YouTube Sans'];
//Get all available fonts //Get all available fonts
List<String> get fonts { List<String> get fonts {
return [...customFonts, ...GoogleFonts.asMap().keys]; return [...customFonts, ...GoogleFonts.asMap().keys];
@ -313,7 +313,7 @@ class Settings {
? null ? null
: GoogleFonts.getTextTheme(font, : GoogleFonts.getTextTheme(font,
isDark ? ThemeData.dark().textTheme : ThemeData.light().textTheme); 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); 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 //Lyric height, screen height, appbar height
final actualHeight = final actualHeight =
height + (_showTranslation ? additionalTranslationHeight : 0.0); height + (_showTranslation ? additionalTranslationHeight : 0.0);
double scrollTo; // _currentIndex + 1 because there's also the initial one
if (_widgetConstraints == null) { final minScroll = actualHeight * (_currentIndex + 1);
scrollTo = (actualHeight * _currentIndex!) - double scrollTo = minScroll + height / 2;
(MediaQuery.of(context).size.height / 4 + height / 2);
} else {
final widgetHeight = _widgetConstraints!.maxHeight;
final minScroll = actualHeight * _currentIndex!;
scrollTo = minScroll + height / 2;
}
if (scrollTo < 0.0) scrollTo = 0.0; if (scrollTo < 0.0) scrollTo = 0.0;
if (scrollTo > _controller.position.maxScrollExtent) { if (scrollTo > _controller.position.maxScrollExtent) {
@ -168,13 +162,13 @@ class _LyricsWidgetState extends State<LyricsWidget>
if (_currentIndex < _lyrics!.lyrics!.length - 1) { if (_currentIndex < _lyrics!.lyrics!.length - 1) {
// update nextOffset // update nextOffset
_nextOffset = _lyrics!.lyrics![_currentIndex! + 1].offset!; _nextOffset = _lyrics!.lyrics![_currentIndex + 1].offset!;
} else { } else {
// dummy position so that the before-hand condition always returns false // dummy position so that the before-hand condition always returns false
_nextOffset = const Duration(days: 69); _nextOffset = const Duration(days: 69);
} }
_currentOffset = _lyrics!.lyrics![_currentIndex!].offset!; _currentOffset = _lyrics!.lyrics![_currentIndex].offset!;
setState(() => _currentIndex); setState(() => _currentIndex);
if (_freeScroll) return; if (_freeScroll) return;

View file

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

View file

@ -42,7 +42,7 @@ packages:
source: hosted source: hosted
version: "1.5.2" version: "1.5.2"
async: async:
dependency: "direct main" dependency: transitive
description: description:
name: async name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
@ -954,19 +954,12 @@ packages:
mini_music_visualizer: mini_music_visualizer:
dependency: "direct main" dependency: "direct main"
description: description:
name: mini_music_visualizer path: "."
sha256: "095b3c5e12f4c045544432829a044a7fe1c5a7789a6d0003347c73d9bf3170cc" ref: HEAD
url: "https://pub.dev" resolved-ref: "86f6fcb3908f634760af06c916f87a19b36cfa4b"
source: hosted url: "https://github.com/Pato05/mini_music_visualizer.git"
source: git
version: "1.1.0" 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: nested:
dependency: transitive dependency: transitive
description: description:
@ -1279,14 +1272,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.6" 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: rxdart:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -1,20 +1,6 @@
name: freezer name: freezer
description: Freezer description: Freezer
publish_to: "none"
# 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
version: 0.6.14+1 version: 0.6.14+1
environment: environment:
@ -30,7 +16,7 @@ dependencies:
crypto: ^3.0.3 crypto: ^3.0.3
http: ^1.1.0 http: ^1.1.0
cookie_jar: ^4.0.8 cookie_jar: ^4.0.8
json_annotation: ^4.8.1 json_annotation: ^4.9.0
path_provider: ^2.0.15 path_provider: ^2.0.15
path: ^1.6.4 path: ^1.6.4
sqflite: ^2.0.0+3 sqflite: ^2.0.0+3
@ -41,12 +27,9 @@ dependencies:
palette_generator: ^0.3.0 palette_generator: ^0.3.0
flutter_material_color_picker: ^1.0.5 flutter_material_color_picker: ^1.0.5
country_pickers: ^2.0.0 country_pickers: ^2.0.0
move_to_background: ^1.0.1
flutter_local_notifications: ^17.1.0 flutter_local_notifications: ^17.1.0
collection: ^1.17.1 collection: ^1.17.1
random_string: ^2.0.1 html: ^0.15.4
async: ^2.6.1
html: ^0.15.0
flutter_screenutil: ^5.0.0+2 flutter_screenutil: ^5.0.0+2
marquee: ^2.2.0 marquee: ^2.2.0
flutter_cache_manager: ^3.3.2 flutter_cache_manager: ^3.3.2
@ -114,7 +97,8 @@ dependencies:
get_it: ^7.6.7 get_it: ^7.6.7
freezed_annotation: freezed_annotation:
^2.4.1 ^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 fading_edge_scrollview: ^3.0.0
#deezcryptor: #deezcryptor:
#path: deezcryptor/ #path: deezcryptor/