Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ad3876474 | ||
|
|
127b3ba2e4 | ||
|
|
1000032db0 | ||
|
|
dea2bc35ea | ||
|
|
276af6c4e8 | ||
|
|
f3e91ba789 | ||
|
|
7f9cee4222 | ||
|
|
9fe91f9c1d | ||
|
|
6d7de29db1 | ||
|
|
24981977c0 | ||
|
|
c0ab7a524e |
@@ -312,7 +312,7 @@ jobs:
|
||||
files: |
|
||||
artifacts/android-apk/plezy-android.apk
|
||||
artifacts/ios-ipa/plezy-ios.ipa
|
||||
artifacts/macos-dmg/plezy-macos.dmg
|
||||
artifacts/macos-zip/plezy-macos.zip
|
||||
artifacts/windows-portable/plezy-windows-portable.zip
|
||||
artifacts/windows-installer/plezy-windows-installer.exe
|
||||
artifacts/linux-app/plezy-linux.tar.gz
|
||||
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
# Privacy Policy for Plezy
|
||||
|
||||
**Last Updated: October 22, 2025**
|
||||
|
||||
## Introduction
|
||||
|
||||
Plezy ("we", "our", or "the app") is a third-party Plex client that allows you to access and stream content from your Plex Media Server. This privacy policy explains how we handle your information when you use our app.
|
||||
|
||||
## Information We Collect
|
||||
|
||||
### Authentication Information
|
||||
When you sign in to Plezy using your Plex account, we collect and process:
|
||||
- Plex authentication tokens
|
||||
- Plex account username
|
||||
- Plex server connection information
|
||||
|
||||
### Local Network Information
|
||||
To connect to your Plex Media Server on your local network, we may access:
|
||||
- Local network device discovery information
|
||||
- IP addresses of Plex servers on your network
|
||||
|
||||
### Usage Information
|
||||
The app stores locally on your device:
|
||||
- Your authentication session
|
||||
- App preferences and settings
|
||||
- Recently accessed content history
|
||||
|
||||
## How We Use Your Information
|
||||
|
||||
We use the collected information solely to:
|
||||
- Authenticate you with your Plex account
|
||||
- Connect to and communicate with your Plex Media Server
|
||||
- Display your media library and stream content
|
||||
- Maintain your session and app preferences
|
||||
|
||||
## Data Storage and Security
|
||||
|
||||
- **Authentication tokens** are stored securely on your device using platform-specific secure storage mechanisms
|
||||
- **App preferences** are stored locally on your device
|
||||
- **No data** is transmitted to our servers - all communication is directly between your device and your Plex Media Server or Plex's authentication services
|
||||
|
||||
## Third-Party Services
|
||||
|
||||
### Plex
|
||||
Plezy uses Plex's authentication and media services. When you use this app:
|
||||
- You authenticate directly with Plex's servers
|
||||
- Your media streaming occurs between your device and your Plex Media Server
|
||||
- Plex's own privacy policy applies to their services: https://www.plex.tv/about/privacy-legal/
|
||||
|
||||
We do not control and are not responsible for Plex's data practices.
|
||||
|
||||
## Data Sharing
|
||||
|
||||
We do not:
|
||||
- Sell your personal information
|
||||
- Share your information with third parties for marketing purposes
|
||||
- Transmit your data to our own servers
|
||||
- Track your viewing habits outside of local app functionality
|
||||
|
||||
Your data is only shared with:
|
||||
- **Plex services** for authentication and media server communication (as required for the app to function)
|
||||
|
||||
## Your Rights and Choices
|
||||
|
||||
You can:
|
||||
- **Sign out** at any time to remove your authentication session from the device
|
||||
- **Uninstall the app** to remove all locally stored data
|
||||
- **Manage your Plex account** directly through Plex's services
|
||||
|
||||
## Children's Privacy
|
||||
|
||||
Plezy does not knowingly collect personal information from children under 13. The app relies on Plex account authentication, and users must comply with Plex's terms of service and age requirements.
|
||||
|
||||
## Changes to This Privacy Policy
|
||||
|
||||
We may update this privacy policy from time to time. We will notify users of any material changes by updating the "Last Updated" date at the top of this policy.
|
||||
|
||||
## Data Retention
|
||||
|
||||
- Authentication tokens are retained on your device until you sign out or uninstall the app
|
||||
- Local preferences and settings are retained until you uninstall the app
|
||||
- No data is retained on our servers as we do not operate any backend services
|
||||
|
||||
## International Data Transfers
|
||||
|
||||
As we do not operate backend servers, there are no international data transfers from our side. Any data transfers occur directly between your device and Plex's services, subject to Plex's privacy policy.
|
||||
|
||||
## Legal Compliance
|
||||
|
||||
This app complies with:
|
||||
- General Data Protection Regulation (GDPR)
|
||||
- California Consumer Privacy Act (CCPA)
|
||||
- Children's Online Privacy Protection Act (COPPA)
|
||||
- Other applicable privacy laws
|
||||
|
||||
## Your Consent
|
||||
|
||||
By using Plezy, you consent to this privacy policy and the processing of your information as described herein.
|
||||
@@ -8,16 +8,16 @@ Plezy is a modern Plex media client that provides a seamless streaming experienc
|
||||
Coming soon
|
||||
|
||||
### Desktop
|
||||
- [Windows (x64)](https://github.com/edde746/plezy/releases/latest/download/plezy-windows-x64.zip)
|
||||
- [macOS (Universal)](https://github.com/edde746/plezy/releases/latest/download/plezy-macos.dmg)
|
||||
- [Linux (x64)](https://github.com/edde746/plezy/releases/latest/download/plezy-linux-x64.tar.gz)
|
||||
- [Windows (x64)](https://github.com/edde746/plezy/releases/latest/download/plezy-windows-installer.exe)
|
||||
- [macOS (Universal)](https://github.com/edde746/plezy/releases/latest/download/plezy-macos.zip)
|
||||
- [Linux (x64)](https://github.com/edde746/plezy/releases/latest/download/plezy-linux.tar.gz)
|
||||
|
||||
> Download the latest release from the [Releases page](https://github.com/edde746/plezy/releases)
|
||||
|
||||
## Features
|
||||
|
||||
### 🔐 Authentication & Server Management
|
||||
- OAuth PIN-based authentication
|
||||
- Sign in with Plex
|
||||
- Automatic server discovery with smart connection selection
|
||||
- Persistent sessions with auto-login
|
||||
|
||||
@@ -27,19 +27,13 @@ Coming soon
|
||||
- Advanced search across all media
|
||||
- Season and episode navigation
|
||||
|
||||
### 🎬 Video Playback (MediaKit/mpv)
|
||||
### 🎬 Video Playback
|
||||
- Wide codec support including HEVC, AV1, VP9, and more
|
||||
- Advanced subtitle rendering with full ASS/SSA support
|
||||
- Audio and subtitle track selection with user profile preferences
|
||||
- Playback progress sync and resume functionality
|
||||
- Auto-play next episode
|
||||
|
||||
### 🎨 User Experience
|
||||
- Material Design 3 with dark theme
|
||||
- Custom controls and context menus
|
||||
- Desktop window management with custom macOS titlebar
|
||||
- Fullscreen support with adaptive orientation
|
||||
|
||||
## Platform Support
|
||||
|
||||
- ✅ macOS
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import java.util.Properties
|
||||
import java.io.FileInputStream
|
||||
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
@@ -29,11 +32,29 @@ android {
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
val keystoreProperties = Properties()
|
||||
keystoreProperties.load(FileInputStream(keystorePropertiesFile))
|
||||
|
||||
keyAlias = keystoreProperties["keyAlias"] as String
|
||||
keyPassword = keystoreProperties["keyPassword"] as String
|
||||
storeFile = file(keystoreProperties["storeFile"] as String)
|
||||
storePassword = keystoreProperties["storePassword"] as String
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
// Only use release signing if key.properties exists (not in CI/CD)
|
||||
val keystorePropertiesFile = rootProject.file("key.properties")
|
||||
if (keystorePropertiesFile.exists()) {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
}
|
||||
// If key.properties doesn't exist, it will use debug signing for CI builds
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Internet access permissions -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
|
||||
<!-- Media access permissions (Android 13 or higher) -->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
|
||||
|
||||
<!-- Storage access permissions (Android 12 or lower) -->
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<!-- Explicitly remove media permissions that media_kit may add -->
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_AUDIO" tools:node="remove" />
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" tools:node="remove" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />
|
||||
|
||||
<application
|
||||
android:label="Plezy"
|
||||
|
||||
@@ -473,11 +473,13 @@
|
||||
DEVELOPMENT_TEAM = G88U5B5783;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Plezy;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.edde746.plezy;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -657,11 +659,13 @@
|
||||
DEVELOPMENT_TEAM = G88U5B5783;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Plezy;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.edde746.plezy;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
@@ -681,11 +685,13 @@
|
||||
DEVELOPMENT_TEAM = G88U5B5783;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
INFOPLIST_KEY_CFBundleDisplayName = Plezy;
|
||||
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.entertainment";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.edde746.plezy;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
|
||||
class PlexConfig {
|
||||
final String baseUrl;
|
||||
final String? token;
|
||||
@@ -12,13 +14,35 @@ class PlexConfig {
|
||||
required this.baseUrl,
|
||||
this.token,
|
||||
required this.clientIdentifier,
|
||||
this.product = 'Plezy',
|
||||
this.version = '1.0.0',
|
||||
required this.product,
|
||||
required this.version,
|
||||
this.platform = 'Flutter',
|
||||
this.device,
|
||||
this.acceptJson = true,
|
||||
});
|
||||
|
||||
static Future<PlexConfig> create({
|
||||
required String baseUrl,
|
||||
String? token,
|
||||
required String clientIdentifier,
|
||||
String? product,
|
||||
String? platform,
|
||||
String? device,
|
||||
bool acceptJson = true,
|
||||
}) async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
return PlexConfig(
|
||||
baseUrl: baseUrl,
|
||||
token: token,
|
||||
clientIdentifier: clientIdentifier,
|
||||
product: product ?? 'Plezy',
|
||||
version: packageInfo.version,
|
||||
platform: platform ?? 'Flutter',
|
||||
device: device,
|
||||
acceptJson: acceptJson,
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, String> get headers {
|
||||
final headers = {
|
||||
'X-Plex-Client-Identifier': clientIdentifier,
|
||||
|
||||
+1
-1
@@ -105,7 +105,7 @@ class _SetupScreenState extends State<SetupScreen> {
|
||||
await storage.saveServerUrl(connection.uri);
|
||||
|
||||
// Create client with working connection
|
||||
final config = PlexConfig(
|
||||
final config = await PlexConfig.create(
|
||||
baseUrl: connection.uri,
|
||||
token: server.accessToken,
|
||||
clientIdentifier: clientId,
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../widgets/app_bar_back_button.dart';
|
||||
|
||||
class AboutScreen extends StatefulWidget {
|
||||
const AboutScreen({super.key});
|
||||
|
||||
@override
|
||||
State<AboutScreen> createState() => _AboutScreenState();
|
||||
}
|
||||
|
||||
class _AboutScreenState extends State<AboutScreen> {
|
||||
String _appName = '';
|
||||
String _appVersion = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadPackageInfo();
|
||||
}
|
||||
|
||||
Future<void> _loadPackageInfo() async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
setState(() {
|
||||
_appName = 'Plezy';
|
||||
_appVersion = packageInfo.version;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final appName = _appName;
|
||||
final appVersion = _appVersion;
|
||||
|
||||
return Scaffold(
|
||||
body: CustomScrollView(
|
||||
slivers: [
|
||||
DesktopSliverAppBar(
|
||||
title: const Text('About'),
|
||||
pinned: true,
|
||||
leading: const AppBarBackButton(
|
||||
style: BackButtonStyle.circular,
|
||||
),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildListDelegate([
|
||||
// App Icon and Name
|
||||
Center(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 24),
|
||||
Image.asset(
|
||||
'assets/plezy.png',
|
||||
width: 80,
|
||||
height: 80,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
appName,
|
||||
style: Theme.of(context).textTheme.headlineMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
'Version $appVersion',
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
'A beautiful Plex client for Flutter',
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 40),
|
||||
|
||||
// Open Source Licenses
|
||||
Card(
|
||||
child: ListTile(
|
||||
leading: const Icon(Icons.description),
|
||||
title: const Text('Open Source Licenses'),
|
||||
subtitle: const Text('View licenses of third-party libraries'),
|
||||
trailing: const Icon(Icons.chevron_right),
|
||||
onTap: () {
|
||||
showLicensePage(
|
||||
context: context,
|
||||
applicationName: appName,
|
||||
applicationVersion: appVersion,
|
||||
applicationIcon: Image.asset(
|
||||
'assets/plezy.png',
|
||||
width: 48,
|
||||
height: 48,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// Key Dependencies
|
||||
Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Key Dependencies',
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildDependencyItem('http', 'HTTP networking'),
|
||||
_buildDependencyItem('dio', 'Advanced HTTP client'),
|
||||
_buildDependencyItem('cached_network_image', 'Image caching'),
|
||||
_buildDependencyItem('media_kit', 'Video playback'),
|
||||
_buildDependencyItem('shared_preferences', 'Local storage'),
|
||||
_buildDependencyItem('xml', 'XML parsing'),
|
||||
_buildDependencyItem('url_launcher', 'External links'),
|
||||
_buildDependencyItem(
|
||||
'window_manager',
|
||||
'Desktop window management',
|
||||
),
|
||||
_buildDependencyItem(
|
||||
'macos_window_utils',
|
||||
'macOS window controls',
|
||||
),
|
||||
_buildDependencyItem('logger', 'Logging'),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
]),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDependencyItem(String name, String description) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.circle, size: 6),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text: name,
|
||||
style: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
TextSpan(
|
||||
text: ' - $description',
|
||||
style: const TextStyle(color: Colors.grey),
|
||||
),
|
||||
],
|
||||
style: const TextStyle(fontSize: 13, color: Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
bool _isAuthenticating = false;
|
||||
String? _errorMessage;
|
||||
late PlexAuthService _authService;
|
||||
bool _shouldCancelPolling = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -30,6 +31,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
setState(() {
|
||||
_isAuthenticating = true;
|
||||
_errorMessage = null;
|
||||
_shouldCancelPolling = false;
|
||||
});
|
||||
|
||||
try {
|
||||
@@ -49,8 +51,16 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
throw Exception('Could not launch auth URL');
|
||||
}
|
||||
|
||||
// Poll for authentication
|
||||
final token = await _authService.pollPinUntilClaimed(pinId);
|
||||
// Poll for authentication with cancellation support
|
||||
final token = await _authService.pollPinUntilClaimed(
|
||||
pinId,
|
||||
shouldCancel: () => _shouldCancelPolling,
|
||||
);
|
||||
|
||||
// If polling was cancelled, don't show error
|
||||
if (_shouldCancelPolling) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (token == null) {
|
||||
setState(() {
|
||||
@@ -60,6 +70,13 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
return;
|
||||
}
|
||||
|
||||
// Auto-close the in-app browser on mobile (no-op on desktop)
|
||||
try {
|
||||
await closeInAppWebView();
|
||||
} catch (e) {
|
||||
// Ignore errors - browser might already be closed or on desktop
|
||||
}
|
||||
|
||||
// Store the token
|
||||
final storage = await StorageService.getInstance();
|
||||
await storage.savePlexToken(token);
|
||||
@@ -84,6 +101,15 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
void _retryAuthentication() {
|
||||
setState(() {
|
||||
_shouldCancelPolling = true;
|
||||
_isAuthenticating = false;
|
||||
});
|
||||
// Start new authentication after a brief delay to ensure cleanup
|
||||
Future.delayed(const Duration(milliseconds: 100), _startAuthentication);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -95,10 +121,10 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.video_library,
|
||||
size: 80,
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
Image.asset(
|
||||
'assets/plezy.png',
|
||||
width: 120,
|
||||
height: 120,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
Text(
|
||||
@@ -117,6 +143,14 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
OutlinedButton(
|
||||
onPressed: _retryAuthentication,
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
),
|
||||
child: const Text('Retry'),
|
||||
),
|
||||
] else ...[
|
||||
ElevatedButton(
|
||||
onPressed: _startAuthentication,
|
||||
|
||||
@@ -14,6 +14,7 @@ import '../mixins/refreshable.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import 'video_player_screen.dart';
|
||||
import 'main_screen.dart';
|
||||
import 'about_screen.dart';
|
||||
|
||||
class DiscoverScreen extends StatefulWidget {
|
||||
final PlexClient client;
|
||||
@@ -265,7 +266,7 @@ class _DiscoverScreenState extends State<DiscoverScreen> with Refreshable {
|
||||
}
|
||||
|
||||
// Create new client
|
||||
final config = PlexConfig(
|
||||
final config = await PlexConfig.create(
|
||||
baseUrl: connection.uri,
|
||||
token: server.accessToken,
|
||||
clientIdentifier: clientId,
|
||||
@@ -336,6 +337,13 @@ class _DiscoverScreenState extends State<DiscoverScreen> with Refreshable {
|
||||
_handleSwitchServer();
|
||||
} else if (value == 'logout') {
|
||||
_handleLogout();
|
||||
} else if (value == 'about') {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const AboutScreen(),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
@@ -349,6 +357,16 @@ class _DiscoverScreenState extends State<DiscoverScreen> with Refreshable {
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'about',
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.info_outline),
|
||||
SizedBox(width: 8),
|
||||
Text('About'),
|
||||
],
|
||||
),
|
||||
),
|
||||
const PopupMenuItem(
|
||||
value: 'logout',
|
||||
child: Row(
|
||||
@@ -610,6 +628,7 @@ class _DiscoverScreenState extends State<DiscoverScreen> with Refreshable {
|
||||
imageUrl: widget.client.getThumbnailUrl(
|
||||
heroItem.clearLogo,
|
||||
),
|
||||
filterQuality: FilterQuality.medium,
|
||||
fit: BoxFit.contain,
|
||||
alignment: Alignment.centerLeft,
|
||||
placeholder: (context, url) => Align(
|
||||
|
||||
@@ -6,6 +6,7 @@ import '../models/plex_filter.dart';
|
||||
import '../models/plex_user_profile.dart';
|
||||
import '../widgets/media_card.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../widgets/app_bar_back_button.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../mixins/refreshable.dart';
|
||||
|
||||
@@ -518,8 +519,8 @@ class _FiltersBottomSheetState extends State<_FiltersBottomSheet> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
AppBarBackButton(
|
||||
style: BackButtonStyle.plain,
|
||||
onPressed: _goBack,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
|
||||
@@ -4,6 +4,7 @@ import '../client/plex_client.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../models/plex_user_profile.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../widgets/app_bar_back_button.dart';
|
||||
import '../widgets/media_context_menu.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import 'season_detail_screen.dart';
|
||||
@@ -196,19 +197,8 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
DesktopSliverAppBar(
|
||||
expandedHeight: headerHeight,
|
||||
pinned: true,
|
||||
leading: SafeArea(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.5),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
),
|
||||
leading: const AppBarBackButton(
|
||||
style: BackButtonStyle.circular,
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Stack(
|
||||
@@ -274,6 +264,7 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> {
|
||||
imageUrl: widget.client.getThumbnailUrl(
|
||||
metadata.clearLogo,
|
||||
),
|
||||
filterQuality: FilterQuality.medium,
|
||||
fit: BoxFit.contain,
|
||||
alignment: Alignment.centerLeft,
|
||||
placeholder: (context, url) => Align(
|
||||
|
||||
@@ -4,6 +4,7 @@ import '../client/plex_client.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../models/plex_user_profile.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../widgets/app_bar_back_button.dart';
|
||||
import 'video_player_screen.dart';
|
||||
|
||||
class SeasonDetailScreen extends StatefulWidget {
|
||||
@@ -58,17 +59,8 @@ class _SeasonDetailScreenState extends State<SeasonDetailScreen> {
|
||||
DesktopSliverAppBar(
|
||||
title: Text(widget.season.title),
|
||||
pinned: true,
|
||||
leading: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.5),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
leading: const AppBarBackButton(
|
||||
style: BackButtonStyle.circular,
|
||||
),
|
||||
),
|
||||
if (_isLoadingEpisodes)
|
||||
@@ -363,9 +355,9 @@ class _SeasonDetailScreenState extends State<SeasonDetailScreen> {
|
||||
final seconds = duration.inSeconds.remainder(60);
|
||||
|
||||
if (hours > 0) {
|
||||
return '${hours}:${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
return '$hours:${minutes.toString().padLeft(2, '0')}:${seconds.toString().padLeft(2, '0')}';
|
||||
} else {
|
||||
return '${minutes}:${seconds.toString().padLeft(2, '0')}';
|
||||
return '$minutes:${seconds.toString().padLeft(2, '0')}';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import '../services/storage_service.dart';
|
||||
import '../client/plex_client.dart';
|
||||
import '../config/plex_config.dart';
|
||||
import '../widgets/server_list_tile.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import 'main_screen.dart';
|
||||
|
||||
class ServerSelectionScreen extends StatefulWidget {
|
||||
@@ -96,7 +97,7 @@ class _ServerSelectionScreenState extends State<ServerSelectionScreen> {
|
||||
storage.getClientIdentifier() ?? widget.authService.clientIdentifier;
|
||||
|
||||
// Create client and navigate to main app
|
||||
final config = PlexConfig(
|
||||
final config = await PlexConfig.create(
|
||||
baseUrl: connection.uri,
|
||||
token: server.accessToken,
|
||||
clientIdentifier: clientId,
|
||||
@@ -114,7 +115,7 @@ class _ServerSelectionScreenState extends State<ServerSelectionScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Select Server')),
|
||||
appBar: const DesktopAppBar(title: Text('Select Server')),
|
||||
body: _isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: _errorMessage != null
|
||||
|
||||
@@ -109,11 +109,17 @@ class PlexAuthService {
|
||||
/// Poll the PIN until it's claimed or timeout
|
||||
Future<String?> pollPinUntilClaimed(
|
||||
int pinId, {
|
||||
Duration timeout = const Duration(minutes: 5),
|
||||
Duration timeout = const Duration(minutes: 2),
|
||||
bool Function()? shouldCancel,
|
||||
}) async {
|
||||
final endTime = DateTime.now().add(timeout);
|
||||
|
||||
while (DateTime.now().isBefore(endTime)) {
|
||||
// Check if polling should be cancelled
|
||||
if (shouldCancel != null && shouldCancel()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final token = await checkPin(pinId);
|
||||
if (token != null) {
|
||||
return token;
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/material.dart';
|
||||
import '../services/fullscreen_state_manager.dart';
|
||||
|
||||
/// Padding values for desktop window controls
|
||||
class DesktopWindowPadding {
|
||||
/// Left padding for macOS traffic lights (normal window mode)
|
||||
static const double macOSLeft = 80.0;
|
||||
|
||||
/// Left padding for macOS in fullscreen (reduced since traffic lights auto-hide)
|
||||
static const double macOSLeftFullscreen = 0.0;
|
||||
|
||||
/// Right padding for macOS to prevent actions from being too close to edge
|
||||
static const double macOSRight = 16.0;
|
||||
}
|
||||
|
||||
/// Helper class for adjusting app bar widgets to account for desktop window controls
|
||||
class DesktopAppBarHelper {
|
||||
/// Builds actions list with appropriate right padding for macOS
|
||||
static List<Widget>? buildAdjustedActions(List<Widget>? actions) {
|
||||
if (!Platform.isMacOS) {
|
||||
return actions;
|
||||
}
|
||||
|
||||
// macOS: Add padding to keep actions away from edge
|
||||
if (actions != null) {
|
||||
return [
|
||||
...actions,
|
||||
SizedBox(width: DesktopWindowPadding.macOSRight),
|
||||
];
|
||||
} else {
|
||||
return [SizedBox(width: DesktopWindowPadding.macOSRight)];
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds leading widget with appropriate left padding for macOS traffic lights
|
||||
///
|
||||
/// [includeGestureDetector] - If true, wraps in GestureDetector to prevent window dragging
|
||||
static Widget? buildAdjustedLeading(
|
||||
Widget? leading, {
|
||||
bool includeGestureDetector = false,
|
||||
}) {
|
||||
if (!Platform.isMacOS || leading == null) {
|
||||
return leading;
|
||||
}
|
||||
|
||||
return ListenableBuilder(
|
||||
listenable: FullscreenStateManager(),
|
||||
builder: (context, _) {
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
final leftPadding = isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft;
|
||||
|
||||
final paddedWidget = Padding(
|
||||
padding: EdgeInsets.only(left: leftPadding),
|
||||
child: leading,
|
||||
);
|
||||
|
||||
if (includeGestureDetector) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPanDown: (_) {}, // Consume pan gestures to prevent window dragging
|
||||
child: paddedWidget,
|
||||
);
|
||||
}
|
||||
|
||||
return paddedWidget;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds flexible space with gesture detector on macOS to prevent window dragging
|
||||
static Widget? buildAdjustedFlexibleSpace(Widget? flexibleSpace) {
|
||||
if (!Platform.isMacOS || flexibleSpace == null) {
|
||||
return flexibleSpace;
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onPanDown: (_) {}, // Consume pan gestures to prevent window dragging
|
||||
child: flexibleSpace,
|
||||
);
|
||||
}
|
||||
|
||||
/// Calculates the leading width for SliverAppBar to account for macOS traffic lights
|
||||
static double? calculateLeadingWidth(Widget? leading) {
|
||||
if (!Platform.isMacOS || leading == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
final leftPadding = isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft;
|
||||
return leftPadding + kToolbarHeight;
|
||||
}
|
||||
|
||||
/// Wraps a widget with GestureDetector on macOS to prevent window dragging
|
||||
static Widget wrapWithGestureDetector(Widget child) {
|
||||
if (!Platform.isMacOS) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onPanDown: (_) {}, // Consume pan gestures to prevent window dragging
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// A widget that adds padding to account for desktop window controls.
|
||||
/// On macOS, adds left padding for traffic lights (reduced in fullscreen).
|
||||
class DesktopTitleBarPadding extends StatelessWidget {
|
||||
final Widget child;
|
||||
final double? leftPadding;
|
||||
final double? rightPadding;
|
||||
|
||||
const DesktopTitleBarPadding({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.leftPadding,
|
||||
this.rightPadding,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!Platform.isMacOS) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return ListenableBuilder(
|
||||
listenable: FullscreenStateManager(),
|
||||
builder: (context, _) {
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
// In fullscreen, use minimal padding since traffic lights auto-hide
|
||||
final left = leftPadding ??
|
||||
(isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft);
|
||||
final right = rightPadding ?? 0.0;
|
||||
|
||||
if (left == 0.0 && right == 0.0) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: left, right: right),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Defines the visual style of the back button
|
||||
enum BackButtonStyle {
|
||||
/// Back button with circular semi-transparent background (used in detail screens)
|
||||
circular,
|
||||
|
||||
/// Plain back button without background (used in sheets and simple contexts)
|
||||
plain,
|
||||
|
||||
/// Back button styled for video player overlay
|
||||
video,
|
||||
}
|
||||
|
||||
/// A reusable back button widget that provides consistent styling across the app.
|
||||
///
|
||||
/// This widget supports different visual styles through [BackButtonStyle] enum:
|
||||
/// - [BackButtonStyle.circular]: Semi-transparent circular background for detail screens
|
||||
/// - [BackButtonStyle.plain]: Simple IconButton for sheets and simple contexts
|
||||
/// - [BackButtonStyle.video]: Styled for video player overlay
|
||||
///
|
||||
/// Example usage:
|
||||
/// ```dart
|
||||
/// AppBarBackButton(style: BackButtonStyle.circular)
|
||||
/// ```
|
||||
class AppBarBackButton extends StatelessWidget {
|
||||
/// Creates a back button with the specified style.
|
||||
///
|
||||
/// [style] determines the visual appearance of the back button.
|
||||
/// [onPressed] is called when the button is tapped. If null, defaults to Navigator.pop.
|
||||
/// [color] overrides the default icon color. If null, uses white for circular/video, theme default for plain.
|
||||
const AppBarBackButton({
|
||||
super.key,
|
||||
this.style = BackButtonStyle.circular,
|
||||
this.onPressed,
|
||||
this.color,
|
||||
});
|
||||
|
||||
/// The visual style of the back button
|
||||
final BackButtonStyle style;
|
||||
|
||||
/// Callback when the button is pressed. Defaults to Navigator.of(context).pop()
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
/// The color of the back arrow icon. If null, uses style-appropriate default.
|
||||
final Color? color;
|
||||
|
||||
void _handlePressed(BuildContext context) {
|
||||
if (onPressed != null) {
|
||||
onPressed!();
|
||||
} else {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
switch (style) {
|
||||
case BackButtonStyle.circular:
|
||||
return _buildCircularBackButton(context);
|
||||
case BackButtonStyle.plain:
|
||||
return _buildPlainBackButton(context);
|
||||
case BackButtonStyle.video:
|
||||
return _buildVideoBackButton(context);
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds a back button with circular semi-transparent background
|
||||
Widget _buildCircularBackButton(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
margin: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withValues(alpha: 0.5),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: color ?? Colors.white),
|
||||
onPressed: () => _handlePressed(context),
|
||||
padding: EdgeInsets.zero,
|
||||
tooltip: 'Back',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds a plain back button without background
|
||||
Widget _buildPlainBackButton(BuildContext context) {
|
||||
return IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: color),
|
||||
onPressed: () => _handlePressed(context),
|
||||
tooltip: 'Back',
|
||||
);
|
||||
}
|
||||
|
||||
/// Builds a back button styled for video player overlay
|
||||
Widget _buildVideoBackButton(BuildContext context) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(left: 8),
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: color ?? Colors.white),
|
||||
onPressed: () => _handlePressed(context),
|
||||
tooltip: 'Back',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +1,5 @@
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/material.dart';
|
||||
import '../services/fullscreen_state_manager.dart';
|
||||
|
||||
class DesktopWindowPadding {
|
||||
/// Left padding for macOS traffic lights (normal window mode)
|
||||
static const double macOSLeft = 80.0;
|
||||
|
||||
/// Left padding for macOS in fullscreen (reduced since traffic lights auto-hide)
|
||||
static const double macOSLeftFullscreen = 0.0;
|
||||
|
||||
/// Right padding for macOS to prevent actions from being too close to edge
|
||||
static const double macOSRight = 16.0;
|
||||
}
|
||||
|
||||
/// A widget that adds padding to account for desktop window controls.
|
||||
/// On macOS, adds left padding for traffic lights (reduced in fullscreen).
|
||||
class DesktopTitleBarPadding extends StatelessWidget {
|
||||
final Widget child;
|
||||
final double? leftPadding;
|
||||
final double? rightPadding;
|
||||
|
||||
const DesktopTitleBarPadding({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.leftPadding,
|
||||
this.rightPadding,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListenableBuilder(
|
||||
listenable: FullscreenStateManager(),
|
||||
builder: (context, _) {
|
||||
double left = 0.0;
|
||||
double right = 0.0;
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
// In fullscreen, use minimal padding since traffic lights auto-hide
|
||||
left =
|
||||
leftPadding ??
|
||||
(isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft);
|
||||
}
|
||||
|
||||
if (left == 0.0 && right == 0.0) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: left, right: right),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
import '../utils/desktop_window_padding.dart';
|
||||
|
||||
/// A custom app bar that automatically handles desktop window controls spacing.
|
||||
/// Use this instead of AppBar for consistent desktop platform behavior.
|
||||
@@ -86,43 +29,10 @@ class DesktopAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Add right padding for desktop platforms
|
||||
List<Widget>? adjustedActions = actions;
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
// macOS: Add padding to keep actions away from edge
|
||||
if (actions != null) {
|
||||
adjustedActions = [
|
||||
...actions!,
|
||||
SizedBox(width: DesktopWindowPadding.macOSRight),
|
||||
];
|
||||
} else {
|
||||
adjustedActions = [SizedBox(width: DesktopWindowPadding.macOSRight)];
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap leading widget with padding on macOS to avoid traffic lights
|
||||
Widget? adjustedLeading = leading;
|
||||
if (Platform.isMacOS && leading != null) {
|
||||
adjustedLeading = ListenableBuilder(
|
||||
listenable: FullscreenStateManager(),
|
||||
builder: (context, _) {
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
final leftPadding = isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: leftPadding),
|
||||
child: leading,
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
final appBar = AppBar(
|
||||
title: title != null ? DesktopTitleBarPadding(child: title!) : null,
|
||||
actions: adjustedActions,
|
||||
leading: adjustedLeading,
|
||||
actions: DesktopAppBarHelper.buildAdjustedActions(actions),
|
||||
leading: DesktopAppBarHelper.buildAdjustedLeading(leading),
|
||||
automaticallyImplyLeading: automaticallyImplyLeading,
|
||||
elevation: elevation,
|
||||
backgroundColor: backgroundColor,
|
||||
@@ -131,17 +41,7 @@ class DesktopAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
scrolledUnderElevation: scrolledUnderElevation,
|
||||
);
|
||||
|
||||
// On macOS with transparent titlebar, wrap in GestureDetector to prevent
|
||||
// window dragging and allow buttons to be clickable
|
||||
if (Platform.isMacOS) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onPanDown: (_) {}, // Consume pan gestures to prevent window dragging
|
||||
child: appBar,
|
||||
);
|
||||
}
|
||||
|
||||
return appBar;
|
||||
return DesktopAppBarHelper.wrapWithGestureDetector(appBar);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -186,69 +86,14 @@ class DesktopSliverAppBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Add right padding for desktop platforms
|
||||
List<Widget>? adjustedActions = actions;
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
// macOS: Add padding to keep actions away from edge
|
||||
if (actions != null) {
|
||||
adjustedActions = [
|
||||
...actions!,
|
||||
SizedBox(width: DesktopWindowPadding.macOSRight),
|
||||
];
|
||||
} else {
|
||||
adjustedActions = [SizedBox(width: DesktopWindowPadding.macOSRight)];
|
||||
}
|
||||
}
|
||||
|
||||
// Wrap leading widget with gesture detector and padding on macOS
|
||||
Widget? adjustedLeading = leading;
|
||||
if (Platform.isMacOS && leading != null) {
|
||||
adjustedLeading = ListenableBuilder(
|
||||
listenable: FullscreenStateManager(),
|
||||
builder: (context, _) {
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
final leftPadding = isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft;
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPanDown:
|
||||
(_) {}, // Consume pan gestures to prevent window dragging
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(left: leftPadding),
|
||||
child: leading,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// Wrap flexible space with gesture detector on macOS to prevent window dragging
|
||||
Widget? adjustedFlexibleSpace = flexibleSpace;
|
||||
if (Platform.isMacOS && flexibleSpace != null) {
|
||||
adjustedFlexibleSpace = GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onPanDown: (_) {}, // Consume pan gestures to prevent window dragging
|
||||
child: flexibleSpace,
|
||||
);
|
||||
}
|
||||
|
||||
// On macOS, increase leading width to account for traffic light spacing
|
||||
double? leadingWidth;
|
||||
if (Platform.isMacOS && leading != null) {
|
||||
final isFullscreen = FullscreenStateManager().isFullscreen;
|
||||
final leftPadding = isFullscreen
|
||||
? DesktopWindowPadding.macOSLeftFullscreen
|
||||
: DesktopWindowPadding.macOSLeft;
|
||||
leadingWidth = leftPadding + kToolbarHeight;
|
||||
}
|
||||
|
||||
return SliverAppBar(
|
||||
title: title != null ? DesktopTitleBarPadding(child: title!) : null,
|
||||
actions: adjustedActions,
|
||||
leading: adjustedLeading,
|
||||
leadingWidth: leadingWidth,
|
||||
actions: DesktopAppBarHelper.buildAdjustedActions(actions),
|
||||
leading: DesktopAppBarHelper.buildAdjustedLeading(
|
||||
leading,
|
||||
includeGestureDetector: true,
|
||||
),
|
||||
leadingWidth: DesktopAppBarHelper.calculateLeadingWidth(leading),
|
||||
automaticallyImplyLeading: automaticallyImplyLeading,
|
||||
elevation: elevation,
|
||||
backgroundColor: backgroundColor,
|
||||
@@ -258,7 +103,7 @@ class DesktopSliverAppBar extends StatelessWidget {
|
||||
floating: floating,
|
||||
pinned: pinned,
|
||||
expandedHeight: expandedHeight,
|
||||
flexibleSpace: adjustedFlexibleSpace,
|
||||
flexibleSpace: DesktopAppBarHelper.buildAdjustedFlexibleSpace(flexibleSpace),
|
||||
bottom: bottom,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -294,6 +294,7 @@ class _MediaCardState extends State<MediaCard> {
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
filterQuality: FilterQuality.medium,
|
||||
placeholder: (context, url) => Container(
|
||||
color: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:media_kit/media_kit.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:macos_window_utils/macos_window_utils.dart';
|
||||
@@ -8,7 +9,8 @@ import '../client/plex_client.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../models/plex_media_info.dart';
|
||||
import '../services/fullscreen_state_manager.dart';
|
||||
import 'desktop_app_bar.dart';
|
||||
import '../utils/desktop_window_padding.dart';
|
||||
import 'app_bar_back_button.dart';
|
||||
|
||||
/// Custom video controls builder for Plex with chapter, audio, and subtitle support
|
||||
Widget plexVideoControlsBuilder(
|
||||
@@ -54,10 +56,12 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
|
||||
bool _chaptersLoaded = false;
|
||||
Timer? _hideTimer;
|
||||
bool _isFullscreen = false;
|
||||
late final FocusNode _focusNode;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_focusNode = FocusNode();
|
||||
_loadChapters();
|
||||
_startHideTimer();
|
||||
// Add window listener for tracking fullscreen state (for button icon)
|
||||
@@ -69,6 +73,7 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
|
||||
@override
|
||||
void dispose() {
|
||||
_hideTimer?.cancel();
|
||||
_focusNode.dispose();
|
||||
// Remove window listener
|
||||
if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
|
||||
windowManager.removeListener(this);
|
||||
@@ -221,75 +226,121 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
|
||||
|
||||
Future<void> _toggleFullscreen() async {
|
||||
if (!_isMobile(context)) {
|
||||
setState(() {
|
||||
_isFullscreen = !_isFullscreen;
|
||||
});
|
||||
// Query actual window state to determine what action to take
|
||||
// This ensures we always toggle correctly regardless of local state
|
||||
final isCurrentlyFullscreen = await windowManager.isFullScreen();
|
||||
|
||||
if (Platform.isMacOS) {
|
||||
// Use native macOS fullscreen - titlebar is handled automatically
|
||||
if (_isFullscreen) {
|
||||
await WindowManipulator.enterFullscreen();
|
||||
} else {
|
||||
// Window listener will update _isFullscreen for UI
|
||||
if (isCurrentlyFullscreen) {
|
||||
await WindowManipulator.exitFullscreen();
|
||||
} else {
|
||||
await WindowManipulator.enterFullscreen();
|
||||
}
|
||||
} else {
|
||||
// For Windows/Linux, use window_manager
|
||||
if (_isFullscreen) {
|
||||
await windowManager.setFullScreen(true);
|
||||
} else {
|
||||
// Window listener will update _isFullscreen for UI
|
||||
if (isCurrentlyFullscreen) {
|
||||
await windowManager.setFullScreen(false);
|
||||
} else {
|
||||
await windowManager.setFullScreen(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void _togglePlayPause() {
|
||||
final isPlaying = widget.player.state.playing;
|
||||
if (isPlaying) {
|
||||
widget.player.pause();
|
||||
_hideTimer?.cancel(); // Cancel auto-hide when paused
|
||||
} else {
|
||||
widget.player.play();
|
||||
_startHideTimer(); // Start auto-hide when playing
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isMobile = _isMobile(context);
|
||||
|
||||
return Stack(
|
||||
children: [
|
||||
// Invisible tap detector that always covers the full area
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: _toggleControls,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(color: Colors.transparent),
|
||||
return Focus(
|
||||
focusNode: _focusNode,
|
||||
autofocus: true,
|
||||
onKeyEvent: (node, event) {
|
||||
// Only respond to key down events (not key up)
|
||||
if (event is KeyDownEvent) {
|
||||
// Handle spacebar for play/pause
|
||||
if (event.logicalKey == LogicalKeyboardKey.space) {
|
||||
_togglePlayPause();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: MouseRegion(
|
||||
cursor: _showControls ? SystemMouseCursors.basic : SystemMouseCursors.none,
|
||||
onHover: (_) {
|
||||
// Show controls when mouse moves
|
||||
if (!_showControls) {
|
||||
setState(() {
|
||||
_showControls = true;
|
||||
});
|
||||
_startHideTimer();
|
||||
// On macOS, show traffic lights when controls appear
|
||||
if (Platform.isMacOS) {
|
||||
_updateTrafficLightVisibility();
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
// Invisible tap detector that always covers the full area
|
||||
Positioned.fill(
|
||||
child: GestureDetector(
|
||||
onTap: _toggleControls,
|
||||
onDoubleTap: _toggleFullscreen,
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Container(color: Colors.transparent),
|
||||
),
|
||||
),
|
||||
),
|
||||
// Custom controls overlay - use AnimatedOpacity to keep widget tree alive
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
ignoring: !_showControls,
|
||||
child: AnimatedOpacity(
|
||||
opacity: _showControls ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: GestureDetector(
|
||||
onTap: _toggleControls,
|
||||
behavior: HitTestBehavior.deferToChild,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.black.withValues(alpha: 0.7),
|
||||
Colors.transparent,
|
||||
Colors.transparent,
|
||||
Colors.black.withValues(alpha: 0.7),
|
||||
],
|
||||
stops: const [0.0, 0.2, 0.8, 1.0],
|
||||
// Custom controls overlay - use AnimatedOpacity to keep widget tree alive
|
||||
Positioned.fill(
|
||||
child: IgnorePointer(
|
||||
ignoring: !_showControls,
|
||||
child: AnimatedOpacity(
|
||||
opacity: _showControls ? 1.0 : 0.0,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: GestureDetector(
|
||||
onTap: _toggleControls,
|
||||
onDoubleTap: _toggleFullscreen,
|
||||
behavior: HitTestBehavior.deferToChild,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.black.withValues(alpha: 0.7),
|
||||
Colors.transparent,
|
||||
Colors.transparent,
|
||||
Colors.black.withValues(alpha: 0.7),
|
||||
],
|
||||
stops: const [0.0, 0.2, 0.8, 1.0],
|
||||
),
|
||||
),
|
||||
child: isMobile
|
||||
? _buildMobileLayout()
|
||||
: _buildDesktopLayout(),
|
||||
),
|
||||
child: isMobile
|
||||
? _buildMobileLayout()
|
||||
: _buildDesktopLayout(),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -326,8 +377,8 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
AppBarBackButton(
|
||||
style: BackButtonStyle.video,
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
@@ -547,8 +598,8 @@ class _PlexVideoControlsState extends State<PlexVideoControls>
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
AppBarBackButton(
|
||||
style: BackButtonStyle.video,
|
||||
onPressed: () => Navigator.of(context).pop(true),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
|
||||
+41
-1
@@ -294,6 +294,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.0"
|
||||
flutter_svg:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_svg
|
||||
sha256: b9c2ad5872518a27507ab432d1fb97e8813b05f0fc693f9d40fad06d073e0678
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.1"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -554,7 +562,7 @@ packages:
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
package_info_plus:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info_plus
|
||||
sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d
|
||||
@@ -577,6 +585,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
path_parsing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: path_parsing
|
||||
sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
path_provider:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1062,6 +1078,30 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.5.1"
|
||||
vector_graphics:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics
|
||||
sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.19"
|
||||
vector_graphics_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_codec
|
||||
sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.13"
|
||||
vector_graphics_compiler:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics_compiler
|
||||
sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.19"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+4
-1
@@ -1,7 +1,7 @@
|
||||
name: plezy
|
||||
description: "A beautiful Plex client for Flutter"
|
||||
publish_to: "none"
|
||||
version: 0.1.0
|
||||
version: 1.0.1+3
|
||||
|
||||
environment:
|
||||
sdk: ^3.8.1
|
||||
@@ -24,6 +24,8 @@ dependencies:
|
||||
uuid: ^4.4.0
|
||||
window_manager: ^0.4.3
|
||||
logger: ^2.0.2
|
||||
flutter_svg: ^2.0.10
|
||||
package_info_plus: ^9.0.0
|
||||
|
||||
dependency_overrides:
|
||||
media_kit:
|
||||
@@ -43,6 +45,7 @@ flutter:
|
||||
uses-material-design: true
|
||||
assets:
|
||||
- lib/data/iso_639_codes.json
|
||||
- assets/plezy.png
|
||||
|
||||
flutter_launcher_icons:
|
||||
android: true
|
||||
|
||||
Reference in New Issue
Block a user