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

How to solve it #500

Open
mhgsalim opened this issue Dec 4, 2023 · 6 comments
Open

How to solve it #500

mhgsalim opened this issue Dec 4, 2023 · 6 comments

Comments

@mhgsalim
Copy link

mhgsalim commented Dec 4, 2023

How to solve it

Windows 11 shows problem but web is fine.

MacosScaffold get a black background.

image

2023-12-04-23-43-48.mp4
2023-12-05-00-24-39.mp4

image

`Future _configureMacosWindowUtils() async {
const config = MacosWindowUtilsConfig(
toolbarStyle: NSWindowToolbarStyle.unified,
enableFullSizeContentView: true,
makeTitlebarTransparent: true,
hideTitle: true,
removeMenubarInFullScreenMode: true,
autoHideToolbarAndMenuBarInFullScreenMode: true,
);
await config.apply();
}

Future main() async {
if (!kIsWeb) {
if (Platform.isMacOS) {
await _configureMacosWindowUtils();
}
}

runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);

@OverRide
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (_) => AppTheme(),
builder: (context, _) {
final appTheme = context.watch();
return MacosApp(
title: 'Widget Gallery',
theme: MacosThemeData.light(),
darkTheme: MacosThemeData.dark(),
themeMode: appTheme.mode,
debugShowCheckedModeBanner: false,
home: const MyHomePage(),
);
},
);
}
}`

@mhgsalim-office
Copy link

I face same issue.

@mhgsalim
Copy link
Author

mhgsalim commented Dec 5, 2023

I face same issue.

did you have any solution?

@stMerlHin
Copy link
Contributor

I Can reproduce the bug on linux (6.5.0-kali3-amd64).

@sb2bg
Copy link

sb2bg commented Jan 18, 2024

Not a bug, you need to apply MacosWindowUtilsConfig in the main, as shown here

Future<void> _configureMacosWindowUtils() async {
  const config = MacosWindowUtilsConfig();
  await config.apply();
}

Future<void> main() async {
  if (!kIsWeb) {
    if (Platform.isMacOS) {
      await _configureMacosWindowUtils();
    }
  }

  runApp(const MyApp());
}

@Adrian-Samoticha
Copy link
Member

Keep in mind that we do not officially support Windows or Linux platforms.

@electricbolt
Copy link

As a workaround, on Windows, the following fixes are required in order for your app to stop appearing with a black background.

Content fix to your app:

To stop the content appearing black, add disableWallpaperTinting: true property to your MacosWindow.

Sidebar fix to macos_ui:

The macos_ui codepath is choosing TransparentMacOSSidebar instead of ColoredBox, change line 268 of window.dart:
from:

child: kIsWeb

to

child: !isMac

Suggest you checkout the current dev branch of macos_ui and reference it locally from your pubspec.yaml like this:
from:

macos_ui: ^2.0.7

to:

macos_ui:
    path: macos_ui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants