feat: prepare linux release

This commit is contained in:
Tien Do Nam
2023-01-04 21:35:42 +01:00
parent 93362e6583
commit 983eb5c28b
5 changed files with 33 additions and 26 deletions
+7 -7
View File
@@ -20,7 +20,7 @@ import 'package:window_manager/window_manager.dart';
Future<PersistenceService> preInit() async {
WidgetsFlutterBinding.ensureInitialized();
if (!kIsWeb && checkPlatform([TargetPlatform.windows, TargetPlatform.macOS])) {
if (!kIsWeb && checkPlatformIsDesktop()) {
await windowManager.ensureInitialized();
WindowManager.instance.setMinimumSize(const Size(400, 500));
}
@@ -54,9 +54,9 @@ Future<void> postInit(BuildContext context, WidgetRef ref, void Function(int) go
final settings = ref.read(settingsProvider);
try {
await ref.read(serverProvider.notifier).startServer(
alias: settings.alias,
port: settings.port,
);
alias: settings.alias,
port: settings.port,
);
} catch (e) {
context.showSnackBar(e.toString());
}
@@ -83,7 +83,7 @@ void _handleSharedIntent(SharedMedia payload, WidgetRef ref) {
ref.read(selectedFilesProvider.notifier).addMessage(message);
}
ref.read(selectedFilesProvider.notifier).addFiles(
files: payload.attachments?.where((a) => a != null).cast<SharedAttachment>() ?? <SharedAttachment>[],
converter: CrossFileConverters.convertSharedAttachment,
);
files: payload.attachments?.where((a) => a != null).cast<SharedAttachment>() ?? <SharedAttachment>[],
converter: CrossFileConverters.convertSharedAttachment,
);
}
+8 -6
View File
@@ -22,10 +22,12 @@ ThemeData getTheme(Brightness brightness) {
primarySwatch: Colors.teal,
useMaterial3: true,
scaffoldBackgroundColor: brightness == Brightness.light ? Colors.white : Colors.grey.shade900,
navigationBarTheme: brightness == Brightness.dark ? NavigationBarThemeData(
indicatorColor: Colors.teal,
iconTheme: MaterialStateProperty.all(const IconThemeData(color: Colors.white)),
) : null,
navigationBarTheme: brightness == Brightness.dark
? NavigationBarThemeData(
indicatorColor: Colors.teal,
iconTheme: MaterialStateProperty.all(const IconThemeData(color: Colors.white)),
)
: null,
inputDecorationTheme: InputDecorationTheme(
filled: true,
fillColor: brightness == Brightness.light ? _lightInputColor : _darkInputColor,
@@ -37,12 +39,12 @@ ThemeData getTheme(Brightness brightness) {
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
foregroundColor: brightness == Brightness.dark ? Colors.white : null,
padding: checkPlatform([TargetPlatform.windows, TargetPlatform.macOS]) ? const EdgeInsets.all(16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: checkPlatformIsDesktop() ? const EdgeInsets.all(16) : const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
),
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
padding: checkPlatform([TargetPlatform.windows, TargetPlatform.macOS]) ? const EdgeInsets.symmetric(horizontal: 8, vertical: 16) : const EdgeInsets.all(8),
padding: checkPlatformIsDesktop() ? const EdgeInsets.symmetric(horizontal: 8, vertical: 16) : const EdgeInsets.all(8),
),
),
);
+5
View File
@@ -7,6 +7,11 @@ bool checkPlatform(List<TargetPlatform> platforms, {bool web = false}) {
return platforms.contains(defaultTargetPlatform);
}
/// This platform runs on a "traditional" computer
bool checkPlatformIsDesktop() {
return checkPlatform([TargetPlatform.linux, TargetPlatform.windows, TargetPlatform.macOS]);
}
/// This platform can receive share intents
bool checkPlatformCanReceiveShareIntent() {
return checkPlatform([TargetPlatform.android, TargetPlatform.iOS]);
+3 -3
View File
@@ -40,14 +40,14 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "localsend_app");
gtk_header_bar_set_title(header_bar, "LocalSend");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "localsend_app");
gtk_window_set_title(window, "LocalSend");
}
gtk_window_set_default_size(window, 1280, 720);
gtk_window_set_default_size(window, 400, 500);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
+10 -10
View File
@@ -35,7 +35,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.0"
version: "2.10.0"
basic_utils:
dependency: "direct main"
description:
@@ -112,7 +112,7 @@ packages:
name: checked_yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.0.2"
cli_util:
dependency: transitive
description:
@@ -133,7 +133,7 @@ packages:
name: code_builder
url: "https://pub.dartlang.org"
source: hosted
version: "4.3.0"
version: "4.4.0"
collection:
dependency: "direct main"
description:
@@ -442,7 +442,7 @@ packages:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
version: "3.3.0"
image_gallery_saver:
dependency: "direct main"
description:
@@ -477,7 +477,7 @@ packages:
name: image_picker_ios
url: "https://pub.dartlang.org"
source: hosted
version: "0.8.6+4"
version: "0.8.6+5"
image_picker_platform_interface:
dependency: transitive
description:
@@ -827,7 +827,7 @@ packages:
name: screen_retriever
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
version: "0.1.5"
share_handler:
dependency: "direct main"
description:
@@ -979,14 +979,14 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
version: "1.9.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
version: "1.11.0"
state_notifier:
dependency: transitive
description:
@@ -1000,7 +1000,7 @@ packages:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.1"
stream_transform:
dependency: transitive
description:
@@ -1014,7 +1014,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.2.0"
term_glyph:
dependency: transitive
description: