flutter-tizen / embedder

Flutter embedder for Tizen
BSD 3-Clause "New" or "Revised" License
5 stars 7 forks source link

Devices with a landscape default orientation #19

Open swift-kim opened 1 year ago

swift-kim commented 1 year ago

https://api.flutter.dev/flutter/services/DeviceOrientation.html

According to the Flutter official documentation, the default orientation of a device is defined as the orientation in which its boot logo is displayed upright. In other words, the default orientation of most TV devices (and some common devices) is technically landscapeLeft, but we're currently assuming that the default orientation of a device is always portraitUp regardless of the actual screen size.

A correct implementation will be like this: https://github.com/swift-kim/embedder/commit/4bf08c8531cd3226a72cad8f9df269e1dcb4994a

However, applying this change will break some (cross-platform) apps and packages which are developed only for mobile and always assume portraitUp as a default orientation (example: youtube_player_iframe). How should we deal with this problem? Should we apply the patch anyway?

JSUYA commented 1 year ago

https://api.flutter.dev/flutter/services/DeviceOrientation.html

According to the Flutter official documentation, the default orientation of a device is defined as the orientation in which its boot logo is displayed upright. In other words, the default orientation of most TV devices (and some common devices) is technically landscapeLeft, but we're currently assuming that the default orientation of a device is always portraitUp regardless of the actual screen size.

According to flutter documentation you mentioned, the default orientation has nothing to do with aspect ratio. How about using TV_PROFILE macro since the normal case is portrait and for TV's logo orientation is landscape.

swift-kim commented 1 year ago

@JSUYA Please understand the definition of the words "portrait" and "landscape" and read the documentation again. Also please refer to https://api.flutter.dev/flutter/widgets/MediaQueryData/orientation.html.

JSUYA commented 1 year ago

Application can resize size . If we run a 400x300 flutter application(platformview or multi windows...) on a screen with a longer height (mobile, portrait), the app will recognize landscape as default. Are you intending this?

Also please refer to https://api.flutter.dev/flutter/widgets/MediaQueryData/orientation.html.

This is the device's screen size.

swift-kim commented 1 year ago

Are you intending this?

Basically yes. Only the current width and height matter. On Tizen, there's no predefined constant like Android's ActivityInfo.SCREEN_ORIENTATION_PORTRAIT so the embedder should manually compute the current orientation.

This is the device's screen size.

Hmm.. I provided the link because it explains that "landscape" indicates "width > height" by definition. The size in the code refers to the logical window size.

FYI) MediaQuery.of(context).orientation is quite frequently used by Flutter apps to detect the current orientation.