From 6d921fc21664f014d3a88a39e2dbb28bdaff5cf9 Mon Sep 17 00:00:00 2001 From: blueJpg <2238288979@qq.com> Date: Fri, 31 May 2024 13:28:06 +0800 Subject: [PATCH] [*] improve ui --- Makefile | 5 ++++- lib/models/lyric_controller.dart | 2 -- lib/pages/song.dart | 13 +++++++------ 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index a287672..426e98f 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ run-linux: build-rust: cd ./rust && cargo build -build-apk: build-apk-all build-apk-arm build-apk-arm64 build-apk-x64 +build-apk: remove-old-apk build-apk-all build-apk-arm build-apk-arm64 build-apk-x64 build-apk-all: make-release-dir - rm build/release/musicbox-${version}.apk @@ -47,6 +47,9 @@ build-apk-x64: make-release-dir make-release-dir: mkdir -p ./build/release +remove-old-apk: + -rm -f ./build/release/* + clean: rm -rf ./flutter_jank_metrics_*.json rm -rf ./rust/target diff --git a/lib/models/lyric_controller.dart b/lib/models/lyric_controller.dart index 2085fc4..7574a93 100644 --- a/lib/models/lyric_controller.dart +++ b/lib/models/lyric_controller.dart @@ -48,8 +48,6 @@ class SongLyricController extends GetxController { String? downloadDir; - bool isInitShowAdjustLyricSpeedOverlay = false; - SongLyricController() { if (!kReleaseMode) { fakeLyricList(); diff --git a/lib/pages/song.dart b/lib/pages/song.dart index e50d134..93b0f07 100644 --- a/lib/pages/song.dart +++ b/lib/pages/song.dart @@ -34,6 +34,8 @@ class _SongPageState extends State { final currentSongIndex = Get.arguments["currentSongIndex"]; final isShowAdjustLyricSpeedOverlay = false.obs; + bool isInitShowAdjustLyricSpeedOverlay = false; + OverlayEntry? overlayEntry; @override void initState() { @@ -88,7 +90,7 @@ class _SongPageState extends State { void showAdjustLyricSpeedOverlay(BuildContext context, Song song) { OverlayState overlayState = Overlay.of(context); - OverlayEntry overlayEntry = OverlayEntry( + overlayEntry = OverlayEntry( builder: (context) => Positioned( top: 50, left: (Get.width - 200) / 2, @@ -109,7 +111,7 @@ class _SongPageState extends State { ), ), ); - overlayState.insert(overlayEntry); + overlayState.insert(overlayEntry!); } Widget buildAdjustLyricSpeed(BuildContext context, Song song) { @@ -515,10 +517,8 @@ class _SongPageState extends State { isShowAdjustLyricSpeedOverlay.value = !isShowAdjustLyricSpeedOverlay.value; - if (!songLyricController - .isInitShowAdjustLyricSpeedOverlay) { - songLyricController.isInitShowAdjustLyricSpeedOverlay = - true; + if (!isInitShowAdjustLyricSpeedOverlay) { + isInitShowAdjustLyricSpeedOverlay = true; showAdjustLyricSpeedOverlay( context, playlistController @@ -547,6 +547,7 @@ class _SongPageState extends State { onPopInvoked: (didPop) { if (didPop) return; isShowAdjustLyricSpeedOverlay.value = false; + overlayEntry?.remove(); Get.back(); }, );