Skip to content

WindowSizeConfiguration change #2

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

Closed
fredgrott opened this issue Apr 10, 2025 · 1 comment
Closed

WindowSizeConfiguration change #2

fredgrott opened this issue Apr 10, 2025 · 1 comment

Comments

@fredgrott
Copy link

fredgrott commented Apr 10, 2025

u forgot Fuchsia and web, so it should probably be changed to...

 static WindowSizeConfigurationData _adaptiveData(TargetPlatform platform) {
    switch (platform) {
      case TargetPlatform.android | TargetPlatform.fuchsia | kIsWeb:
        return const WindowSizeConfigurationData.compose();
      case TargetPlatform.iOS:
      case TargetPlatform.macOS:
        return const WindowSizeConfigurationData.cupertino();
      case TargetPlatform.linux:
      case TargetPlatform.windows:
        return const WindowSizeConfigurationData.desktop();
    }
  }

I have not yet checked the edge case where one is targeting iOS AppleTV yet...good work thus far.

@YukiAttano
Copy link
Owner

Thanks for the info.

I am not familiar with the AppleTV platform (tvOS) but after some research, it is not officially supported by Flutter.

Beside that, the official AppleTV docs say they are using the same UserInterfaceSieClass like iOS and macOS so it should be ok like it is (at least tvOS is listed there and i did not find something else).

Fuchsia is set on purpose to use the "desktop" sizes.
The reason is, "compose" is a subset of "desktop" and so is using "desktop" always the better choice.
"compose" is only set for Android, as Androids documentation knows only the compose sizes.

The function does not make a difference for Web, as we are not using the "Platform" from dart:io but the "TargetPlatform" from "flutter/foundation.dart" which should be used to determine the UI.
Use ThemeData.platform (via Theme.of(context).platform) to get the current platform the UI should adopt to.

Unfortunately, i have not yet found a way to distinguish if the app is using a MaterialApp or CupertinoApp which would make more sense than using the current implementation that relies on the TargetPlatform.

In general, i recommend to build the application to fit all screen sizes defined by WindowSizes.material (the "desktop" sizes) but this is nearly always achieved by just supporting the "compose" sizes as most applications don't need to change their layout any further.
The only exception from this rule would be (as i currently think of as someone who has never used this scenario), if the CupertinoApp is used instead of an MaterialApp as those Apple designs are only made for the Apple specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants