Skip to content

How to set a new scaffold background color with opacity #220

Answered by rydmike
luctc asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @luctc,

Thanks for your question and sorry for the delay.

Yes you are correct it will get black, that is expected. Just to first recap, here is how you can set scaffold background.

The FlexColorScheme.light/dark and FlexThemeData.light/dark all have a scaffoldBackground color property. If you know and have fixed color with a given opacity you can just assign it to that property.

If you want to based the scaffold background theme color, on some color being computed by FCS and apply som opacity to it, you can extract it and feed it back into the theme with `copyWith``

Here we extract the surface color and give it an opacity 0.5:

import 'package:flex_color_scheme/flex_color_scheme.dart';
i…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@rydmike
Comment options

@rydmike
Comment options

Answer selected by rydmike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question This issue is a usage question and will be moved to the Discussions section. works as expected Reported issue is not a bug, everything works as expected and designed
2 participants
Converted from issue

This discussion was converted from issue #218 on February 29, 2024 22:03.