Converted to Yaru + Rounded Corners

This commit is contained in:
Win 2025-12-24 12:12:42 +00:00
parent 1576d40472
commit aa1357aadd
6 changed files with 66 additions and 10 deletions

3
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,3 @@
{
"cmake.ignoreCMakeListsMissing": true
}

View File

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:yaru/yaru.dart';
void main() {
Future<void> main() async {
await YaruWindowTitleBar.ensureInitialized();
runApp(const MyApp());
}
@ -9,8 +11,31 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(),
);
return YaruTheme(builder: (context, yaru, child) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: yaru.theme,
darkTheme: yaru.darkTheme,
home: _Home(),
);
});
}
}
class _Home extends StatelessWidget {
const _Home({
super.key,
});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: YaruWindowTitleBar(),
body: Center(
child: Text('Hello Ubuntu',
style: TextStyle(
color: Theme.of(context).primaryColor,
)),
));
}
}

View File

@ -6,6 +6,26 @@
#include "generated_plugin_registrant.h"
#include <gtk/gtk_plugin.h>
#include <handy_window/handy_window_plugin.h>
#include <screen_retriever_linux/screen_retriever_linux_plugin.h>
#include <window_manager/window_manager_plugin.h>
#include <yaru_window_linux/yaru_window_linux_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) gtk_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "GtkPlugin");
gtk_plugin_register_with_registrar(gtk_registrar);
g_autoptr(FlPluginRegistrar) handy_window_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "HandyWindowPlugin");
handy_window_plugin_register_with_registrar(handy_window_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) window_manager_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowManagerPlugin");
window_manager_plugin_register_with_registrar(window_manager_registrar);
g_autoptr(FlPluginRegistrar) yaru_window_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "YaruWindowLinuxPlugin");
yaru_window_linux_plugin_register_with_registrar(yaru_window_linux_registrar);
}

View File

@ -3,6 +3,11 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
gtk
handy_window
screen_retriever_linux
window_manager
yaru_window_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@ -48,17 +48,17 @@ static void my_application_activate(GApplication* application) {
}
gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_show(GTK_WIDGET(window));
gtk_widget_show(GTK_WIDGET(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}

View File

@ -35,6 +35,9 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
yaru: ^6.0.0
yaru_widgets: ^1.1.2
handy_window: ^0.4.0
dev_dependencies:
flutter_test: