-
We are now up to 3.2k active installs on tipitaka pali reader. (buddhist sun ~500).. and then other os's maybe 800. The app title "TIpitaka Pali Reader" should have the app bar theme color (in m2 it does). Much appreciation for you color theme package. |
Beta Was this translation helpful? Give feedback.
Replies: 25 comments 13 replies
-
What I would like is either the floating action button color or the bottom navbar color or the card color. However, I tried adding the colors based on those themes but they are white. |
Beta Was this translation helpful? Give feedback.
-
Hi @bksubhuti, With Change it either via the older API and more limited color options directly in theme: FlexThemeData.light(
scheme: FlexScheme.barossa,
appBarStyle: FlexAppBarStyle.primary,
useMaterial3: true,
), Or via the newer theme: FlexThemeData.light(
scheme: FlexScheme.barossa,
subThemesData: const FlexSubThemesData(
appBarBackgroundSchemeColor: SchemeColor.primary,
),
useMaterial3: true,
), Note that theme: FlexColorScheme.light(
scheme: FlexScheme.barossa,
subThemesData: const FlexSubThemesData(
appBarBackgroundSchemeColor: SchemeColor.primary,
),
useMaterial3: true,
).toTheme, With the newer API above you can use any of your theme's
You will need to define desired color separately the
Latest version of Themes Playground where you can try different themes and see what code it makes for the theme and even copy paste the code can be found here: https://rydmike.com/flexcolorscheme/themesplayground-latest/ The FlexColorScheme docs also contain a lot of useful theming guidance, not only info on how to use The ColorScheme in Material3 is quite a complex topic. It is a good idea to study it further in the Material 3 guide https://m3.material.io/styles/color/the-color-system/key-colors-tones |
Beta Was this translation helpful? Give feedback.
-
I was able to manually change the appbar color .. in the appbar background color property.
but trying to get that pastel pink was not successful..
I appreciate your response.. I'll play a little more tomorrow. We are quite busy with studying for final exams. but I took a break to try this theme thing. The themes were easy to change to material 3. |
Beta Was this translation helpful? Give feedback.
-
I jumped on the playground.. but it is a little complex. I looked at the app bar.. and it seemed to change color to the pastel version of the primary color. But that was only in the playground.. by default (in the theme without doing anything), I only get white for the appbar. |
Beta Was this translation helpful? Give feedback.
-
I think the easiest thing to do .. would be to just keep everything standard with the theme and change the app bars to a matching pastel version of the primary.. but finding that pastel of the theme is not working for me. |
Beta Was this translation helpful? Give feedback.
-
also same with almost anything I choose..
|
Beta Was this translation helpful? Give feedback.
-
Through some trial and error.. I was able to find out that below worked. |
Beta Was this translation helpful? Give feedback.
-
What you are doing earlier above: AppBar(
backgroundColor: Theme.of(context).cardColor,
title: Row( is not theming, what you are doing above is trying to assign colors from You can certainly do that, but it is not theming the application and its components and it will not change the default color of all
Another issue with your color assignments to the So for example: backgroundColor: Theme.of(context).bottomAppBarTheme.color; or backgroundColor: Theme.of(context).floatingActionButtonTheme.backgroundColor; Unless your app has specified colors for those component theme colors in Depending on how you have made your Different Material widgets use different colors for different parts of the widget in question from the To design a theme, you typically start with defining a Using your active theme colorsIf you want to use the colors that your theme has defined, you should use them from Seed generated ColorSchemeTo get beautiful Here is an example. theme: FlexThemeData.light(
// This with predefined `scheme` color, but works with custom `colors` API too. As a 3rd
// option FlexColorScheme can also accept a full predefined `ColorScheme` as input via
// its `colorScheme` property.
scheme: FlexScheme.barossa,
// This will make your app bars primary colored in both M2 and M3 mode.
appBarStyle: FlexAppBarStyle.primary,
// Enable seed generated color scheme, this also works if you defined your colors
// with the `colors` property instead of `scheme`.
keyColors: const FlexKeyColors(
// Used `scheme` or `colors`, primary color is always used as key color to seed
// generate the `ColorScheme` below we also use secondary and tertiary colors as
// input to the seed generation.
useSecondary: true,
useTertiary: true,
// Keep the primary, secondary and tertiary as defined in scheme/colors, but
// use them as key seeds for each palette. This is only a good idea if the
// used colors are designed to be used for the active theme mode light or dark.
keepPrimary: true,
keepSecondary: true,
keepTertiary: true,
),
// This defines the strategy of the used M3 color scheme seeding algorithm.
// It impact how colorful, bright, pastel-like or matte the produced colors are
// It also controls how M3 surface tint is made and which tonal palette tone
// is mapped to which `ColorScheme` color. It comes with a large number of premade
// configs, feel free to try them, but you can also make your own setups with the API.
//
// Seed generated color schemes includes their own M3 take on surface tint and blends. If
// you also use `surfaceMode` and `blendLevel` they are added on top of what the seed
// generated M3 `ColorScheme` already added and it might become a bit too much.
// If so, reduce the `blendLevel` value, if set to `0` you get the result as produced
// by the seed generation. Different M3 tone strategies have different surface tint, like
// using more or less `blendLevel`.
tones: FlexTones.candyPop(Brightness.light),
useMaterial3: true,
), Well anyway, I guess that is enough for now. No worries, I'll keep providing guidance until it clicks. One next step would be to show you some examples using your code. If it is still open source I can certainly do that. 😄 🙏🏻 |
Beta Was this translation helpful? Give feedback.
-
okay.. I understand a little more. I wanted to play with it and see how it looked "hardcoding it to the app bar". I plan on making custom themes like you showed in an example. I'll let you know when that happens. At least I understand what it looks like and can go from there. I think early on.. when we first worked on this.. we didn't have that "flex" .. and that is why you made coloredText for me. |
Beta Was this translation helpful? Give feedback.
-
You can hard code the color into the example backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.surface, // or alt try `onPrimary`. It is not themed globally then, but the If some or one Themes Playgroundhttps://rydmike.com/flexcolorscheme/themesplayground-latest/ You can put your custom colors into the Themes Playground too. You don't have to, but you can if you want see them there and experiment with them. Then you can configure and style everything else too the way you want it to look visually in the Playground. If set the view to show the code on right side, and select a panel where you modify some aspects, you can observe what code it adds/changes for each operation, a nice way to learn the API, if so desired. Themes Playground will generate the needed theme code, when you are done, you can copy-paste that code and only use the parts are new/different from your current FCS theme setup. A simple way to learn more about using Themes Playground to configure FlexColorScheme API is to study recent Tweet thread guides that you can easily find here: https://docs.flexcolorscheme.com/tweets Starting e.g. with version 7.0 guide, click on the embedded tweet link: https://docs.flexcolorscheme.com/tweets#version-7 And version 7.2 https://docs.flexcolorscheme.com/tweets#version-72 There are also some guides, like understanding ColorScheme A long theme story examples, with videos: A platform agnostic theme example (screenshots): |
Beta Was this translation helpful? Give feedback.
-
yes.. our code is FOSS except where data liimits. I'd like to have some custom theme colors (especially the fun monk and nun names) and use the nonstandard material 3 appbar with a hybrid of appbar but it matching the pastel stuff. like this Theme.of(context).primaryColorLight, or the same as the floating action button. Something that sort of matches. We have a flexdata file in our data folder. I'm not sure how it works. |
Beta Was this translation helpful? Give feedback.
-
okay.. i don't think i'll be able to sleep until this is finished.. haha.. One of the developers seems to have made a theme for orange 2 (or maybe it is yours..?). There is another toledo purple. I guess if you give me one theme that has a a color and a lighter version for the appbar, then I can duplicate it. But if I make the appbar color red in the theme.. it does not show up.. static const FlexSchemeColor myScheme1Light = FlexSchemeColor( I don't understand much of this file which is located here. it seems like there are many steps to this. |
Beta Was this translation helpful? Give feedback.
-
I created more themes with my names.. but I still don't understand the subtheme way to make an appbar appear. The Theme change notifier code is here. I'd also like to make a switch for useMaterial3 as well.. based off of my hacky Prefs.useMaterial3 sort of global variable on user prefs.
|
Beta Was this translation helpful? Give feedback.
-
Yes FlexColorScheme (FCS) contains many different APIs to adjust things, it can certainly be confusing. But no worries, lets look at what seems to be relevant for your use case. Since you are using the So let's take a look how to develop it a bit. You have this: FlexColorScheme.light(
// As scheme colors we use the one from our list
// pointed to by the current themeIndex.
colors: myFlexSchemes[Prefs.themeIndex].light,
// Medium strength surface branding used in this example.
surfaceMode: FlexSurfaceMode.highScaffoldLowSurface,
visualDensity: FlexColorScheme.comfortablePlatformDensity,
textTheme: _textTheme,
useMaterial3: true,
).toTheme; And since I see that a lot of your FlexColorScheme.light(
// As scheme colors we use the one from our list
// pointed to by the current themeIndex.
colors: myFlexSchemes[Prefs.themeIndex].light,
// Use the custom color for app bar define in `FlexSchemeData.appBarColor` as
// themed color of the AppBar.
appBarStyle: FlexAppBarStyle.custom,
// Medium strength surface branding used in this example.
surfaceMode: FlexSurfaceMode.highScaffoldLowSurface,
visualDensity: FlexColorScheme.comfortablePlatformDensity,
textTheme: _textTheme,
useMaterial3: true,
).toTheme; The If you have not set the If the Always using and defining an Optional more
|
Beta Was this translation helpful? Give feedback.
-
Wow.. I'm very impressed.. I'm starting to digest and understand the playground and the app data. and the FlexThemeData.light() So this code below works.. So.. I think you can close the issue.. the code below works for me after I make a switch.
|
Beta Was this translation helpful? Give feedback.
-
If you are in Sri Lanka or near it .. give a buzz.. my username is my google email. If you google our app you will find my website too. americanmonkDOTorg, I love your dedication for your theme and helping others. Your theme will be even more popular with this future m3 enforcement. We are a study monastery in elephant land and a hot climate. I have spent half my time in myanmar and Sri lanka if you need travel advice. We always have extra food.. you can stop by for lunch if I'm there or not. (but let me know first). |
Beta Was this translation helpful? Give feedback.
-
Happy if you are learning more about theming and are now able to get the result you want. 😄 🙏🏻 You don't need to go all in on using the Material3 made Material2 style, just to get the AppBar color fixed to be as it was before, as shown in other examples. Of course to know how to make what you had before I would need to try it in M2 and M3 mode, but correct appBarStyle selection in light and dark mode should be able to fix to be same as before. Basically setting Also do note that "Material2" look alike style made by FCS built in sample, is not the same as as the FCS Material2 defaults you had before. The example is more of default standard Material2 style. The old FCS default for Material2 contained a number of opinionated own custom defaults, so you will see a lot of differences if you use that. It is possible to configure Material3 mode to be like previous FCS M2 defaults, but there is no preconfigured example for it. The examples I added above should actually already be closer to what you had before than the full "native" old Material2 default design. What you might need to add is custom FAB color, since it defaults to By the way, I'm not sure what you meant with:
It is not something that I have observed when using FlexColorScheme. I have not tried building your app, so I have not looked at its details recently. |
Beta Was this translation helpful? Give feedback.
-
I'm going to close this issue, and move it to be preserved just as discussion in the FAQ section, where others can find it and learn from it too. We can continue the discussion there! 😄 |
Beta Was this translation helpful? Give feedback.
-
You can see that the top nav bar is black in M3 mode. However, merely changing the appbar color will give a dark color on black writing. (pali, aṭṭhakatha, ṭīka, añña) Furthermore, the selected itme disappears totally. I think you can "visualize" what problem I had by just changing the app bar style which also affects this screen. So that was when I just decided to have the standard kept. I might also have a "light" and "transparent" appbarstyle.custom option as well.. that works. |
Beta Was this translation helpful? Give feedback.
-
Hi again @bksubhuti 😄 Sorry, I can't really see what you mean from the screen shot above, it looks incomplete. Perhaps you are referring to the AppBar not having foreground and background colors that makes the foreground text and items on it legible? If you are setting AppBar colors and theming it with FSC, it will set the foreground color to a good default contrast color by design for the selected and used background color. This is not automatic in Flutter, FCS is just designed to do that correctly for you behind the scenes. However, if you are setting There are so many examples of what you can do already with AppBar, and you can do any color design you want on it. I'm not sure I can describe it in much more detail than what has already been said. Please study the replies and go through the details in them, maybe you missed some parts in them. What I can do is of course, is if you tell me or even better show me exactly how you want it too look and what colors you want where, with one concrete example, I can show you how to make that one example. At the moment I think I have already done so many times, but I am not sure you have tried them correctly. Recommended Theme Code ExampleBased on what I think you had before when using FCS in M2 mode, something like this for your app may work well for light mode when using Material-3 and keep the app looking close to what it did like before in FCS Material-2: FlexThemeData.light(
colors: myFlexSchemes[Prefs.themeIndex].light,
surfaceMode: FlexSurfaceMode.highScaffoldLowSurface,
blendLevel: 1,
appBarStyle: FlexAppBarStyle.primary,
subThemesData: const FlexSubThemesData(
blendOnLevel: 10,
blendOnColors: false,
useTextTheme: true,
useM2StyleDividerInM3: true,
elevatedButtonSchemeColor: SchemeColor.onPrimaryContainer,
elevatedButtonSecondarySchemeColor: SchemeColor.primaryContainer,
inputDecoratorSchemeColor: SchemeColor.primary,
inputDecoratorBackgroundAlpha: 23,
inputDecoratorRadius: 10.0,
fabUseShape: true,
fabAlwaysCircular: true,
fabSchemeColor: SchemeColor.secondary,
alignedDropdown: true,
useInputDecoratorThemeInDialogs: true,
appBarScrolledUnderElevation: 0.0,
),
keyColors: const FlexKeyColors(
useSecondary: true,
useTertiary: true,
keepPrimary: true,
keepSecondary: true,
keepTertiary: true,
),
tones: FlexTones.candyPop(Brightness.light),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
textTheme: _textTheme,
useMaterial3: true,
); In dark mode you could try the one below. The colors will be a bit different than what you had in FCS M2 mode, but they should look OK. FlexThemeData.dark(
colors: myFlexSchemes[Prefs.themeIndex].dark,
surfaceMode: FlexSurfaceMode.highScaffoldLowSurface,
blendLevel: 2,
subThemesData: const FlexSubThemesData(
blendOnLevel: 20,
useTextTheme: true,
useM2StyleDividerInM3: true,
elevatedButtonSchemeColor: SchemeColor.onPrimaryContainer,
elevatedButtonSecondarySchemeColor: SchemeColor.primaryContainer,
inputDecoratorSchemeColor: SchemeColor.primary,
inputDecoratorBackgroundAlpha: 28,
inputDecoratorRadius: 10.0,
fabUseShape: true,
fabAlwaysCircular: true,
fabSchemeColor: SchemeColor.secondary,
alignedDropdown: true,
useInputDecoratorThemeInDialogs: true,
),
keyColors: const FlexKeyColors(
useSecondary: true,
useTertiary: true,
),
tones: FlexTones.candyPop(Brightness.dark),
visualDensity: FlexColorScheme.comfortablePlatformDensity,
textTheme: _textTheme,
useMaterial3: true,
); The above are both using seed generated M3 ColorScheme to make it work and look better in Material-3 mode. It works with your keyColors: const FlexKeyColors(
useSecondary: true,
useTertiary: true,
keepPrimary: true,
keepSecondary: true,
keepTertiary: true,
), Further below, I show how to make the above definitions in Themes Playground, most of it anyway: Material 3As I tried to explain, the color system and color defaults between Material2 and Material3 are completely different. Developers making Google Material-3 design using app should basically study and read this entire site: https://m3.material.io/. Of course, the look used in theM3 design guide, is the pure "M3" design. When you design your own Material-3 mode using app in Flutter, you don't have to stick with these defaults. You can change and customize them to look as you want them to look. Themes Playground can be used to customize a lot of features, but no everything, something have to be added with its API or using In Material-3 shapes are also very different from M2. However, since you have used FCS M2 custom design defaults before, many shapes are the same in M3 as it was in FCS opinionated defaults for M2, since its custom M2 design tried to emulate M3 shape design, way before M3 was public and ready to be used in Flutter. We can use Themes Playground to demonstrate this: Using e.g. the built in Rosewood color theme It will look like this in FCS when using Material 2 mode
The FCS defaults are quite different from "raw" real Material-2 design, which would look more like this:
When you enable Material-3 and do not seed generate the color scheme, but use it as it was defined for M2 mode, the demo app will look like this:
When you enable Material3 based seed generation the ColorScheme will change to this, using only the primary color as seed color and the M3 color algo: The demo app using these colors will look like this:
You can change it to use, also secondary and tertiary input colors (your custom colors) as seed inputs, and lock the seed colors down to be used for their namesake colors. You can also use a seed generation strategy the makes more colorful colors that default M3, e.g. Candy pop, but feel free to try others: If you do this, the demo app will look like this:
FABAfter this, more things you may want to do is set the shape of FAB back to circular, and tell it to use secondary color as it did in M2: TextFieldAlso the You will need to set the fill color and opacity separately for dark mode. ButtonsButtons have new color mapping, basically the AppBarThen AppBar, if you want primary color in M3 mode on it in light mode, then set it here: To not get any scroll under elevation tint, keep both scroll under elevation and elevation at 0. You will need to define your dark mode AppBar separately, here I don't know what you want, but I recommend keeping defaults, which is dark surface color, and also keeping the default scroll under elevation tint. It is very useful when using a dark AppBar background in dark mode. It is also very useful, when keeping a light AppBar in light mode, but if you go with primary color there, then removing it is appropriate. ResultDoing all this will make the demo app look like this:
This is just one example of customizations you can do. You can experiment with Themes Playground and copy code from it. Just remove the The theme setup code presented earlier above, contain all the above customization, but uses your More M3 AppBarIn pure Material-3 design the AppBar is intended to be background colored (colorScheme.surface color), and it changes color slightly when you scroll things under it to create a separation between the background and the AppBar. The surface colored AppBar is inspired from modern iOS design and the slight scroll under tint is a M3 addition. This is an example of what that looks like: Screen.Recording.2023-10-15.at.20.29.38.movYou can read about it in the Google Material3 guide here: |
Beta Was this translation helpful? Give feedback.
-
You have made more information available.. I appreciate it. So when I plugged in the prefs and a switch.. The screen with the switch would work, but it would close the screen and move to home..(which I didn't notice at first) the themedata and theme changed though.. However, when I went back into the screen it would assert... the assertion message is below. Exception has occurred.
The above message is directly correlated with changing the theme as I described in previous code. Changing the color as we always had does not affect this. The switch or even a button that changes the theme of m3 or m2-fake will cause this. Or even doing useMateria: false/true will do this too. If I disconnect the button but leave the ui, it does not give the assertion. So I think I might be doing something wrong. The animation might be related to the settings screen for a separate settings expansion panel becaues there is some scroll controller to push expaneded menu to be visible, when it is expanded. I noticed that the code from the playground had the heading scheme: and then a hard coded standard theme you had. However, that did not work for me.. and it seemed to accept and implement colors: in my code for the indexing.
However.. your playground is also your fcs "testingplayground" and you do everything that could possibly break your theme and it survives. So maybe the code and the way I'm doing things is causing this error. |
Beta Was this translation helpful? Give feedback.
-
actually.. it is probably something I'm doing wrong on provider.. I'll have to put this all on hold.. I 'm losing my study time.. I'll get back to you later on this. |
Beta Was this translation helpful? Give feedback.
-
I pushed a fake .env file and pulled into a new fresh test directory. I copied the split db files and built linux and apk release builds with no errors. The release desktop version works.. but it closes the settings view. Debug desktop will assert. |
Beta Was this translation helpful? Give feedback.
-
You will see that onchange of switch is causing the settings view to pop. Then return to the settings.. It causes assert. 2023-10-16.21-29-27.mp4 |
Beta Was this translation helpful? Give feedback.
-
Unrelated, but here was good new question about using true black in dark mode and generally tuning of dark mode style, that I just answered. It became a little Themes Playground tutorial on the topic, thought it might interest you as well. 😄 |
Beta Was this translation helpful? Give feedback.
Yes FlexColorScheme (FCS) contains many different APIs to adjust things, it can certainly be confusing. But no worries, lets look at what seems to be relevant for your use case.
Since you are using the
colors
API, and a list of them, we have good option via it. This is btw a very good and simple way to define key custom colors and color theme options that users can choose from, nicely done! 😄So let's take a look how to develop it a bit. You have this: