Closed kacikgoez closed 1 year ago
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.
@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
Do you get the same issue when running the example project?
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"),
),
);
}
}
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.
When running it in release via Xcode like this:
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.
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
.
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).
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
Hey, when I create a fresh Flutter application in VSC, like this:
I can run it in debug mode, but when I run
flutter run --release
, the application starts hanging and I get a permanent spinning pinwheel. Like I said, this is a fresh Flutter project where I only changed theRunner.xcodeproj
to macOS version 10.15 and thePodfile
to 10.15, because it's required bymacos_window_utils
, and the dependencies inpubspec.yaml
:Here's my
flutter doctor -v
: