BirjuVachhani / adaptive_theme

Easiest way to add support for light and dark theme in your flutter app.
https://pub.dev/packages/adaptive_theme
Apache License 2.0
464 stars 37 forks source link

In flutter 3.10 AdaptiveThemeMode.system won't work as it should be. #46

Closed YonasAlem closed 1 year ago

YonasAlem commented 1 year ago

Describe the bug When the theme mode is AdaptiveThemeMode.system and the current phone's system theme is dark mode and when you launch the app it will display the dark theme. but while the app is opened and when you change the the phone's system theme to light mode the app will not reflect to the change. but after restart it will change to light mode.

but vice versa is still working fines, when you launch the app from light mode.

before flutter 3.10 it works as it should.

To Reproduce Steps to reproduce the behavior:

  1. make sure AdaptiveThemeMode.system is applied.
  2. if the app is opened close it.
  3. change the system theme to dark mode
  4. launch the app
  5. we will see the dark mode applied to the app
  6. change the systems theme to light mode while the app is opened.
  7. the UI won't change to light.
  8. but if I restart the app, the light mode will be applied.

Expected behavior when changing the systems theme from dark to light, the app should also react to that.

Screenshots No need.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

BirjuVachhani commented 1 year ago

Thank you @YonasAlem for reporting this issue. Would you also provide some additional info like what device and OS were you able to reproduce this on? was it a simulator or a real device?

YonasAlem commented 1 year ago

Real android device.

On Mon, 15 May 2023, 10:33 Birju Vachhani, @.***> wrote:

Thank you @YonasAlem https://github.com/YonasAlem for reporting this issue. Would you also provide some additional info like what device and OS were you able to reproduce this on? was it a simulator or a real device?

— Reply to this email directly, view it on GitHub https://github.com/BirjuVachhani/adaptive_theme/issues/46#issuecomment-1547333859, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZDK3MMD75P5X2BSHWPB6OLXGHL23ANCNFSM6AAAAAAYBV2ERQ . You are receiving this because you were mentioned.Message ID: @.***>

BirjuVachhani commented 1 year ago

@YonasAlem So I have dart theme enabled in system and adaptiveThemeMode.system selected in the app. I go to settings and tun off dark theme and then go back to the app and the app is in light theme now as expected. Am I doing anything wrong? Can you try to reproduce with the example app please?

https://github.com/BirjuVachhani/adaptive_theme/assets/20423471/d81a5131-da15-4f6a-a23e-feb4d6ce9b9e

YonasAlem commented 1 year ago

@BirjuVachhani I'm sorry for the delay. I found out that the problem was not in your package, instead it was another package called #flutter_screenutil. and they fixed it. and its all working now. sorry for misleading info on your package. thanks for your time.

BirjuVachhani commented 1 year ago

@YonasAlem No problem! Glad I could help!