We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When using your package, the state crashes immediately after I change theme like this:
DynamicTheme.of(context).setThemeData(Theme.of(context).copyWith( primaryColor: Colors.red, accentColor: Colors.red ));
This is the stack:
I/flutter (10924): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ I/flutter (10924): The following assertion was thrown building AnimatedTheme(duration: 200ms, dirty, state: I/flutter (10924): _AnimatedThemeState#921ab(ticker active, ThemeDataTween(ThemeData#5888e(primaryColor: I/flutter (10924): Color(0xffffb74d), primaryColorBrightness: light, accentColor: Color(0xffffb74d), I/flutter (10924): accentColorBrightness: light, indicatorColor: Color(0xffffffff), toggleableActiveColor: I/flutter (10924): Color(0xffffb74d), buttonTheme: ButtonThemeData#e64a2(buttonColor: Color(0xffe0e0e0), focusColor: I/flutter (10924): Color(0x1f000000), hoverColor: Color(0x0a000000), colorScheme: ColorScheme#7fe7a(primary: I/flutter (10924): MaterialColor(primary value: Color(0xff2196f3)), primaryVariant: Color(0xff1976d2), secondary: I/flutter (10924): Color(0xffffb74d), secondaryVariant: Color(0xff1976d2), background: Color(0xff90caf9), error: I/flutter (10924): Color(0xffd32f2f), onBackground: Color(0xffffffff)), materialTapTargetSize: I/flutter (10924): MaterialTapTargetSize.padded), toggleButtonsTheme: ToggleButtonsThemeData#ab29b, textTheme: I/flutter (10924): TextTheme#0bd0d, primaryTextTheme: TextTheme#0bd0d, accentTextTheme: TextTheme#0bd0d, I/flutter (10924): inputDecorationTheme: InputDecorationTheme#0f55d, iconTheme: IconThemeData#2abdc(color: I/flutter (10924): Color(0xdd000000)), primaryIconTheme: IconThemeData#a143c(color: Color(0xff000000)), I/flutter (10924): accentIconTheme: IconThemeData#a143c(color: Color(0xff000000)), sliderTheme: SliderThemeData#1ddfc, I/flutter (10924): tabBarTheme: TabBarTheme#50f35, tooltipTheme: TooltipThemeData#7cf4b, cardTheme: CardTheme#b4e63, I/flutter (10924): chipTheme: ChipThemeData#28bbd(secondarySelectedColor: Color(0x3dffb74d), secondaryLabelStyle: I/flutter (10924): TextStyle(debugLabel: (blackMountainView body2).copyWith, inherit: true, color: Color(0xdeffb74d), I/flutter (10924): family: Roboto, decoration: TextDecoration.none)), materialTapTargetSize: I/flutter (10924): MaterialTapTargetSize.padded, applyElevationOverlayColor: false, pageTransitionsTheme: I/flutter (10924): PageTransitionsTheme#afeaf, appBarTheme: AppBarTheme#4cc4f(color: Color(0x00000000), elevation: 0.0, I/flutter (10924): iconTheme: IconThemeData#5a49c(color: Color(0xffbdbdbd)), textTheme: TextTheme#86fdd(display4: null, I/flutter (10924): display3: null, display2: null, display1: null, headline: null, title: TextStyle(inherit: true, I/flutter (10924): color: Color(0xff000000)), subhead: null, body2: null, body1: null, caption: null, button: null, I/flutter (10924): subtitle): null, overline: null)), colorScheme: ColorScheme#7fe7a(primary: MaterialColor(primary I/flutter (10924): value: Color(0xff2196f3)), primaryVariant: Color(0xff1976d2), secondary: Color(0xffffb74d), I/flutter (10924): secondaryVariant: Color(0xff1976d2), background: Color(0xff90caf9), error: Color(0xffd32f2f), I/flutter (10924): onBackground: Color(0xffffffff))) → ThemeData#b4397(primaryColor: Color(0xffffb74d), I/flutter (10924): primaryColorBrightness: light, accentColor: Color(0xffffb74d), accentColorBrightness: light, I/flutter (10924): indicatorColor: Color(0xffffffff), toggleableActiveColor: Color(0xffffb74d), buttonTheme: I/flutter (10924): ButtonThemeData#e64a2(buttonColor: Color(0xffe0e0e0), focusColor: Color(0x1f000000), hoverColor: I/flutter (10924): Color(0x0a000000), colorScheme: ColorScheme#7fe7a(primary: MaterialColor(primary value: I/flutter (10924): Color(0xff2196f3)), primaryVariant: Color(0xff1976d2), secondary: Color(0xffffb74d), I/flutter (10924): secondaryVariant: Color(0xff1976d2), background: Color(0xff90caf9), error: Color(0xffd32f2f), I/flutter (10924): onBackground: Color(0xffffffff)), materialTapTargetSize: MaterialTapTargetSize.padded), I/flutter (10924): toggleButtonsTheme: ToggleButtonsThemeData#ab29b, textTheme: TextTheme#ee13f(display4: I/flutter (10924): TextStyle(debugLabel: (englishLike display4 2014).merge(blackMountainView display4), inherit: false, I/flutter (10924): color: Color(0x8a000000), family: Roboto, size: 112.0, weight: 100, baseline: alphabetic, I/flutter (10924): decoration: TextDecoration.none), display3: TextStyle(debugLabel: (englishLike display3 I/flutter (10924): 2014).merge(blackMountainView display3), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 56.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), display2: I/flutter (10924): TextStyle(debugLabel: (englishLike display2 2014).merge(blackMountainView display2), inherit: false, I/flutter (10924): color: Color(0x8a000000), family: Roboto, size: 45.0, weight: 400, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), display1: TextStyle(debugLabel: (englishLike display1 I/flutter (10924): 2014).merge(blackMountainView display1), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 34.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), headline: I/flutter (10924): TextStyle(debugLabel: (englishLike headline 2014).merge(blackMountainView headline), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 24.0, weight: 400, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), title: TextStyle(debugLabel: (englishLike title 2014).merge(blackMountainView I/flutter (10924): title), inherit: false, color: Color(0xdd000000), family: Roboto, size: 20.0, weight: 500, baseline: I/flutter (10924): alphabetic, decoration: TextDecoration.none), subhead: TextStyle(debugLabel: (englishLike subhead I/flutter (10924): 2014).merge(blackMountainView subhead), inherit: false, color: Color(0xdd000000), family: Roboto, I/flutter (10924): size: 16.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), body2: I/flutter (10924): TextStyle(debugLabel: (englishLike body2 2014).merge(blackMountainView body2), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 500, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), body1: TextStyle(debugLabel: (englishLike body1 2014).merge(blackMountainView I/flutter (10924): body1), inherit: false, color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 400, baseline: I/flutter (10924): alphabetic, decoration: TextDecoration.none), caption: TextStyle(debugLabel: (englishLike caption I/flutter (10924): 2014).merge(blackMountainView caption), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 12.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), button: I/flutter (10924): TextStyle(debugLabel: (englishLike button 2014).merge(blackMountainView button), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 500, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), subtitle): TextStyle(debugLabel: (englishLike subtitle I/flutter (10924): 2014).merge(blackMountainView subtitle), inherit: false, color: Color(0xff000000), family: Roboto, I/flutter (10924): size: 14.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic, decoration: TextDecoration.none), I/flutter (10924): overline: TextStyle(debugLabel: (englishLike overline 2014).merge(blackMountainView overline), I/flutter (10924): inherit: false, color: Color(0xff000000), family: Roboto, size: 10.0, weight: 400, letterSpacing: I/flutter (10924): 1.5, baseline: alphabetic, decoration: TextDecoration.none)), primaryTextTheme: I/flutter (10924): TextTheme#ee13f(display4: TextStyle(debugLabel: (englishLike display4 2014).merge(blackMountainView I/flutter (10924): display4), inherit: false, color: Color(0x8a000000), family: Roboto, size: 112.0, weight: 100, I/flutter (10924): baseline: alphabetic, decoration: TextDecoration.none), display3: TextStyle(debugLabel: (englishLike I/flutter (10924): display3 2014).merge(blackMountainView display3), inherit: false, color: Color(0x8a000000), family: I/flutter (10924): Roboto, size: 56.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), display2: I/flutter (10924): TextStyle(debugLabel: (englishLike display2 2014).merge(blackMountainView display2), inherit: false, I/flutter (10924): color: Color(0x8a000000), family: Roboto, size: 45.0, weight: 400, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), display1: TextStyle(debugLabel: (englishLike display1 I/flutter (10924): 2014).merge(blackMountainView display1), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 34.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), headline: I/flutter (10924): TextStyle(debugLabel: (englishLike headline 2014).merge(blackMountainView headline), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 24.0, weight: 400, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), title: TextStyle(debugLabel: (englishLike title 2014).merge(blackMountainView I/flutter (10924): title), inherit: false, color: Color(0xdd000000), family: Roboto, size: 20.0, weight: 500, baseline: I/flutter (10924): alphabetic, decoration: TextDecoration.none), subhead: TextStyle(debugLabel: (englishLike subhead I/flutter (10924): 2014).merge(blackMountainView subhead), inherit: false, color: Color(0xdd000000), family: Roboto, I/flutter (10924): size: 16.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), body2: I/flutter (10924): TextStyle(debugLabel: (englishLike body2 2014).merge(blackMountainView body2), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 500, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), body1: TextStyle(debugLabel: (englishLike body1 2014).merge(blackMountainView I/flutter (10924): body1), inherit: false, color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 400, baseline: I/flutter (10924): alphabetic, decoration: TextDecoration.none), caption: TextStyle(debugLabel: (englishLike caption I/flutter (10924): 2014).merge(blackMountainView caption), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 12.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), button: I/flutter (10924): TextStyle(debugLabel: (englishLike button 2014).merge(blackMountainView button), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 500, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), subtitle): TextStyle(debugLabel: (englishLike subtitle I/flutter (10924): 2014).merge(blackMountainView subtitle), inherit: false, color: Color(0xff000000), family: Roboto, I/flutter (10924): size: 14.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic, decoration: TextDecoration.none), I/flutter (10924): overline: TextStyle(debugLabel: (englishLike overline 2014).merge(blackMountainView overline), I/flutter (10924): inherit: false, color: Color(0xff000000), family: Roboto, size: 10.0, weight: 400, letterSpacing: I/flutter (10924): 1.5, baseline: alphabetic, decoration: TextDecoration.none)), accentTextTheme: I/flutter (10924): TextTheme#ee13f(display4: TextStyle(debugLabel: (englishLike display4 2014).merge(blackMountainView I/flutter (10924): display4), inherit: false, color: Color(0x8a000000), family: Roboto, size: 112.0, weight: 100, I/flutter (10924): baseline: alphabetic, decoration: TextDecoration.none), display3: TextStyle(debugLabel: (englishLike I/flutter (10924): display3 2014).merge(blackMountainView display3), inherit: false, color: Color(0x8a000000), family: I/flutter (10924): Roboto, size: 56.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), display2: I/flutter (10924): TextStyle(debugLabel: (englishLike display2 2014).merge(blackMountainView display2), inherit: false, I/flutter (10924): color: Color(0x8a000000), family: Roboto, size: 45.0, weight: 400, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), display1: TextStyle(debugLabel: (englishLike display1 I/flutter (10924): 2014).merge(blackMountainView display1), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 34.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), headline: I/flutter (10924): TextStyle(debugLabel: (englishLike headline 2014).merge(blackMountainView headline), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 24.0, weight: 400, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), title: TextStyle(debugLabel: (englishLike title 2014).merge(blackMountainView I/flutter (10924): title), inherit: false, color: Color(0xdd000000), family: Roboto, size: 20.0, weight: 500, baseline: I/flutter (10924): alphabetic, decoration: TextDecoration.none), subhead: TextStyle(debugLabel: (englishLike subhead I/flutter (10924): 2014).merge(blackMountainView subhead), inherit: false, color: Color(0xdd000000), family: Roboto, I/flutter (10924): size: 16.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), body2: I/flutter (10924): TextStyle(debugLabel: (englishLike body2 2014).merge(blackMountainView body2), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 500, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), body1: TextStyle(debugLabel: (englishLike body1 2014).merge(blackMountainView I/flutter (10924): body1), inherit: false, color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 400, baseline: I/flutter (10924): alphabetic, decoration: TextDecoration.none), caption: TextStyle(debugLabel: (englishLike caption I/flutter (10924): 2014).merge(blackMountainView caption), inherit: false, color: Color(0x8a000000), family: Roboto, I/flutter (10924): size: 12.0, weight: 400, baseline: alphabetic, decoration: TextDecoration.none), button: I/flutter (10924): TextStyle(debugLabel: (englishLike button 2014).merge(blackMountainView button), inherit: false, I/flutter (10924): color: Color(0xdd000000), family: Roboto, size: 14.0, weight: 500, baseline: alphabetic, decoration: I/flutter (10924): TextDecoration.none), subtitle): TextStyle(debugLabel: (englishLike subtitle I/flutter (10924): 2014).merge(blackMountainView subtitle), inherit: false, color: Color(0xff000000), family: Roboto, I/flutter (10924): size: 14.0, weight: 500, letterSpacing: 0.1, baseline: alphabetic, decoration: TextDecoration.none), I/flutter (10924): overline: TextStyle(debugLabel: (englishLike overline 2014).merge(blackMountainView overline), I/flutter (10924): inherit: false, color: Color(0xff000000), family: Roboto, size: 10.0, weight: 400, letterSpacing: I/flutter (10924): Loading flutter-ffmpeg. I/flutter (10924): Loaded flutter-ffmpeg-android-arm64-v8a. I/flutter (10924): 1.5, baseline: alphabetic, decoration: TextDecoration.none)), inputDecorationTheme: I/flutter (10924): InputDecorationTheme#0f55d, iconTheme: IconThemeData#2abdc(color: Color(0xdd000000)), I/flutter (10924): primaryIconTheme: IconThemeData#a143c(color: Color(0xff000000)), accentIconTheme: I/flutter (10924): IconThemeData#a143c(color: Color(0xff000000)), sliderTheme: SliderThemeData#1ddfc, tabBarTheme: I/flutter (10924): TabBarTheme#50f35, tooltipTheme: TooltipThemeData#7cf4b, cardTheme: CardTheme#b4e63, chipTheme: I/flutter (10924): ChipThemeData#28bbd(secondarySelectedColor: Color(0x3dffb74d), secondaryLabelStyle: I/flutter (10924): TextStyle(debugLabel: (blackMountainView body2).copyWith, inherit: true, color: Color(0xdeffb74d), I/flutter (10924): family: Roboto, decoration: TextDecoration.none)), materialTapTargetSize: I/flutter (10924): MaterialTapTargetSize.padded, applyElevationOverlayColor: false, pageTransitionsTheme: I/flutter (10924): PageTransitionsTheme#afeaf, appBarTheme: AppBarTheme#4cc4f(color: Color(0x00000000), elevation: 0.0, I/flutter (10924): iconTheme: IconThemeData#5a49c(color: Color(0xffbdbdbd)), textTheme: TextTheme#86fdd(display4: null, I/flutter (10924): display3: null, display2: null, display1: null, headline: null, title: TextStyle(inherit: true, I/flutter (10924): color: Color(0xff000000)), subhead: null, body2: null, body1: null, caption: null, button: null, I/flutter (10924): subtitle): null, overline: null)), colorScheme: ColorScheme#7fe7a(primary: MaterialColor(primary I/flutter (10924): value: Color(0xff2196f3)), primaryVariant: Color(0xff1976d2), secondary: Color(0xffffb74d), I/flutter (10924): secondaryVariant: Color(0xff1976d2), background: Color(0xff90caf9), error: Color(0xffd32f2f), I/flutter (10924): onBackground: Color(0xffffffff)))))): I/flutter (10924): 'package:flutter/src/painting/text_style.dart': Failed assertion: line 929 pos 12: 'a == null || b I/flutter (10924): == null || a.inherit == b.inherit': is not true. I/flutter (10924): Either the assertion indicates an error in the framework itself, or we should provide substantially I/flutter (10924): more information in this error message to help you determine and fix the underlying cause. I/flutter (10924): In either case, please report this assertion by filing a bug on GitHub: I/flutter (10924): https://github.com/flutter/flutter/issues/new?template=BUG.md I/flutter (10924): The relevant error-causing widget was: I/flutter (10924): MaterialApp file:///mnt/B4D0D63BD0D60410/Tvorba/stepslow/lib/main.dart:131:16 I/flutter (10924): When the exception was thrown, this was the stack: I/flutter (10924): #2 TextStyle.lerp (package:flutter/src/painting/text_style.dart:929:12) I/flutter (10924): #3 TextTheme.lerp (package:flutter/src/material/text_theme.dart:462:27) I/flutter (10924): #4 ThemeData.lerp (package:flutter/src/material/theme_data.dart:1226:28) I/flutter (10924): #5 ThemeDataTween.lerp (package:flutter/src/material/theme.dart:202:41) I/flutter (10924): #6 Tween.transform (package:flutter/src/animation/tween.dart:260:12) I/flutter (10924): #7 Animatable.evaluate (package:flutter/src/animation/tween.dart:53:46) I/flutter (10924): #8 _AnimatedThemeState.build (package:flutter/src/material/theme.dart:266:19) I/flutter (10924): #9 StatefulElement.build (package:flutter/src/widgets/framework.dart:4334:27) I/flutter (10924): #10 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4223:15) I/flutter (10924): #11 Element.rebuild (package:flutter/src/widgets/framework.dart:3947:5) I/flutter (10924): #12 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2432:33) I/flutter (10924): #13 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:773:20) I/flutter (10924): #14 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:283:5) I/flutter (10924): #15 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1102:15) I/flutter (10924): #16 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1041:9) I/flutter (10924): #17 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:957:5) I/flutter (10924): #21 _invoke (dart:ui/hooks.dart:259:10) I/flutter (10924): #22 _drawFrame (dart:ui/hooks.dart:217:3) I/flutter (10924): (elided 5 frames from class _AssertionError and package dart:async) I/flutter (10924): ════════════════════════════════════════════════════════════════════════════════════════════════════
The text was updated successfully, but these errors were encountered:
Getting the same problem
Sorry, something went wrong.
Switched to adaptive_theme package. Much better
I had this issue and solved it by not using the copyWith factory. Example:
Color primary = Colors.red; Color accent = Colors.red; DynamicTheme.of(context).setThemeData(ThemeData(primaryColor: primary, accentColor: accent));
Why this worked and the above did not I can only guess but I suspect the copyWith introduces some asynchronicity.
No branches or pull requests
When using your package, the state crashes immediately after I change theme like this:
This is the stack:
The text was updated successfully, but these errors were encountered: