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
Proposal : MaterialApp - Make MediaQuery be available while constructing app Theme #80931
Comments
@zs-dima |
@darshankawar thanks for reply Yes, it is not possible to set theme fonts sizes depends on MediaQuery.of(context).size.width and etc without workarounds I mention above. |
@darshankawar sure it is not. |
So MaterialApp force us to set theme as |
@zs-dima |
My proposal to make MediaQuery be available while we constructing app Theme. Simplest solution from my point of view is to make optional wrapping MaterialApp child with AnimatedTheme internally. Other solution could be to move MediaQuery over theme construction - then it will be |
@darshankawar thanks a lot for looking into the issue details and trying to solve it. |
I guess using |
@AbhishekDoshi26 therefore I suggesting to use |
I mean MaterialApp internal sub-tree - it could be constructed in better way |
@darshankawar thanks a lot for looking into this issue as I could not see changes are not in dev still It going to be MediaQuery>MaterialApp>AnimatedTheme however it could be nice to have MaterialApp>MediaQuery>AnimatedTheme ideally |
Reopening as the PR has been reverted (see #85223) |
MaterialApp theme builder have no possibility to use MediaQuery - so it could not be used in real-life apps without ugly workarounds.
App themes depends on current screen width / system theme type and etc.
I found workarounds that have own issues:
1.
but it duplicate
AnimatedTheme(data: ThemeData.light()
creation in the MaterialApp2.
but it duplicate MediaQuery creation (or alternative widget as sample above has no MediaQuery changes notifications for the theme) in the MaterialApp
Is there any simple way to disable duplicate AnimatedTheme creation for 1.? Could it be MaterialApp parameter or etc?
The text was updated successfully, but these errors were encountered: