Linux desktop: optimized release build, installer, Linux gaps
Build: split Dart debug info out of libapp.so (13.96 -> 11.27 MB, symbols kept in the cache) and fix icon tree shaking, which Flutter 3.44's Linux CMake backend silently disables by quoting the define; the build image patches its SDK copy (MaterialIcons 1.6 MB -> 25 KB). Impeller cannot be enabled in a Linux release build and was slower in a profile-build bench. Install: `./install --linux --install` installs the bundle into <prefix>/lib/app-linux with com.pipelines.app.desktop (the GTK/Wayland app id), its icon and a ~/.local/bin/pipelines-app link, through scripts/install-linux-app.sh. Linux gaps: notifications through the freedesktop daemon; HTML artifacts explain the missing web view instead of throwing; no Share for files; a GTK clipboard reader for pasting files and screenshots (Ctrl+V and Omarchy's Super+V); GTK header bar only on GNOME; window icon. Bench: native fixture frame log, wheel/mark steps and tool/perf/linux_desktop_bench.py (private Xvfb); results in app/notes/linux-desktop-optimized.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,18 +1,25 @@
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:share_plus/share_plus.dart';
|
||||
|
||||
import 'artifact_file.dart';
|
||||
import 'artifact_transfer.dart';
|
||||
|
||||
/// Phones and desktops: Download asks where to save the exact bytes (the
|
||||
/// system "Save as"), Share hands the named file to the share sheet.
|
||||
/// system "Save as"; on Linux the desktop portal's file chooser), Share hands
|
||||
/// the named file to the share sheet. Linux has no share sheet for files
|
||||
/// (share_plus throws), so Share is not offered there.
|
||||
bool get artifactDownloadSupported => true;
|
||||
|
||||
bool get artifactShareSupported => true;
|
||||
bool get artifactShareSupported =>
|
||||
defaultTargetPlatform != TargetPlatform.linux;
|
||||
|
||||
String get artifactDownloadUnsupportedMessage => '';
|
||||
|
||||
String get artifactShareUnsupportedMessage => '';
|
||||
String get artifactShareUnsupportedMessage =>
|
||||
defaultTargetPlatform == TargetPlatform.linux
|
||||
? 'Sharing files is not available on Linux; use Download.'
|
||||
: '';
|
||||
|
||||
Future<ArtifactTransferResult> saveArtifactFile(ArtifactFile file) async {
|
||||
try {
|
||||
|
||||
@@ -12,6 +12,18 @@ import 'artifact_external_open.dart';
|
||||
/// the full-screen view needs no zoom buttons.
|
||||
const bool inertHtmlZoomButtons = false;
|
||||
|
||||
/// The webview plugin has Android, iOS and macOS implementations only; the
|
||||
/// Linux and Windows apps say so instead of failing to create a web view.
|
||||
bool inertHtmlViewSupported([TargetPlatform? platform]) => switch (platform ??
|
||||
defaultTargetPlatform) {
|
||||
TargetPlatform.android || TargetPlatform.iOS || TargetPlatform.macOS => true,
|
||||
_ => false,
|
||||
};
|
||||
|
||||
const String inertHtmlUnsupportedMessage =
|
||||
'This app cannot preview HTML on this platform: it has no web view. '
|
||||
'Download the file to open it in a browser.';
|
||||
|
||||
/// A web view with JavaScript disabled that refuses every navigation after the
|
||||
/// recorded document itself loads.
|
||||
///
|
||||
@@ -99,6 +111,7 @@ class _InertHtmlViewState extends State<InertHtmlView> {
|
||||
@override
|
||||
void didUpdateWidget(covariant InertHtmlView oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (!inertHtmlViewSupported()) return;
|
||||
if (oldWidget.html != widget.html || oldWidget.dark != widget.dark) {
|
||||
_loaded = false;
|
||||
_controller.loadHtmlString(_document);
|
||||
@@ -106,8 +119,20 @@ class _InertHtmlViewState extends State<InertHtmlView> {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => WebViewWidget(
|
||||
controller: _controller,
|
||||
gestureRecognizers: widget.interactive ? _allGestures : _inlineGestures,
|
||||
);
|
||||
Widget build(BuildContext context) => inertHtmlViewSupported()
|
||||
? WebViewWidget(
|
||||
controller: _controller,
|
||||
gestureRecognizers: widget.interactive
|
||||
? _allGestures
|
||||
: _inlineGestures,
|
||||
)
|
||||
: const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text(
|
||||
inertHtmlUnsupportedMessage,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user