Skip to content

Commit

Permalink
add linux shadow
Browse files Browse the repository at this point in the history
  • Loading branch information
bai-3 authored and bai-3 committed Oct 28, 2024
1 parent 442ee55 commit c54204d
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 24 deletions.
13 changes: 7 additions & 6 deletions lib/infra/components/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,26 @@ class _WindowFrameState extends State<WindowFrame> with WindowListener {

Widget _buildWindowFrame(BuildContext context) {
final constTheme = Theme.of(context).extension<ExtColors>()!;
return DecoratedBox(
return Container(
decoration: BoxDecoration(
color: constTheme.sidebarBg.withOpacity(0.70),
border: Border.all(
color: Theme.of(context).dividerColor.withOpacity(0.3),
width: (_isMaximized || _isFullScreen) ? 0 : 1,
),
borderRadius: BorderRadius.circular(
(_isMaximized || _isFullScreen) ? 0 : 16,
(_isMaximized || _isFullScreen) ? 0 : 23
),
boxShadow: <BoxShadow>[
if (!_isMaximized && !_isFullScreen)
BoxShadow(
color: Colors.black.withOpacity(0.1),
offset: Offset(0.0, _isFocused ? 4 : 2),
blurRadius: 16,
color: Colors.black.withOpacity(0.4),
// offset: Offset(0.0, _isFocused ? 4 : 2),
blurRadius: 5
),
],
),
margin: const EdgeInsets.all(5),
child: ClipRRect(
// clipBehavior: Clip.hardEdge,
borderRadius: BorderRadius.circular(
Expand All @@ -70,7 +71,7 @@ class _WindowFrameState extends State<WindowFrame> with WindowListener {
child: ClipRRect(
clipBehavior: Clip.hardEdge,
borderRadius: BorderRadius.circular(
(_isMaximized || _isFullScreen) ? 0 : 12,
(_isMaximized || _isFullScreen) ? 0 : 20,
),
child: widget.child,
),
Expand Down
3 changes: 1 addition & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (isPc()) {
await windowManager.ensureInitialized();
// await windowManager.hide();
}
AdaptiveDialog.instance.updateConfiguration(defaultStyle: AdaptiveStyle.material);

Expand Down Expand Up @@ -76,7 +75,7 @@ Future<void> main() async {
await windowManager.setAsFrameless();
}
await windowManager.setSize(winSize);
await windowManager.show();
// await windowManager.show();
await showtray();
await windowManager.focus();
});
Expand Down
8 changes: 4 additions & 4 deletions linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <record_linux/record_linux_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>
Expand Down Expand Up @@ -44,9 +44,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) record_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin");
record_linux_plugin_register_with_registrar(record_linux_registrar);
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) screen_retriever_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverLinuxPlugin");
screen_retriever_linux_plugin_register_with_registrar(screen_retriever_linux_registrar);
g_autoptr(FlPluginRegistrar) tray_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "TrayManagerPlugin");
tray_manager_plugin_register_with_registrar(tray_manager_registrar);
Expand Down
2 changes: 1 addition & 1 deletion linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
flutter_webrtc
record_linux
screen_retriever
screen_retriever_linux
tray_manager
url_launcher_linux
window_manager
Expand Down
4 changes: 2 additions & 2 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import macos_window_utils
import package_info_plus
import path_provider_foundation
import record_darwin
import screen_retriever
import screen_retriever_macos
import shared_preferences_foundation
import tray_manager
import url_launcher_macos
Expand All @@ -43,7 +43,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RecordPlugin.register(with: registry.registrar(forPlugin: "RecordPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
ScreenRetrieverMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverMacosPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
TrayManagerPlugin.register(with: registry.registrar(forPlugin: "TrayManagerPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
Expand Down
40 changes: 36 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1568,10 +1568,42 @@ packages:
dependency: transitive
description:
name: screen_retriever
sha256: "6ee02c8a1158e6dae7ca430da79436e3b1c9563c8cf02f524af997c201ac2b90"
sha256: "570dbc8e4f70bac451e0efc9c9bb19fa2d6799a11e6ef04f946d7886d2e23d0c"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.9"
version: "0.2.0"
screen_retriever_linux:
dependency: transitive
description:
name: screen_retriever_linux
sha256: f7f8120c92ef0784e58491ab664d01efda79a922b025ff286e29aa123ea3dd18
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
screen_retriever_macos:
dependency: transitive
description:
name: screen_retriever_macos
sha256: "71f956e65c97315dd661d71f828708bd97b6d358e776f1a30d5aa7d22d78a149"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
screen_retriever_platform_interface:
dependency: transitive
description:
name: screen_retriever_platform_interface
sha256: ee197f4581ff0d5608587819af40490748e1e39e648d7680ecf95c05197240c0
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
screen_retriever_windows:
dependency: transitive
description:
name: screen_retriever_windows
sha256: "449ee257f03ca98a57288ee526a301a430a344a161f9202b4fcc38576716fe13"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
sdp_transform:
dependency: transitive
description:
Expand Down Expand Up @@ -2149,10 +2181,10 @@ packages:
dependency: "direct main"
description:
name: window_manager
sha256: ab8b2a7f97543d3db2b506c9d875e637149d48ee0c6a5cb5f5fd6e0dac463792
sha256: "732896e1416297c63c9e3fb95aea72d0355f61390263982a47fd519169dc5059"
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.2"
version: "0.4.3"
wkt_parser:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies:
# 主题
adaptive_theme: ^3.2.0
# 桌面客户端样式
window_manager: ^0.4.2
window_manager: ^0.4.3
# nosql 数据库
hive: ^2.2.3
# 全局状态树
Expand Down
6 changes: 3 additions & 3 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
#include <record_windows/record_windows_plugin_c_api.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <screen_retriever_windows/screen_retriever_windows_plugin_c_api.h>
#include <tray_manager/tray_manager_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_manager/window_manager_plugin.h>
Expand All @@ -36,8 +36,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FlutterWebRTCPlugin"));
RecordWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("RecordWindowsPluginCApi"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
ScreenRetrieverWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverWindowsPluginCApi"));
TrayManagerPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("TrayManagerPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
2 changes: 1 addition & 1 deletion windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_windows
flutter_webrtc
record_windows
screen_retriever
screen_retriever_windows
tray_manager
url_launcher_windows
window_manager
Expand Down

0 comments on commit c54204d

Please sign in to comment.