Skip to content

Y Scale #208

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
ali77gh opened this issue Nov 23, 2021 · 4 comments
Closed

Y Scale #208

ali77gh opened this issue Nov 23, 2021 · 4 comments

Comments

@ali77gh
Copy link

ali77gh commented Nov 23, 2021

Hi.
First of all thank you for making this project public, its really helping.


The problem is:
I have a 1280px x 720px display (ratio is 16x9).
but its 256mm x 163mm (ratio is 14x9).

So when i try to render a square it actually shows a rectangle (its taller then what it should be).

Then i tried to run program with -d switch:

flutter-pi -d "256, 163" ./fps_assets/

It actually not changing ratio and just effects on widget sizes, and i tried to randomly increase and decrease sizes and ratio is not changing.

@ardera
Copy link
Owner

ardera commented Nov 24, 2021

The issue is that your screen has non-square pixels (the official pi screen has too). That's actually an open problem in flutter right now: flutter/flutter#71865

Theoretically I could add a "framebuffer size" argument to flutter-pi, so you can set some custom framebuffer size (that's a bit shorter/longer in the y direction) and then scale to framebuffer to fit the screen accordingly, but that's not optimal. text & edges generally will probably look blurry

Best way to fix this is actually in the flutter app. See flutter/flutter#32115 (comment) for example. You can inject that widget into your app using the MaterialApp.builder property. (It's not perfect though, see the replies in that issue)

You can change this to only scale in the y direction, then it should work

@ali77gh
Copy link
Author

ali77gh commented Nov 27, 2021

@ardera
Thanks for your replay.

I fixed this by using this class.
It actually using Scale Y but you should provide physical width and height of your screen in millimeters.

And it my fixed in flutter some day here.

@ali77gh ali77gh closed this as completed Nov 27, 2021
@Arka2009
Copy link

@ali77gh , First of all thanks for the invaluable code snipet.
I am unable to compile your code. I encounter error "Target URI doesn't exist: package:fps/build_conf.dart".

Can you help me out how, to fix this?

Below is my pubspec.yaml

name: test2_web
description: A new Flutter project.
version: 1.0.0+1

environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
flutter_gpiod: ^0.4.0-nullsafety
flutter_fps: ^0.1.1

dev_dependencies:
flutter_test:
sdk: flutter

@ali77gh
Copy link
Author

ali77gh commented Mar 20, 2022

Hello @Arka2009.

  1. Remove the import line

  2. Replace physicalScreenSize with your screen size(in millimeters)

I hope it helps🙂.

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

3 participants