mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
Improve linux window.
This commit is contained in:
@@ -147,7 +147,8 @@ class _WindowFrameState extends State<WindowFrame> {
|
|||||||
onPressed: debug,
|
onPressed: debug,
|
||||||
child: Text('Debug'),
|
child: Text('Debug'),
|
||||||
),
|
),
|
||||||
if (!App.isMacOS) _WindowButtons(
|
if (!App.isMacOS)
|
||||||
|
_WindowButtons(
|
||||||
onClose: _onClose,
|
onClose: _onClose,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -559,22 +560,19 @@ class _VirtualWindowFrameState extends State<VirtualWindowFrame>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildVirtualWindowFrame(BuildContext context) {
|
Widget _buildVirtualWindowFrame(BuildContext context) {
|
||||||
return DecoratedBox(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(_isMaximized ? 0 : 8),
|
||||||
color: Colors.transparent,
|
color: Colors.transparent,
|
||||||
border: Border.all(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: (_isMaximized || _isFullScreen) ? 0 : 1,
|
|
||||||
),
|
|
||||||
boxShadow: <BoxShadow>[
|
boxShadow: <BoxShadow>[
|
||||||
if (!_isMaximized && !_isFullScreen)
|
|
||||||
BoxShadow(
|
BoxShadow(
|
||||||
color: Colors.black.toOpacity(0.1),
|
color: Colors.black.toOpacity(_isFocused ? 0.4 : 0.2),
|
||||||
offset: Offset(0.0, _isFocused ? 4 : 2),
|
offset: Offset(0.0, 2),
|
||||||
blurRadius: 6,
|
blurRadius: 4,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
clipBehavior: Clip.antiAlias,
|
||||||
child: widget.child,
|
child: widget.child,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -583,7 +581,10 @@ class _VirtualWindowFrameState extends State<VirtualWindowFrame>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DragToResizeArea(
|
return DragToResizeArea(
|
||||||
enableResizeEdges: (_isMaximized || _isFullScreen) ? [] : null,
|
enableResizeEdges: (_isMaximized || _isFullScreen) ? [] : null,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.all(_isMaximized ? 0 : 4),
|
||||||
child: _buildVirtualWindowFrame(context),
|
child: _buildVirtualWindowFrame(context),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,13 +34,10 @@ void main(List<String> args) {
|
|||||||
await windowManager.setBackgroundColor(Colors.transparent);
|
await windowManager.setBackgroundColor(Colors.transparent);
|
||||||
}
|
}
|
||||||
await windowManager.setMinimumSize(const Size(500, 600));
|
await windowManager.setMinimumSize(const Size(500, 600));
|
||||||
if (!App.isLinux) {
|
|
||||||
// https://github.com/leanflutter/window_manager/issues/460
|
|
||||||
var placement = await WindowPlacement.loadFromFile();
|
var placement = await WindowPlacement.loadFromFile();
|
||||||
await placement.applyToWindow();
|
await placement.applyToWindow();
|
||||||
await windowManager.show();
|
await windowManager.show();
|
||||||
WindowPlacement.loop();
|
WindowPlacement.loop();
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, (error, stack) {
|
}, (error, stack) {
|
||||||
@@ -201,6 +198,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
|||||||
'dark' => ThemeMode.dark,
|
'dark' => ThemeMode.dark,
|
||||||
_ => ThemeMode.system
|
_ => ThemeMode.system
|
||||||
},
|
},
|
||||||
|
color: Colors.transparent,
|
||||||
localizationsDelegates: [
|
localizationsDelegates: [
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
GlobalCupertinoLocalizations.delegate,
|
GlobalCupertinoLocalizations.delegate,
|
||||||
@@ -248,6 +246,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
return _SystemUiProvider(Material(
|
return _SystemUiProvider(Material(
|
||||||
|
color: App.isLinux ? Colors.transparent : null,
|
||||||
child: widget,
|
child: widget,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@@ -48,6 +48,12 @@ static void my_application_activate(GApplication* application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_set_default_size(window, 1280, 720);
|
gtk_window_set_default_size(window, 1280, 720);
|
||||||
|
GdkVisual* visual;
|
||||||
|
gtk_widget_set_app_paintable(GTK_WIDGET(window), TRUE);
|
||||||
|
visual = gdk_screen_get_rgba_visual(screen);
|
||||||
|
if (visual != NULL && gdk_screen_is_composited(screen)) {
|
||||||
|
gtk_widget_set_visual(GTK_WIDGET(window), visual);
|
||||||
|
}
|
||||||
gtk_widget_show(GTK_WIDGET(window));
|
gtk_widget_show(GTK_WIDGET(window));
|
||||||
|
|
||||||
g_autoptr(FlDartProject) project = fl_dart_project_new();
|
g_autoptr(FlDartProject) project = fl_dart_project_new();
|
||||||
@@ -58,6 +64,7 @@ static void my_application_activate(GApplication* application) {
|
|||||||
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
||||||
|
|
||||||
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
||||||
|
gtk_widget_hide(GTK_WIDGET(window));
|
||||||
|
|
||||||
gtk_widget_grab_focus(GTK_WIDGET(view));
|
gtk_widget_grab_focus(GTK_WIDGET(view));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user