From 636f20fa392b5956f529abaff71207e7f55c00dd Mon Sep 17 00:00:00 2001 From: Lucas Albergoni Campaneruti Date: Mon, 6 Apr 2026 09:39:40 -0300 Subject: [PATCH 1/2] Atualizacao de dependencias --- .flutter-plugins-dependencies | 2 +- example/pubspec.lock | 24 ++++++++++++------------ lib/src/story_presenter/story_view.dart | 22 ++++++++++++++++++---- pubspec.yaml | 3 +-- 4 files changed, 32 insertions(+), 19 deletions(-) diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies index 495582c..cc8359e 100644 --- a/.flutter-plugins-dependencies +++ b/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audio_session","path":"/Users/kaival/.pub-cache/hosted/pub.dev/audio_session-0.1.25/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_ios","path":"/Users/kaival/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"just_audio","path":"/Users/kaival/.pub-cache/hosted/pub.dev/just_audio-0.9.46/","shared_darwin_source":true,"native_build":true,"dependencies":["audio_session"],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/kaival/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/Users/kaival/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_avfoundation","path":"/Users/kaival/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.8.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"audio_session","path":"/Users/kaival/.pub-cache/hosted/pub.dev/audio_session-0.1.25/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_android","path":"/Users/kaival/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"just_audio","path":"/Users/kaival/.pub-cache/hosted/pub.dev/just_audio-0.9.46/","native_build":true,"dependencies":["audio_session"],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/kaival/.pub-cache/hosted/pub.dev/path_provider_android-2.2.17/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_android","path":"/Users/kaival/.pub-cache/hosted/pub.dev/sqflite_android-2.4.2+2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_android","path":"/Users/kaival/.pub-cache/hosted/pub.dev/video_player_android-2.8.12/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"audio_session","path":"/Users/kaival/.pub-cache/hosted/pub.dev/audio_session-0.1.25/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_macos","path":"/Users/kaival/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"just_audio","path":"/Users/kaival/.pub-cache/hosted/pub.dev/just_audio-0.9.46/","shared_darwin_source":true,"native_build":true,"dependencies":["audio_session"],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/kaival/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/Users/kaival/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_avfoundation","path":"/Users/kaival/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.8.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"/Users/kaival/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_inappwebview_windows","path":"/Users/kaival/.pub-cache/hosted/pub.dev/flutter_inappwebview_windows-0.6.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/kaival/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"audio_session","path":"/Users/kaival/.pub-cache/hosted/pub.dev/audio_session-0.1.25/","dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_web","path":"/Users/kaival/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.1.2/","dependencies":[],"dev_dependency":false},{"name":"just_audio_web","path":"/Users/kaival/.pub-cache/hosted/pub.dev/just_audio_web-0.4.16/","dependencies":[],"dev_dependency":false},{"name":"video_player_web","path":"/Users/kaival/.pub-cache/hosted/pub.dev/video_player_web-2.4.0/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"audio_session","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web","flutter_inappwebview_windows"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_inappwebview_windows","dependencies":[]},{"name":"just_audio","dependencies":["just_audio_web","audio_session","path_provider"]},{"name":"just_audio_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"sqflite","dependencies":["sqflite_android","sqflite_darwin"]},{"name":"sqflite_android","dependencies":[]},{"name":"sqflite_darwin","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]}],"date_created":"2025-08-22 16:43:34.662574","version":"3.35.1","swift_package_manager_enabled":{"ios":false,"macos":false}} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audio_session","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/audio_session-0.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_ios","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/flutter_inappwebview_ios-1.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"just_audio","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/just_audio-0.10.5/","shared_darwin_source":true,"native_build":true,"dependencies":["audio_session"],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_avfoundation","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.9.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"audio_session","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/audio_session-0.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_android","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/flutter_inappwebview_android-1.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"just_audio","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/just_audio-0.10.5/","native_build":true,"dependencies":["audio_session"],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/path_provider_android-2.2.23/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_android","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/sqflite_android-2.4.2+3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_android","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/video_player_android-2.9.5/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"audio_session","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/audio_session-0.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_macos","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/flutter_inappwebview_macos-1.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"just_audio","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/just_audio-0.10.5/","shared_darwin_source":true,"native_build":true,"dependencies":["audio_session"],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"video_player_avfoundation","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.9.4/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_inappwebview_windows","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/flutter_inappwebview_windows-0.6.0/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"audio_session","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/audio_session-0.2.3/","dependencies":[],"dev_dependency":false},{"name":"flutter_inappwebview_web","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/flutter_inappwebview_web-1.1.2/","dependencies":[],"dev_dependency":false},{"name":"just_audio_web","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/just_audio_web-0.4.16/","dependencies":[],"dev_dependency":false},{"name":"video_player_web","path":"/Users/lucas.campaneruti/.pub-cache/hosted/pub.dev/video_player_web-2.4.0/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"audio_session","dependencies":[]},{"name":"flutter_inappwebview","dependencies":["flutter_inappwebview_android","flutter_inappwebview_ios","flutter_inappwebview_macos","flutter_inappwebview_web","flutter_inappwebview_windows"]},{"name":"flutter_inappwebview_android","dependencies":[]},{"name":"flutter_inappwebview_ios","dependencies":[]},{"name":"flutter_inappwebview_macos","dependencies":[]},{"name":"flutter_inappwebview_web","dependencies":[]},{"name":"flutter_inappwebview_windows","dependencies":[]},{"name":"just_audio","dependencies":["just_audio_web","audio_session","path_provider"]},{"name":"just_audio_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"sqflite","dependencies":["sqflite_android","sqflite_darwin"]},{"name":"sqflite_android","dependencies":[]},{"name":"sqflite_darwin","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]}],"date_created":"2026-04-06 09:38:57.193269","version":"3.41.6","swift_package_manager_enabled":{"ios":false,"macos":false}} \ No newline at end of file diff --git a/example/pubspec.lock b/example/pubspec.lock index ccd2587..99a6139 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: characters - sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.4.1" clock: dependency: transitive description: @@ -283,10 +283,10 @@ packages: dependency: "direct main" description: name: just_audio - sha256: f978d5b4ccea08f267dae0232ec5405c1b05d3f3cd63f82097ea46c015d5c09e + sha256: "9694e4734f515f2a052493d1d7e0d6de219ee0427c7c29492e246ff32a219908" url: "https://pub.dev" source: hosted - version: "0.9.46" + version: "0.10.5" just_audio_platform_interface: dependency: transitive description: @@ -339,26 +339,26 @@ packages: dependency: transitive description: name: matcher - sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 url: "https://pub.dev" source: hosted - version: "0.12.17" + version: "0.12.19" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.13.0" meta: dependency: transitive description: name: meta - sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" url: "https://pub.dev" source: hosted - version: "1.16.0" + version: "1.17.0" mime: dependency: transitive description: @@ -568,10 +568,10 @@ packages: dependency: transitive description: name: test_api - sha256: "522f00f556e73044315fa4585ec3270f1808a4b186c936e612cab0b565ff1e00" + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" url: "https://pub.dev" source: hosted - version: "0.7.6" + version: "0.7.10" typed_data: dependency: transitive description: diff --git a/lib/src/story_presenter/story_view.dart b/lib/src/story_presenter/story_view.dart index ab86bfd..e60fd97 100644 --- a/lib/src/story_presenter/story_view.dart +++ b/lib/src/story_presenter/story_view.dart @@ -237,13 +237,13 @@ class _FlutterStoryPresenterState extends State } if (currentItem.audioConfig != null) { - _audioPlayer?.durationFuture?.then((v) { - _totalAudioDuration = v; + void setupAudioAnimation(Duration duration) { + _totalAudioDuration = duration; _animationController ??= AnimationController( vsync: this, ); - _animationController?.duration = v; + _animationController?.duration = duration; _currentProgressAnimation = Tween(begin: 0, end: 1).animate(_animationController!) @@ -251,7 +251,21 @@ class _FlutterStoryPresenterState extends State ..addStatusListener(animationStatusListener); _animationController!.forward(); - }); + } + + final audioDuration = _audioPlayer?.duration; + if (audioDuration != null) { + setupAudioAnimation(audioDuration); + } else { + _audioPlayer?.durationStream + .firstWhere((duration) => duration != null) + .then((duration) { + if (!mounted || duration == null) { + return; + } + setupAudioAnimation(duration); + }); + } _audioDurationSubscriptionStream = _audioPlayer?.positionStream.listen(audioPositionListener); _audioPlayerStateStream = _audioPlayer?.playerStateStream.listen( diff --git a/pubspec.yaml b/pubspec.yaml index 79e7993..6ef8b02 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,7 +8,6 @@ environment: flutter: ">=1.17.0" dependencies: - flutter: sdk: flutter cached_network_image: ^3.3.1 @@ -16,7 +15,7 @@ dependencies: flutter_hooks: ^0.21.3+1 video_player: ^2.9.1 flutter_inappwebview: ^6.0.0 - just_audio: ^0.9.37 + just_audio: ^0.10.5 dev_dependencies: flutter_test: From 97151b2ed273c7143be6239578c57b2758525e28 Mon Sep 17 00:00:00 2001 From: Cristovao farias Date: Thu, 18 Jun 2026 16:37:45 -0300 Subject: [PATCH 2/2] fix :animation listener management to prevent memory leaks in story presenter --- lib/src/story_presenter/story_view.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/src/story_presenter/story_view.dart b/lib/src/story_presenter/story_view.dart index e60fd97..3a3b47a 100644 --- a/lib/src/story_presenter/story_view.dart +++ b/lib/src/story_presenter/story_view.dart @@ -245,6 +245,10 @@ class _FlutterStoryPresenterState extends State _animationController?.duration = duration; + _animationController + ?..removeListener(animationListener) + ..removeStatusListener(animationStatusListener); + _currentProgressAnimation = Tween(begin: 0, end: 1).animate(_animationController!) ..addListener(animationListener) @@ -290,6 +294,10 @@ class _FlutterStoryPresenterState extends State _animationController?.duration = _currentVideoPlayer?.value.duration ?? currentItem.duration; + _animationController + ?..removeListener(animationListener) + ..removeStatusListener(animationStatusListener); + _currentProgressAnimation = Tween(begin: 0, end: 1).animate(_animationController!) ..addListener(animationListener)