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
Dynamically changing Typography in ThemeData generates an error #103864
Comments
Hi @rydmike, Thanks for filing the issue. I am able to reproduce the assertion error when changing the typography on stable and the master channel. flutter doctor -v (mac)
logs
|
@xu-baolin thanks for addressing it in above PR, hope it works and yes this issue has been around since the beginning, glad if you can finally put it to rest! 👍🏻 |
Since @xu-baolin's PR was apparently not merged due to #103896 (comment) what is then next solution and when? Asking because I have things stuck on this issue since I can't dynamically toggle between themes that uses different Typography as long as this issue exists. |
@Hixie @LongCatIsLooong Hi, guys, Not sure if that principle applies to this issue. Many developers have reported this issue. |
* Deprecated m3TextTheme and use SDK built in Typography instead * Deprcate: FlexSubThemes.buttonTheme * Bump package versions * Update to use super.params, new in Dart 2.17 * Update LinkTextSpan to use Uri instead of deprecated url * Dep updates * Add larg FAB to theme showcase * Make Example custom themed Cards, also respect useMaterial3 * Add surfaceTint color to SchemeColor enum and functions * Add basic support for surfaceTint * Three more panel M3 useMaterial3 behavior added * Fix lint * Typo/comment corrections * Add support for Flutter 3.0 Theme Extensions * iOs and macOS * Bump package versions * DroidSans font not available anymore in Google Fons 3.0.0 package, replace with Fira Mono * Update change log and TODOs * Bump example version info * Opt-in sub theme toggleables now default to primary instead of secondary * Playground: Toggleable colors and efault text update. Add M3 switch to UI. * Playground: FAB fix of default text when using M3 * Remove not needed TODOs * Correct FAB color behavior when useMaterail3 is true * Doc and typo fixes * Playground app: Workaround for issue flutter/flutter#103864 * FAB component theme color indicator fix for useM3 * PopupMenu style change * M3 defaults support for NavigationBar * Fix Material theme showcase when using M3 * Themes Playground - update M3 presentation of Card * Update CHANGELOG.md * Doc updates * Doc updates * Doc updates * FIX NavigationRail M3 defaults * FIX test for new default rail size 14-12dp * Playground intro text update. Flutter version info update. * Doc updates * Doc updates * Doc updates * Add full support for surfaceTint color, so it is also used as FCS blend color. Needs tests! * Custom surfaceTint and surface blends support in Playground * Example fixes * Update CHANGELOG.md * Cleaning: Hashcode algo changed. Remove not needed finals. * Lint: Remove not needed finals. * HasCode: Change to Object.hash (used jenkins deprecated in master). * Set defaultUseMaterial3 = false due to Flutter issue 107190 To avoid having this issue visible as default in Theme Playground we default useMaterial3 until it is fixed or behaves better flutter/flutter#107190 * Initial/early support for M3 TextField style. * Update flex_theme_mode_switch.dart * Fix InputDecorator test. Update changelog date
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
When you toggle a theme between two
ThemeData
objects that have differentTypography
, the framework throws an assert error. This gets in the way of dynamically changingTypography
in an application.We can demonstrate the issue by making a light and dark theme that uses different
Typography
and switch between the light and dark theme.Consider this minimum reproduction sample:
Code sample
Expected results
Expect to be able to toggle theme from light to dark mode without any error:
Actual results
Instead we get the application transition from light to dark mode via this assert error:
This error can be observed on all Flutter channels/versions and platforms.
Copy of error message
Flutter doctor
The text was updated successfully, but these errors were encountered: