(fix): [Desktop] Set minimum window size to prevent reactive overflow issues (#416)

* (flutter): Added window_size package for desktop
* (tweak): [UI] Highlight active profile in profile switcher popup menus
* (fix): [Desktop] Set minimum window size to prevent reactive overflow issues
* (tweak): [Radarr] Add headers for sections in disk space
* (tweak): [macOS] Reduce minimum window dimension to 400px
This commit is contained in:
Jagandeep Brar
2021-04-11 16:42:09 -05:00
committed by GitHub
parent 42dc7aaaa5
commit 333bc458a0
14 changed files with 83 additions and 20 deletions

View File

@@ -7,6 +7,7 @@
- `[Radarr/System Status]` Show root folders on the disk space page
#### TWEAKS
- `[UI/UX]` Highlight active profile in profile switcher popup menus
#### FIXES
- `[Radarr/Catalogue]` Update filters to more closely match the web GUI filtering
@@ -19,6 +20,7 @@
- `[macOS]` (new) Enabled notification support
- `[macOS]` (new) Enable hardening runtime and set development signing certificate
- `[macOS]` (tweak) Set minimum macOS version to 10.14 (Mojave)
- `[macOS]` (fix) Set minimum window size to prevent reactive overflow issues
- `[macOS]` (fix) Updated about dialog to have correct information
- `[macOS]` (fix) Set application/window title
- `[macOS]` (fix) Add platform compatability checks for all native linking packages

View File

@@ -1,3 +1,4 @@
export 'system/desktop_window.dart';
export 'system/firebase.dart';
export 'system/image_cache.dart';
export 'system/in_app_purchases.dart';

View File

@@ -0,0 +1,16 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:window_size/window_size.dart' as WindowSize;
class LunaDesktopWindow {
static const double _MINIMUM_WINDOW_SIZE = 400;
static bool get isPlatformCompatible => Platform.isWindows || Platform.isMacOS || Platform.isLinux;
/// Initialize the Desktop window:
/// - Sets the minimum window size
void initialize() {
if(isPlatformCompatible) {
WindowSize.setWindowMinSize(Size(_MINIMUM_WINDOW_SIZE, _MINIMUM_WINDOW_SIZE));
}
}
}

View File

@@ -272,6 +272,9 @@ class _State extends State<LunaAppBar> {
profile,
style: TextStyle(
fontSize: LunaUI.FONT_SIZE_SUBTITLE,
color: (LunaDatabaseValue.ENABLED_PROFILE.data ?? 'default') == profile
? LunaColours.accent
: Colors.white,
),
),
)];

View File

@@ -38,6 +38,9 @@ class LunaDrawerHeader extends UserAccountsDrawerHeader {
profile,
style: TextStyle(
fontSize: LunaUI.FONT_SIZE_SUBTITLE,
color: (LunaDatabaseValue.ENABLED_PROFILE.data ?? 'default') == profile
? LunaColours.accent
: Colors.white,
),
),
)];

View File

@@ -3,6 +3,16 @@ import 'package:flutter/services.dart';
import 'package:lunasea/core.dart';
class LunaTheme {
/// Initialize the theme by setting the system navigation and system colours.
void intialize() {
//Set system UI overlay style (navbar, statusbar)
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
systemNavigationBarDividerColor: Colors.black,
statusBarColor: Colors.transparent,
));
}
/// Returns the active [ThemeData] by checking the theme database value.
ThemeData activeTheme() {
return isAMOLEDTheme ? _pureBlackTheme() : _midnightTheme();

View File

@@ -1,8 +1,6 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:lunasea/core.dart';
/// LunaSea Entry Point: Initialize & Run Application
@@ -37,18 +35,12 @@ Future<void> main() async {
/// - Database
Future<void> _init() async {
WidgetsFlutterBinding.ensureInitialized();
//Set system UI overlay style (navbar, statusbar)
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
systemNavigationBarColor: Colors.black,
systemNavigationBarDividerColor: Colors.black,
statusBarColor: Colors.transparent,
));
// Set window-related things for Desktop
if(Platform.isWindows || Platform.isMacOS || Platform.isLinux) {}
//LunaSea initialization
await Database().initialize();
await LunaFirebase().initialize();
LunaLogger().initialize();
LunaTheme().intialize();
LunaDesktopWindow().initialize();
LunaNetworking().initialize();
LunaImageCache().initialize();
LunaRouter().intialize();

View File

@@ -67,18 +67,29 @@ class _State extends State<RadarrSystemStatusDiskSpacePage> with AutomaticKeepAl
buttonText: 'Try Again',
onTap: _refreshKey.currentState.show,
);
// Compile Disks
List<Widget> _disks = [LunaMessage.inList(text: 'No Disks Found')];
if((diskSpace?.length ?? 0) != 0) _disks = [
LunaHeader(text: 'Disks'),
...List.generate(
diskSpace.length,
(index) => RadarrDiskSpaceTile(diskSpace: diskSpace[index]),
),
];
// Compile root folders
List<Widget> _rootFolders = [LunaMessage.inList(text: 'No Root Folders Found')];
if((rootFolders?.length ?? 0) != 0) _rootFolders = [
LunaHeader(text: 'Root Folders'),
...List.generate(
rootFolders.length,
(index) => RadarrDiskSpaceTile(rootFolder: rootFolders[index]),
),
];
return LunaListView(
controller: RadarrSystemStatusNavigationBar.scrollControllers[1],
children: [
if((diskSpace?.length ?? 0) != 0) ...List.generate(
diskSpace.length,
(index) => RadarrDiskSpaceTile(diskSpace: diskSpace[index]),
),
if((diskSpace?.length ?? 0) != 0 && (rootFolders?.length ?? 0) != 0) LunaDivider(),
if((rootFolders?.length ?? 0) != 0) ...List.generate(
rootFolders.length,
(index) => RadarrDiskSpaceTile(rootFolder: rootFolders[index]),
),
..._disks,
..._rootFolders,
],
);
}

View File

@@ -32,7 +32,7 @@ class RadarrDiskSpaceTile extends StatelessWidget {
),
trailing: LunaIconButton(
text: diskSpace?.lunaPercentageString ?? (rootFolder?.unmappedFolders?.length ?? 0).toString(),
color: diskSpace?.lunaColor ?? Colors.white,
color: diskSpace?.lunaColor ?? LunaColours.accent,
),
contentPadding: diskSpace != null,
);

View File

@@ -63,6 +63,9 @@ class SearchDialogs {
profile,
style: TextStyle(
fontSize: LunaUI.FONT_SIZE_SUBTITLE,
color: (LunaDatabaseValue.ENABLED_PROFILE.data ?? 'default') == profile
? LunaColours.accent
: Colors.white,
),
),
)];

View File

@@ -17,6 +17,7 @@ import package_info_plus_macos
import path_provider_macos
import shared_preferences_macos
import url_launcher_macos
import window_size
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
@@ -31,4 +32,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WindowSizePlugin.register(with: registry.registrar(forPlugin: "WindowSizePlugin"))
}

View File

@@ -129,6 +129,8 @@ PODS:
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- window_size (0.0.2):
- FlutterMacOS
DEPENDENCIES:
- cloud_firestore (from `Flutter/ephemeral/.symlinks/plugins/cloud_firestore/macos`)
@@ -145,6 +147,7 @@ DEPENDENCIES:
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
- shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- window_size (from `Flutter/ephemeral/.symlinks/plugins/window_size/macos`)
SPEC REPOS:
trunk:
@@ -194,6 +197,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
window_size:
:path: Flutter/ephemeral/.symlinks/plugins/window_size/macos
CHECKOUT OPTIONS:
FirebaseFirestore:
@@ -230,6 +235,7 @@ SPEC CHECKSUMS:
Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96
shared_preferences_macos: 480ce071d0666e37cef23fe6c702293a3d21799e
url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4
window_size: 339dafa0b27a95a62a843042038fa6c3c48de195
PODFILE CHECKSUM: 817265f65ab6c0f9a801d1d2c4e1a525a6d63569

View File

@@ -1169,6 +1169,15 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
window_size:
dependency: "direct main"
description:
path: "plugins/window_size"
ref: "57a2cd88486105d3d813583339eb0e23c9bfd6d2"
resolved-ref: "57a2cd88486105d3d813583339eb0e23c9bfd6d2"
url: "git://github.com/google/flutter-desktop-embedding.git"
source: git
version: "0.1.0"
xdg_directories:
dependency: transitive
description:

View File

@@ -56,6 +56,11 @@ dependencies:
uuid: ^3.0.4 # ANDROID IOS LINUX MACOS WEB WINDOWS
wake_on_lan: ^2.0.1+1 # ANDROID IOS LINUX MACOS WINDOWS
xml: ^5.1.0 # ANDROID IOS LINUX MACOS WEB WINDOWS
window_size:
git:
url: git://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: 57a2cd88486105d3d813583339eb0e23c9bfd6d2
dev_dependencies:
build_runner: ^1.12.2