Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce YaruWindowTitleBar & YaruDialogTitleBar #455

Merged
merged 20 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions example/lib/code_snippet_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ class _CodeDialog extends StatelessWidget {

return AlertDialog(
titlePadding: EdgeInsets.zero,
title: YaruTitleBar(
title: YaruDialogTitleBar(
title: Text(!model.appIsOnline ? 'Offline' : pageItem.tooltipMessage),
trailing: const YaruCloseButton(),
leading: !model.appIsOnline
? null
: Center(
Expand Down
2 changes: 1 addition & 1 deletion example/lib/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Future<void> showSettingsDialog(BuildContext context) {
animation: model,
builder: (context, child) {
return AlertDialog(
title: const YaruTitleBar(
title: const YaruDialogTitleBar(
title: Text('Settings'),
),
titlePadding: EdgeInsets.zero,
Expand Down
10 changes: 8 additions & 2 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:ubuntu_service/ubuntu_service.dart';
import 'package:yaru/yaru.dart';
import 'package:yaru_widgets/yaru_widgets.dart';

import 'example.dart';
import 'theme.dart';

void main() {
Future<void> main() async {
await YaruWindowTitleBar.ensureInitialized();

registerService<Connectivity>(Connectivity.new);
runApp(
MultiProvider(
Expand All @@ -30,7 +33,10 @@ class Home extends StatelessWidget {
debugShowCheckedModeBanner: false,
theme: context.watch<LightTheme>().value,
darkTheme: context.watch<DarkTheme>().value,
home: Example.create(context),
home: Scaffold(
appBar: const YaruWindowTitleBar(),
body: Example.create(context),
),
);
}
}
2 changes: 1 addition & 1 deletion example/lib/pages/banner_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class _BannerState extends State<_Banner> {
builder: (context) => SimpleDialog(
titlePadding: EdgeInsets.zero,
contentPadding: const EdgeInsets.all(10),
title: YaruTitleBar(
title: YaruDialogTitleBar(
title: title,
),
children: [
Expand Down
4 changes: 2 additions & 2 deletions example/lib/pages/dialog_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _DialogPageState extends State<DialogPage> {
)
],
titlePadding: EdgeInsets.zero,
title: YaruTitleBar(
title: YaruDialogTitleBar(
leading: const Center(
child: SizedBox.square(
dimension: 25,
Expand All @@ -49,7 +49,7 @@ class _DialogPageState extends State<DialogPage> {
),
),
title: const Text('The Title'),
trailing: YaruCloseButton(enabled: isCloseable),
isClosable: isCloseable,
),
content: SizedBox(
height: 100,
Expand Down
8 changes: 8 additions & 0 deletions example/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@
#include "generated_plugin_registrant.h"

#include <handy_window/handy_window_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <window_manager/window_manager_plugin.h>
#include <yaru/yaru_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
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_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);
g_autoptr(FlPluginRegistrar) yaru_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "YaruPlugin");
yaru_plugin_register_with_registrar(yaru_registrar);
Expand Down
2 changes: 2 additions & 0 deletions example/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

list(APPEND FLUTTER_PLUGIN_LIST
handy_window
screen_retriever
window_manager
yaru
)

Expand Down