From ad7081b3426f212b0e6eab5ec02a4d8c9c691b83 Mon Sep 17 00:00:00 2001 From: projectdx Date: Sun, 11 Jan 2026 19:57:20 +0900 Subject: [PATCH] Add M3U sources persistence UI and provider; integrate saved sources into HomeScreen --- lib/player_screen.dart | 72 ++++++++++--------- macos/Flutter/GeneratedPluginRegistrant.swift | 2 + pubspec.lock | 64 +++++++++++++++++ pubspec.yaml | 2 +- 4 files changed, 106 insertions(+), 34 deletions(-) diff --git a/lib/player_screen.dart b/lib/player_screen.dart index ba06e4a..31d6d09 100644 --- a/lib/player_screen.dart +++ b/lib/player_screen.dart @@ -389,39 +389,45 @@ class _PlayerScreenState extends State { ])))), if (_playError) Positioned.fill( - child: Container( - color: Colors.black54, - child: Center( - child: Card( - color: Colors.red.shade900, - child: Padding( - padding: const EdgeInsets.all(16), - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text(_errorMessage ?? 'Playback failed', - style: const TextStyle( - color: Colors.white, - fontSize: 16)), - const SizedBox(height: 12), - Row( - mainAxisSize: MainAxisSize.min, - children: [ - TextButton( - onPressed: _retryPlay, - child: const Text('Retry', - style: TextStyle( - color: - Colors.white))), - const SizedBox(width: 8), - TextButton( - onPressed: _inspectStream, - child: const Text('Inspect', - style: TextStyle( - color: - Colors.white))) - ]) - ]))))), + child: Container( + color: Colors.black54, + child: Center( + child: Card( + color: Colors.red.shade900, + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text(_errorMessage ?? 'Playback failed', + style: const TextStyle( + color: Colors.white, fontSize: 16)), + const SizedBox(height: 12), + Row( + mainAxisSize: MainAxisSize.min, + children: [ + TextButton( + onPressed: _retryPlay, + child: const Text('Retry', + style: + TextStyle(color: Colors.white)), + ), + const SizedBox(width: 8), + TextButton( + onPressed: _inspectStream, + child: const Text('Inspect', + style: + TextStyle(color: Colors.white)), + ), + ], + ), + ], + ), + ), + ), + ), + ), + ), AnimatedOpacity( opacity: _showControls ? 1.0 : 0.0, duration: const Duration(milliseconds: 300), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cd60bd0..168e54a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -11,6 +11,7 @@ import media_kit_libs_macos_video import media_kit_video import package_info_plus import path_provider_foundation +import shared_preferences_foundation import volume_controller import wakelock_plus @@ -21,6 +22,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { MediaKitVideoPlugin.register(with: registry.registrar(forPlugin: "MediaKitVideoPlugin")) FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) VolumeControllerPlugin.register(with: registry.registrar(forPlugin: "VolumeControllerPlugin")) WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index 22827d2..9733140 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -121,6 +121,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.5" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" file_picker: dependency: "direct main" description: @@ -464,6 +472,62 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.0" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64" + url: "https://pub.dev" + source: hosted + version: "2.5.4" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "83af5c682796c0f7719c2bbf74792d113e40ae97981b8f266fa84574573556bc" + url: "https://pub.dev" + source: hosted + version: "2.4.18" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f" + url: "https://pub.dev" + source: hosted + version: "2.5.6" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: c49bd060261c9a3f0ff445892695d6212ff603ef3115edbb448509d407600019 + url: "https://pub.dev" + source: hosted + version: "2.4.3" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" + url: "https://pub.dev" + source: hosted + version: "2.4.1" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index 13ce77d..ad44775 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -20,7 +20,7 @@ dependencies: charset_converter: ^2.1.0 http: ^1.6.0 flutter_riverpod: ^2.3.0 - shared_preferences: ^3.0.0 + shared_preferences: ^2.5.4 dev_dependencies: flutter_test: