Giter Club home page Giter Club logo

Comments (7)

ardera avatar ardera commented on September 13, 2024

Okay, I'll try to reproduce your error.

even if the lcd_rotate=2

I recommend not using the linux or raspberry pi firmware settings to rotate the display, the rotation is entirely done by flutter-pi. Also, at least in my experience, most of the display settings inside config.txt are kinda hacky and glitchy

from flutter-pi.

bottee avatar bottee commented on September 13, 2024

Hi,

first of all, this is a really great project. Thank you very much for making it available to everybody!

I have the same problem here. It happens without any modification in config.tx. If I start my flutter app in landscape mode everything works like a charm.
But if I add await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); to my flutter application it stops after the startup animation and changes to dark colors.

I have a Raspi4 with 4GB Ram and the official 7" LCD touch Dislplay.

Do you have any hints how to find the cause?

from flutter-pi.

gustavsl avatar gustavsl commented on September 13, 2024

I can confirm this same issue - not on a Raspberry Pi but on an i.MX 6 device.
Flutter application displays black screen after adding setPreferredOrientations.

from flutter-pi.

ardera avatar ardera commented on September 13, 2024

Weird, it works fine for me. I created a brand-new barebones flutter project using flutter create and put the call to setPreferredOrientations into the initState and build methods.

Can anyone send me some more code so I can reproduce the issue?

from flutter-pi.

gustavsl avatar gustavsl commented on September 13, 2024

I'm using the example from https://github.com/google/flutter-desktop-embedding/tree/master/example adding await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); before runApp(new MyApp());.

from flutter-pi.

ardera avatar ardera commented on September 13, 2024

When I put the SystemChrome.setPreferredOrientations call before runApp this error message is printed:

[ERROR:engine/src/flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: ServicesBinding.defaultBinaryMessenger was accessed before the binding was initialized.
If you're running an application and need to access the binary messenger before `runApp()` has been called (for example, during plugin initialization), then you need to explicitly call the `WidgetsFlutterBinding.ensureInitialized()` first.
If you're running a test, you can call the `TestWidgetsFlutterBinding.ensureInitialized()` as the first line in your test's `main()` method to initialize the binding.
#0      defaultBinaryMessenger.<anonymous closure> (package:flutter/src/services/binary_messenger.dart:76:7)
#1      defaultBinaryMessenger (package:flutter/src/services/binary_messenger.dart:89:4)
#2      MethodChannel.binaryMessenger (package:flutter/src/services/platform_channel.dart:140:62)
#3      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:314:35)
#4      OptionalMethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:429:36)
#5      SystemChrome.setPreferredOrientations (package:flutter/src/services/system_chrome.dart:236:35)
#6      main (package:orientation/main.dart:8:6)
#7      _runMainZoned.<anonymous closure>.<anonymous closure> (dart:ui/hooks.dart:239:25)
#8      _rootRun (dart:async/zone.dart:1126:13)
#9      _CustomZone.run (dart:async/zone.dart:1023:19)
#10     _runZoned (dart:async/zone.dart:1518:10)
#11     runZoned (dart:async/zone.dart:1502:12)
#12     _runMainZoned.<anonymous closure> (dart:ui/hooks.dart:231:5)
#13     _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#14     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)

As it says in the error message, just don't use SystemChrome.setPreferredOrientations before the runApp call.

runApp initializes the bindings to the platform side. SystemChrome.setPreferredOrientations needs these bindings to be initialized, since it uses these bindings to tell the platform side about the preferred orientations. I think, in general, it's a bad idea to do flutter-specific stuff before the runApp call.

from flutter-pi.

bottee avatar bottee commented on September 13, 2024

Sorry for this late response. I tried to create a minimal version to reproduce the issue, as my project is quite sensitive. As a result I found that the issue is caused by Flutter. So from my side the issue is not an flutter_pi issue. I'm sorry for the inconvenience.

And thank you for this great project!

from flutter-pi.

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.