macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.79k stars 174 forks source link

How to solve it #500

Open mhgsalim opened 7 months ago

mhgsalim commented 7 months ago

How to solve it

Windows 11 shows problem but web is fine.

MacosScaffold get a black background.

image

https://github.com/macosui/macos_ui/assets/14864126/cbd2de32-4b10-4ab6-93ed-e8367839caf7

https://github.com/macosui/macos_ui/assets/14864126/b411b5df-ec67-4daf-bb3a-5e3af2c4c8b3

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 commented 7 months ago

I face same issue.

mhgsalim commented 7 months ago

I face same issue.

did you have any solution?

stMerlHin commented 7 months ago

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

sb2bg commented 6 months ago

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 commented 3 months ago

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

electricbolt commented 1 month ago

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