macosui / macos_ui

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

MacosScaffold get a black background. #428

Closed parcool closed 11 months ago

parcool commented 1 year ago

set backgroundColor don't work but wrap a MacosOverlayFilter. it seems GlobalWallpaperTintingSettings lose control.

GroovinChip commented 1 year ago

@parcool please provide some sample code. Also, please try the latest beta version and see if the issue persists there.

nbonamy commented 1 year ago

Confirmed here too on latest dev branch

GroovinChip commented 1 year ago

Confirmed here too on latest dev branch

Please provide minimum reproducible sample code and output from flutter doctor.

htsuruo commented 1 year ago

@GroovinChip

Hi, same problem.

The version of macos_ui is 2.0.0:

macos_ui:
    dependency: "direct main"
    description:
      name: macos_ui
      sha256: b739149b812c47e5ff10a00c9fdf7315f22ac5cd1fdbd447a6b7ffee31472717
      url: "https://pub.dev"
    source: hosted
    version: "2.0.0"

flutter doctor is here:

fluttter doctor -v

```sh ❯ flutter doctor -v [✓] Flutter (Channel stable, 3.10.6, on macOS 13.4.1 22F770820d darwin-arm64 (Rosetta), locale ja-JP) • Flutter version 3.10.6 on channel stable at /Users/tsuruoka/fvm/versions/stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision f468f3366c (13 days ago), 2023-07-12 15:19:05 -0700 • Engine revision cdbeda788a • Dart version 3.0.6 • DevTools version 2.23.1 [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/tsuruoka/Library/Android/sdk • Platform android-33, build-tools 31.0.0 • ANDROID_SDK_ROOT = /Users/tsuruoka/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) • All Android licenses accepted. [✓] Xcode - develop for iOS and macOS (Xcode 14.3.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14E300c • CocoaPods version 1.12.1 [✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome [✓] Android Studio (version 2021.2) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840) [✓] VS Code (version 1.80.1) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.68.0 [✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 13.4.1 22F770820d darwin-arm64 (Rosetta) • Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.198 [✓] Network resources • All expected network resources are available. • No issues found! ```

Minimum reproducible sample code is here:

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return MacosApp(
      theme: MacosThemeData.light(),
      home: MacosWindow(
        // not working
        backgroundColor: MacosColors.appleGreen,
        child: MacosScaffold(
          // not working
          backgroundColor: MacosColors.appleGreen,
          children: [
            ContentArea(
              builder: (context, scrollController) => const Center(
                child: Text(
                  'text',
                  style: TextStyle(color: Colors.white),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Screenshot

SCR-20230725-srer-2
hyperion2144 commented 1 year ago

you maybe have to apply MacosWindowUtilsConfig

htsuruo commented 1 year ago

@hyperion2144

It means this example code, right? Yes, it seems that the example code works fine. https://github.com/macosui/macos_ui/blob/dev/example/lib/main.dart#L25-L26

But, we cannot find the MacosWindowUtilsConfig setup in in the official documents.

Since it is not written in the document, it is unclear whether this configuration is necessary for all applications or optional. What doesMacosWindowUtilsConfig configuration, if required setup?

hyperion2144 commented 1 year ago
const MacosWindowUtilsConfig({
    this.toolbarStyle = NSWindowToolbarStyle.unified,
    this.enableFullSizeContentView = true,
    this.makeTitlebarTransparent = true,
    this.hideTitle = true,
    this.removeMenubarInFullScreenMode = true,
    this.autoHideToolbarAndMenuBarInFullScreenMode = true,
  });

this is the config define, maybe use the default config is ok.

parcool commented 11 months ago

Solved by example/lib/main.dart - MacosWindowUtilsConfig