Git Product home page Git Product logo

Comments (9)

Adrian-Samoticha avatar Adrian-Samoticha commented on June 11, 2024

I have received an email showing that you have posted the following comment:

Interesting, I just updated my macOS, rebooted and now everything works. You can delete this issue, not sure what caused it.

It doesn’t show up here for some reason, but I’ll just close this issue for now.

from flutter_acrylic.

kacikgoez avatar kacikgoez commented on June 11, 2024

@Adrian-Samoticha no, it still happens, I might have ran it in debug mode when I rebooted or there's some kind of probabilistic nature to it. For now I switched to window_manager

from flutter_acrylic.

Adrian-Samoticha avatar Adrian-Samoticha commented on June 11, 2024

Do you get the same issue when running the example project?

from flutter_acrylic.

kacikgoez avatar kacikgoez commented on June 11, 2024

Interesting, the example works. I played around a bit, and found one example that works and that doesn't work. If I remove the Stack from SidebarFrame, the app freezes in release mode. This is the working example in release mode:

import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';

import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter_acrylic_example/widgets/sidebar_frame/sidebar_frame.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Window.initialize();
  if (Platform.isWindows) {
    await Window.hideWindowControls();
  }
  runApp(MyApp());
  if (Platform.isWindows) {
    doWhenWindowReady(() {
      appWindow
        ..minSize = Size(640, 360)
        ..size = Size(720, 540)
        ..alignment = Alignment.center
        ..show();
    });
  }
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        splashFactory: InkRipple.splashFactory,
      ),
      darkTheme: ThemeData.dark().copyWith(
        splashFactory: InkRipple.splashFactory,
      ),
      themeMode: ThemeMode.dark,
      home: MyAppBody(),
    );
  }
}

class MyAppBody extends StatefulWidget {
  MyAppBody({Key? key}) : super(key: key);

  @override
  MyAppBodyState createState() => MyAppBodyState();
}

class MyAppBodyState extends State<MyAppBody> {
  WindowEffect effect = WindowEffect.transparent;
  Color color = Platform.isWindows ? Color(0xCC222222) : Colors.transparent;
  MacOSBlurViewState macOSBlurViewState =
      MacOSBlurViewState.followsWindowActiveState;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    // The [TitlebarSafeArea] widget is required when running on macOS and
    // enabling the full-size content view using
    // [Window.setFullSizeContentView]. It ensures that its child is not covered
    // by the macOS title bar.
    return TitlebarSafeArea(
      child: SidebarFrame(
        macOSBlurViewState: macOSBlurViewState,
        sidebar: SizedBox.expand(
          child: Scaffold(),
        ),
        child: Stack(
          children: [Text("yo")],
        ),
      ),
    );
  }
}

This is the broken example in release mode, I only changed the child of the SidebarFrame. I assume this is unintended behavior?

import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';

import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter_acrylic_example/widgets/sidebar_frame/sidebar_frame.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Window.initialize();
  if (Platform.isWindows) {
    await Window.hideWindowControls();
  }
  runApp(MyApp());
  if (Platform.isWindows) {
    doWhenWindowReady(() {
      appWindow
        ..minSize = Size(640, 360)
        ..size = Size(720, 540)
        ..alignment = Alignment.center
        ..show();
    });
  }
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        splashFactory: InkRipple.splashFactory,
      ),
      darkTheme: ThemeData.dark().copyWith(
        splashFactory: InkRipple.splashFactory,
      ),
      themeMode: ThemeMode.dark,
      home: MyAppBody(),
    );
  }
}

class MyAppBody extends StatefulWidget {
  MyAppBody({Key? key}) : super(key: key);

  @override
  MyAppBodyState createState() => MyAppBodyState();
}

class MyAppBodyState extends State<MyAppBody> {
  WindowEffect effect = WindowEffect.transparent;
  Color color = Platform.isWindows ? Color(0xCC222222) : Colors.transparent;
  MacOSBlurViewState macOSBlurViewState =
      MacOSBlurViewState.followsWindowActiveState;

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    // The [TitlebarSafeArea] widget is required when running on macOS and
    // enabling the full-size content view using
    // [Window.setFullSizeContentView]. It ensures that its child is not covered
    // by the macOS title bar.
    return TitlebarSafeArea(
      child: SidebarFrame(
        macOSBlurViewState: macOSBlurViewState,
        sidebar: SizedBox.expand(
          child: Scaffold(),
        ),
        child: Text("yo"),
      ),
    );
  }
}

from flutter_acrylic.

Adrian-Samoticha avatar Adrian-Samoticha commented on June 11, 2024

Both of your examples as well as the example project freeze in release mode on my machine. Interestingly, the same thing happens in Flutter 3.7.0, which rules out a breaking change in Flutter. I genuinely have no idea what is causing the issue and will need to investigate further.

from flutter_acrylic.

Adrian-Samoticha avatar Adrian-Samoticha commented on June 11, 2024

When running it in release via Xcode like this:

image image

and then running it through Xcode, it magically starts working correctly, even when running it via flutter run --release afterward.

I genuinely have no idea why this is the case.

EDIT: I did see some errors appear on my console, though, so maybe I should check if those are related to the problem.

from flutter_acrylic.

kacikgoez avatar kacikgoez commented on June 11, 2024

I'm trying to figure it out as well, I don't know anything about Swift, but I can replicate in Xcode by running the broken Flutter build executable in Xcode's debugger, so first flutter build macos and then Xcode > Debug > Debug Executable. The only error being shown to me is caused by bitsdojo_window_macos, if I remove bitsdojo and rebuild it won't print anything. The code freezes when adding the flutterViewController to MacOSWindowUtilsViewController.

from flutter_acrylic.

Adrian-Samoticha avatar Adrian-Samoticha commented on June 11, 2024

flutter_acrylic 1.1.2 no longer needs you to edit any Swift files. You should be able to just set your build configuration to “Release” in Xcode and run it there (at least that worked for me).

from flutter_acrylic.

kacikgoez avatar kacikgoez commented on June 11, 2024

Yes, when I run it in Xcode it works for me as well. Debugging the broken Flutter build at least gives some insight on what's happening

from flutter_acrylic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.