flutter-settings-ui icon indicating copy to clipboard operation
flutter-settings-ui copied to clipboard

How to get settingsListBackground from built SettingsList

Open banool opened this issue 2 years ago • 2 comments

I'm currently putting the SettingsList inside a Column with some other stuff. I want everything to have the same background color. I do not want to provide the background color via SettingsThemeData because I think the behavior in lib/src/utils/theme_provider.dart is great. How do I get the color from a built SettingsList? If I make an instance of SettingsThemeData(), the color is different from the built version, presumably because of the behavior from getTheme. Could we expose a buildThemeData method on SettingsThemeData / expose the theme data from SettingsList?

banool avatar Mar 04 '22 01:03 banool

Try this lightTheme: const SettingsThemeData(settingsListBackground: Colors.white),

ssthiago avatar Apr 04 '22 15:04 ssthiago

Hey @banool, if I understand you correctly, you want to get the SettingsList background color? If so, here is the code for an example of how to do it :

  1. Get themeData final themeData = ThemeProvider.getTheme( context: context, platform: platform, brightness: brightness)
  2. Now to get the background color, you can use themeData.settingsListBackground

P.S. If that's what you need, but I didn't explain it well, or it's not at all, tell me about it, and I'll try to help you.

M-ixai-L avatar Jun 03 '22 15:06 M-ixai-L

Hey so very late response here but I'm finding that what you suggest doesn't work @M-ixai-L.

First I get the themeData:

final themeData = Theme.of(context);

However there is no settingsListBackground field on it.

banool avatar May 30 '23 13:05 banool