Pyozer/flutter_material_color_picker

Color Expansion: No Shades available

Opened this issue · 0 comments

Hey, so I've noticed that selecting shades in not available when the colour selector is in an ExpansionTile. Not 100% certain if you may have noticed this when using the package, it may very well be my set up that has the issue. Thanks in advance for taking the time 😄

Here's how I've currently set it up in my project:

_colorSelector(String title, Settings prefs, String attr) {
    return ExpansionTile(
      title: Text.rich(
        TextSpan(
          text: title,
        ),
      ),
      children: <Widget>[
        _generateColor(_getColor(attr), prefs),
      ],
      trailing: CircleColor(
        color: prefs.colors[_getColor(attr)],
        circleSize: 25 * (prefs.scale / 2),
      ),
    );
  }

What generate color does :

_generateColor(int colorSetting, Settings prefs) {
    return MaterialColorPicker(
      allowShades: true,
      circleSize: 75 * (prefs.scale),
      onColorChange: (Color color) {
        prefs.themeData = ThemeData(
            primaryColor: (colorSetting == 0) ? color : prefs.colors[0],
            primarySwatch: (colorSetting == 0)
                ? MaterialColor(
                    color.value,
                    toSwatch(color.value),
                  )
                : MaterialColor(
                    prefs.colors[0].value,
                    toSwatch(prefs.colors[0].value),
                  ),
            brightness: (prefs.darkMode) ? Brightness.dark : Brightness.light,
            accentColor: (colorSetting == 1) ? color : prefs.colors[1],
            accentColorBrightness: prefs.themeData.accentColorBrightness,
            splashColor: (colorSetting == 2) ? color : prefs.colors[2]);
      },
      // onMainColorChange: (ColorSwatch color) {
      //   prefs.themeData = ThemeData(
      //       primaryColor: (colorSetting == 0) ? color : prefs.colors[0],
      //       primarySwatch: (colorSetting == 0)
      //           ? MaterialColor(
      //               color.value,
      //               toSwatch(color.value),
      //             )
      //           : MaterialColor(
      //               prefs.colors[0].value, toSwatch(prefs.colors[0].value)),
      //       brightness: (prefs.darkMode) ? Brightness.dark : Brightness.light,
      //       accentColor: (colorSetting == 1) ? color : prefs.colors[1],
      //       accentColorBrightness: prefs.themeData.accentColorBrightness,
      //       splashColor: (colorSetting == 2) ? color : prefs.colors[2]);
      // },
      selectedColor: prefs.colors[colorSetting],
    );
  }