Add support to set Title on desktop

This commit is contained in:
2023-08-29 13:15:06 +08:00
parent 025f540fe2
commit cabd39e15f
9 changed files with 49 additions and 3 deletions

View File

@@ -23,4 +23,4 @@ jobs:
env:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CF_API_TOKEN }}
run: wrangler pages deploy build/web --project-name=ehf --branch=dev "--commit-hash=${{ github.sha }}"
run: wrangler pages deploy build/web --project-name=ehf --branch=dev

View File

@@ -1,6 +1,8 @@
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:window_manager/window_manager.dart';
import 'globals.dart';
import 'home.dart';
import 'set_server.dart';
@@ -21,6 +23,11 @@ final _router = GoRouter(
void main() async {
if (!kIsWeb) await prepareJar();
await preparePrefs();
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
WidgetsFlutterBinding.ensureInitialized();
await windowManager.ensureInitialized();
await windowManager.setTitle("E-Hentai Downloader Dashboard");
}
runApp(const MainApp());
}

View File

@@ -6,6 +6,14 @@
#include "generated_plugin_registrant.h"
#include <screen_retriever/screen_retriever_plugin.h>
#include <window_manager/window_manager_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
g_autoptr(FlPluginRegistrar) window_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin");
window_manager_plugin_register_with_registrar(window_manager_registrar);
}

View File

@@ -3,6 +3,8 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever
window_manager
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -7,10 +7,14 @@ import Foundation
import cryptography_flutter
import path_provider_foundation
import screen_retriever
import shared_preferences_foundation
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
CryptographyFlutterPlugin.register(with: registry.registrar(forPlugin: "CryptographyFlutterPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
WindowManagerPlugin.register(with: registry.registrar(forPlugin: "WindowManagerPlugin"))
}

View File

@@ -292,10 +292,10 @@ packages:
dependency: "direct main"
description:
name: go_router
sha256: "2aa884667eeda3a1c461f31e72af1f77984ab0f29450d8fb12ec1f7bc53eea14"
sha256: "694cb219d9bb7c9d30efce3d8c6ef3782d8ad00ff14e6772a499a860b3c59ccb"
url: "https://pub.dev"
source: hosted
version: "10.1.0"
version: "10.1.1"
graphs:
dependency: transitive
description:
@@ -520,6 +520,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.8"
screen_retriever:
dependency: transitive
description:
name: screen_retriever
sha256: "6ee02c8a1158e6dae7ca430da79436e3b1c9563c8cf02f524af997c201ac2b90"
url: "https://pub.dev"
source: hosted
version: "0.1.9"
shared_preferences:
dependency: "direct main"
description:
@@ -733,6 +741,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.7"
window_manager:
dependency: "direct main"
description:
name: window_manager
sha256: "6ee795be9124f90660ea9d05e581a466de19e1c89ee74fc4bf528f60c8600edd"
url: "https://pub.dev"
source: hosted
version: "0.3.6"
xdg_directories:
dependency: transitive
description:

View File

@@ -19,6 +19,7 @@ dependencies:
path_provider: ^2.1.0
retrofit: ^4.0.1
shared_preferences: ^2.2.0
window_manager: ^0.3.6
dev_dependencies:
flutter_test:

View File

@@ -6,6 +6,12 @@
#include "generated_plugin_registrant.h"
#include <screen_retriever/screen_retriever_plugin.h>
#include <window_manager/window_manager_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
WindowManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WindowManagerPlugin"));
}

View File

@@ -3,6 +3,8 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
screen_retriever
window_manager
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST