-
-
Notifications
You must be signed in to change notification settings - Fork 191
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
Example app broken on non-macOS platforms #436
Comments
Been trying to make this work on web and I think this it be more trouble than its worth. We may need to make it clear that from 2.0 on, it is expected that |
Indeed, I too believe that supporting only macOS (and providing a web playground for showcasing the components) would be optimal going forward. |
Minimum reproducible sample using import 'package:flutter/material.dart';
import 'package:macos_ui/macos_ui.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MacosApp(
title: 'Flutter Demo',
theme: MacosThemeData.light(),
darkTheme: MacosThemeData.dark(),
themeMode: ThemeMode.dark,
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return MacosWindow(
child: MacosScaffold(
children: [
ContentArea(
builder: (context, _) => const Center(child: Text('Content')),
),
],
),
);
}
} |
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Launching the app on non-macOS platforms results in immediate exceptions. I've so far tested on Windows and Chrome, but based on the exceptions I'm almost certain the same errors will occur on any platform other than macOS
Steps To Reproduce
macos
.Expected behavior
Example app should open and display the widgets gallery.
Actual behavior
An exception is immediately thrown. Since the exception is thrown in
main
beforerunApp
is called, the app seemingly freezes with a blank screen without even displaying Flutter's red error screen in debug mode.Screenshots
Windows
Chrome
Logs
Logs
Logs generated without
--verbose
since doing so adds a bunch of useless noise that pushes the comment length above Github's limit.Further details
The initial exception comes from an unconditional call into
macos_window_utils
right at the top of main. Since that plugin understandably only supports macOS, this call throws. After fixing this the app is still broken due to an unconditional use ofPlatformMenuBar
, which is again only supported on macOS. Adding conditional logic to only execute this code on macOS allows the example app to run.Edit: for web, an additional fix is needed to prevent accessing
Platform.isMacOS
inutils.dart
.The text was updated successfully, but these errors were encountered: