From 0ceef12104836c897c7888d8182610b0b6d3209a Mon Sep 17 00:00:00 2001 From: yzhe819 Date: Mon, 28 Feb 2022 11:37:28 +1300 Subject: [PATCH 1/3] update dependencies and fix null error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🛠 Fix following building error: Error: Property 'window' cannot be accessed on 'WidgetsBinding?' because it is potentially null. Error: Method 'scheduleFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null. --- .../tracks/tracks_player_impl_mobile.dart | 2 +- lib/navigation/common/player/lyric.dart | 4 +- lib/navigation/mobile/home/main_page_my.dart | 4 +- .../mobile/player/page_playing.dart | 2 +- pubspec.lock | 101 ++++++++---------- windows/flutter/generated_plugins.cmake | 8 -- 6 files changed, 53 insertions(+), 68 deletions(-) diff --git a/lib/media/tracks/tracks_player_impl_mobile.dart b/lib/media/tracks/tracks_player_impl_mobile.dart index 384a263a..c1e4aa61 100644 --- a/lib/media/tracks/tracks_player_impl_mobile.dart +++ b/lib/media/tracks/tracks_player_impl_mobile.dart @@ -230,7 +230,7 @@ Future _loadImageInterceptor(MusicMetadata metadata) async { final ImageStream stream = CachedImage(metadata.iconUri.toString()).resolve(ImageConfiguration( size: const Size(150, 150), - devicePixelRatio: WidgetsBinding.instance.window.devicePixelRatio, + devicePixelRatio: WidgetsBinding.instance!.window.devicePixelRatio, )); final image = Completer(); stream.addListener(ImageStreamListener((info, a) { diff --git a/lib/navigation/common/player/lyric.dart b/lib/navigation/common/player/lyric.dart index a4eb648b..91ede3ea 100644 --- a/lib/navigation/common/player/lyric.dart +++ b/lib/navigation/common/player/lyric.dart @@ -91,7 +91,7 @@ class LyricState extends State with TickerProviderStateMixin { /// scroll lyric to current playing position void _scrollToCurrentPosition(int? milliseconds, {bool animate = true}) { if (lyricPainter!.height == -1) { - WidgetsBinding.instance.addPostFrameCallback((d) { + WidgetsBinding.instance!.addPostFrameCallback((d) { // debugPrint("try to init scroll to position ${widget.position.value}," // "but lyricPainter is unavaiable, so scroll(without animate) on next frame $d"); //TODO maybe cause bad performance @@ -267,7 +267,7 @@ class _ScrollerListenerState extends State<_ScrollerListener> { void _receivedPointerSignal(PointerSignalEvent event) { if (event is PointerScrollEvent) { if (_pointerSignalEventDelta(event) != 0.0) { - GestureBinding.instance.pointerSignalResolver + GestureBinding.instance!.pointerSignalResolver .register(event, _handlePointerScroll); } } diff --git a/lib/navigation/mobile/home/main_page_my.dart b/lib/navigation/mobile/home/main_page_my.dart index 8d3f872b..0346b964 100644 --- a/lib/navigation/mobile/home/main_page_my.dart +++ b/lib/navigation/mobile/home/main_page_my.dart @@ -150,7 +150,7 @@ class _MainPageMyState extends ConsumerState curve: Curves.linear, ) .then((_) { - WidgetsBinding.instance.scheduleFrameCallback((timeStamp) { + WidgetsBinding.instance!.scheduleFrameCallback((timeStamp) { _scrollToPlayList(type); }); }); @@ -162,7 +162,7 @@ class _MainPageMyState extends ConsumerState curve: Curves.linear, ) .then((_) { - WidgetsBinding.instance.scheduleFrameCallback((timeStamp) { + WidgetsBinding.instance!.scheduleFrameCallback((timeStamp) { _scrollToPlayList(type); }); }); diff --git a/lib/navigation/mobile/player/page_playing.dart b/lib/navigation/mobile/player/page_playing.dart index 46db9619..e9fa9a9f 100644 --- a/lib/navigation/mobile/player/page_playing.dart +++ b/lib/navigation/mobile/player/page_playing.dart @@ -18,7 +18,7 @@ class PlayingPage extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final current = ref.read(playerStateProvider).playingTrack; if (current == null) { - WidgetsBinding.instance.scheduleFrameCallback((_) { + WidgetsBinding.instance!.scheduleFrameCallback((_) { Navigator.of(context).pop(); }); return Container(); diff --git a/pubspec.lock b/pubspec.lock index 41072781..623ba301 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "32.0.0" + version: "36.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.3.1" args: dependency: transitive description: @@ -28,7 +28,7 @@ packages: name: asn1lib url: "https://pub.dartlang.org" source: hosted - version: "1.0.3" + version: "1.1.0" async: dependency: "direct main" description: @@ -105,7 +105,7 @@ packages: name: built_value url: "https://pub.dartlang.org" source: hosted - version: "8.1.3" + version: "8.1.4" characters: dependency: transitive description: @@ -127,13 +127,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.1" - cli_util: - dependency: transitive - description: - name: cli_util - url: "https://pub.dartlang.org" - source: hosted - version: "0.3.5" clock: dependency: transitive description: @@ -217,7 +210,7 @@ packages: name: desktop_drop url: "https://pub.dartlang.org" source: hosted - version: "0.3.0" + version: "0.3.2" dio: dependency: transitive description: @@ -299,7 +292,7 @@ packages: name: flutter_hooks url: "https://pub.dartlang.org" source: hosted - version: "0.18.1" + version: "0.18.2+1" flutter_lints: dependency: "direct dev" description: @@ -356,7 +349,7 @@ packages: name: hive url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.6" hooks_riverpod: dependency: "direct main" description: @@ -370,7 +363,7 @@ packages: name: http_multi_server url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.2.0" http_parser: dependency: transitive description: @@ -398,7 +391,7 @@ packages: name: js url: "https://pub.dartlang.org" source: hosted - version: "0.6.4" + version: "0.6.3" json_annotation: dependency: "direct main" description: @@ -412,7 +405,7 @@ packages: name: json_serializable url: "https://pub.dartlang.org" source: hosted - version: "6.1.3" + version: "6.1.4" lints: dependency: transitive description: @@ -456,7 +449,7 @@ packages: name: material_color_utilities url: "https://pub.dartlang.org" source: hosted - version: "0.1.4" + version: "0.1.3" meta: dependency: transitive description: @@ -516,7 +509,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.1" + version: "1.8.0" path_drawing: dependency: transitive description: @@ -537,49 +530,49 @@ packages: name: path_provider url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.0.9" path_provider_android: dependency: transitive description: name: path_provider_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.12" path_provider_ios: dependency: transitive description: name: path_provider_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.7" + version: "2.0.8" path_provider_linux: dependency: transitive description: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.5" path_provider_macos: dependency: transitive description: name: path_provider_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.3" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" pedantic: dependency: transitive description: @@ -600,14 +593,14 @@ packages: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.1.2" pointycastle: dependency: transitive description: name: pointycastle url: "https://pub.dartlang.org" source: hosted - version: "3.4.0" + version: "3.5.1" pool: dependency: transitive description: @@ -663,42 +656,42 @@ packages: name: sembast url: "https://pub.dartlang.org" source: hosted - version: "3.1.1+1" + version: "3.2.0" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" shared_preferences_android: dependency: transitive description: name: shared_preferences_android url: "https://pub.dartlang.org" source: hosted - version: "2.0.9" + version: "2.0.11" shared_preferences_ios: dependency: transitive description: name: shared_preferences_ios url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.1.0" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" shared_preferences_platform_interface: dependency: transitive description: @@ -712,14 +705,14 @@ packages: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "2.0.3" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.1.0" shelf: dependency: transitive description: @@ -759,7 +752,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.2" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -773,7 +766,7 @@ packages: name: state_notifier url: "https://pub.dartlang.org" source: hosted - version: "0.7.1" + version: "0.7.2+1" stream_channel: dependency: transitive description: @@ -822,7 +815,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.9" + version: "0.4.8" timing: dependency: transitive description: @@ -843,63 +836,63 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.17" + version: "6.0.20" url_launcher_android: dependency: transitive description: name: url_launcher_android url: "https://pub.dartlang.org" source: hosted - version: "6.0.13" + version: "6.0.15" url_launcher_ios: dependency: transitive description: name: url_launcher_ios url: "https://pub.dartlang.org" source: hosted - version: "6.0.13" + version: "6.0.15" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.4" + version: "2.0.5" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.9" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.2" + version: "3.0.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.2" + version: "2.1.1" watcher: dependency: transitive description: @@ -920,28 +913,28 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.3.3" + version: "2.4.1" window_manager: dependency: "direct main" description: name: window_manager url: "https://pub.dartlang.org" source: hosted - version: "0.1.5" + version: "0.1.8" windows_taskbar: dependency: "direct main" description: name: windows_taskbar url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.1.0" xdg_directories: dependency: transitive description: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.0+1" yaml: dependency: transitive description: @@ -950,5 +943,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.16.0-100.0.dev <3.0.0" - flutter: ">=2.5.0" + dart: ">=2.16.0 <3.0.0" + flutter: ">=2.10.0" diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 42659b34..f44b6d38 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -11,9 +11,6 @@ list(APPEND FLUTTER_PLUGIN_LIST windows_taskbar ) -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - set(PLUGIN_BUNDLED_LIBRARIES) foreach(plugin ${FLUTTER_PLUGIN_LIST}) @@ -22,8 +19,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST}) list(APPEND PLUGIN_BUNDLED_LIBRARIES $) list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) From 845fa198cc8888f86afaac5b786448d32ce1a4d3 Mon Sep 17 00:00:00 2001 From: yzhe819 Date: Mon, 28 Feb 2022 11:52:48 +1300 Subject: [PATCH 2/3] add manual dispatching of GitHub Actions --- .github/workflows/main.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index dde89d16..fa92efcc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,11 +1,14 @@ name: CI on: - push + # manual workflow trigger + workflow_dispatch: + # matches every branch + push: + branches: "**" jobs: build: - runs-on: ubuntu-latest steps: @@ -13,10 +16,10 @@ jobs: - uses: actions/setup-java@v1 with: - java-version: '12.x' + java-version: "12.x" - uses: subosito/flutter-action@v1 with: - channel: 'master' + channel: "master" - run: flutter config --enable-linux-desktop @@ -50,4 +53,3 @@ jobs: - name: Build APP run: flutter build linux - From 68643a31d6c6d178b6358c50f5198597c0e67c89 Mon Sep 17 00:00:00 2001 From: yzhe819 Date: Mon, 28 Feb 2022 12:25:48 +1300 Subject: [PATCH 3/3] fix flutter analyze issues remove unused '!' remove deprecated method "clearThumbnailToolbar". Use [WindowsTaskbar.resetThumbnailToolbar] instead. --- lib/media/tracks/tracks_player_impl_mobile.dart | 2 +- lib/navigation/common/player/lyric.dart | 2 +- lib/navigation/desktop/widgets/windows_task_bar.dart | 2 +- lib/navigation/mobile/home/main_page_my.dart | 4 ++-- lib/navigation/mobile/player/page_playing.dart | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/media/tracks/tracks_player_impl_mobile.dart b/lib/media/tracks/tracks_player_impl_mobile.dart index c1e4aa61..607f1dff 100644 --- a/lib/media/tracks/tracks_player_impl_mobile.dart +++ b/lib/media/tracks/tracks_player_impl_mobile.dart @@ -230,7 +230,7 @@ Future _loadImageInterceptor(MusicMetadata metadata) async { final ImageStream stream = CachedImage(metadata.iconUri.toString()).resolve(ImageConfiguration( size: const Size(150, 150), - devicePixelRatio: WidgetsBinding.instance!.window.devicePixelRatio, + devicePixelRatio: WidgetsBinding.instance?.window.devicePixelRatio, )); final image = Completer(); stream.addListener(ImageStreamListener((info, a) { diff --git a/lib/navigation/common/player/lyric.dart b/lib/navigation/common/player/lyric.dart index 91ede3ea..128182e1 100644 --- a/lib/navigation/common/player/lyric.dart +++ b/lib/navigation/common/player/lyric.dart @@ -91,7 +91,7 @@ class LyricState extends State with TickerProviderStateMixin { /// scroll lyric to current playing position void _scrollToCurrentPosition(int? milliseconds, {bool animate = true}) { if (lyricPainter!.height == -1) { - WidgetsBinding.instance!.addPostFrameCallback((d) { + WidgetsBinding.instance?.addPostFrameCallback((d) { // debugPrint("try to init scroll to position ${widget.position.value}," // "but lyricPainter is unavaiable, so scroll(without animate) on next frame $d"); //TODO maybe cause bad performance diff --git a/lib/navigation/desktop/widgets/windows_task_bar.dart b/lib/navigation/desktop/widgets/windows_task_bar.dart index cf1a75f0..d3f1c389 100644 --- a/lib/navigation/desktop/widgets/windows_task_bar.dart +++ b/lib/navigation/desktop/widgets/windows_task_bar.dart @@ -33,7 +33,7 @@ class _WindowsTaskBar extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { ref.listen(playerStateProvider, (previous, next) { if (next.playingTrack == null) { - WindowsTaskbar.clearThumbnailToolbar(); + WindowsTaskbar.resetThumbnailToolbar(); } else { WindowsTaskbar.setThumbnailToolbar([ ThumbnailToolbarButton( diff --git a/lib/navigation/mobile/home/main_page_my.dart b/lib/navigation/mobile/home/main_page_my.dart index 0346b964..d964b7d6 100644 --- a/lib/navigation/mobile/home/main_page_my.dart +++ b/lib/navigation/mobile/home/main_page_my.dart @@ -150,7 +150,7 @@ class _MainPageMyState extends ConsumerState curve: Curves.linear, ) .then((_) { - WidgetsBinding.instance!.scheduleFrameCallback((timeStamp) { + WidgetsBinding.instance?.scheduleFrameCallback((timeStamp) { _scrollToPlayList(type); }); }); @@ -162,7 +162,7 @@ class _MainPageMyState extends ConsumerState curve: Curves.linear, ) .then((_) { - WidgetsBinding.instance!.scheduleFrameCallback((timeStamp) { + WidgetsBinding.instance?.scheduleFrameCallback((timeStamp) { _scrollToPlayList(type); }); }); diff --git a/lib/navigation/mobile/player/page_playing.dart b/lib/navigation/mobile/player/page_playing.dart index e9fa9a9f..0ef6122b 100644 --- a/lib/navigation/mobile/player/page_playing.dart +++ b/lib/navigation/mobile/player/page_playing.dart @@ -18,7 +18,7 @@ class PlayingPage extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final current = ref.read(playerStateProvider).playingTrack; if (current == null) { - WidgetsBinding.instance!.scheduleFrameCallback((_) { + WidgetsBinding.instance?.scheduleFrameCallback((_) { Navigator.of(context).pop(); }); return Container();