-
Notifications
You must be signed in to change notification settings - Fork 307
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
StreamChatTheme is overriding app's ThemeData.colorScheme.secondary value #1801
Comments
This issue is stale because it has been open for 20 days with no activity. |
Is there a way to avoid having to use StreamChatThemeData. I find that it overrides my theme data as well, and it turned my floating action button from square to circle. Not sure if this was intended, I had set up themedata for my app quite nicely, see below, but now streamchatthemedata is overriding it. |
`import "package:flutter/material.dart"; class MaterialTheme { static MaterialScheme lightScheme() { ThemeData light() { static MaterialScheme lightMediumContrastScheme() { ThemeData lightMediumContrast() { static MaterialScheme lightHighContrastScheme() { ThemeData lightHighContrast() { static MaterialScheme darkScheme() { ThemeData dark() { static MaterialScheme darkMediumContrastScheme() { ThemeData darkMediumContrast() { static MaterialScheme darkHighContrastScheme() { ThemeData darkHighContrast() { ThemeData theme(ColorScheme colorScheme) => ThemeData( List get extendedColors => []; class MaterialScheme { final Brightness brightness; extension MaterialSchemeUtils on MaterialScheme { class ExtendedColor { const ExtendedColor({ class ColorFamily { final Color color; |
`class MyApp extends ConsumerWidget { @OverRide
} |
I solved the problem above by using the following:
|
the relevant line is useMaterial3: true, |
Hope this helps others experiencing similar issues. |
I recently included the StreamChatFlutter package into my project (I REALLY appreciate what you all have built for us!) and when I did, I immediately noticed that everywhere in my existing code where I was using
Theme.of(context).colorScheme.secondary
to style things had changed to a blue color (the beautiful "StreamChat blue")!I filed that little note away in my head and pressed forward to update the
StreamChatThemeData.colorScheme
details to style all the Stream components to my liking and they all look great now!But then I went around to the other parts of my app and realized all of my
...colorScheme.secondary
items were now using the color value I'd assigned toStreamChatThemeData.colorScheme.accentPrimary
instead of what I'd defined my app's ThemeData.So I poked around thru the StreamChat package to see what was going on and found where the Theme that wraps the returned StreamChat widget assigns a new value to the app Theme's
...colorScheme.secondary
attribute on Line 123 of ~lib/src/stream_chat.dart. (link to that line of the code)stream-chat-flutter/packages/stream_chat_flutter/lib/src/stream_chat.dart
Line 123 in f19f6a7
I commented that line out locally and that fixed the color/styling of my "non-StreamChat" widgets that use the app's
Theme.of(context).colorScheme.secondary
and now I am able to use the color I've defined inStreamChatThemeData.colorScheme.accentPrimary
to style the StreamChat widgets as expected.Please consider either removing that line or conforming to the MaterialTheme standard a little more closely (using a Primary and Secondary color scheme for styling/accenting... also
accentPrimary
is deprecated in the MaterialTheme spec).I want to reiterate how much I appreciate what the team has built for us! Keep up the great work!
The text was updated successfully, but these errors were encountered: