Home > Software design >  How to use ColorFilter when the value is only true?
How to use ColorFilter when the value is only true?

Time:10-20

Hi I am trying to use ColorFilter when recommend is only true

GestureDetector(
            onTap: () {
              setState(() {
                recommend = !recommend;
                if (!recommend) {
                  both = false;
                  male = false;
                  female = false;
                }
              });
            },
            child: ColorFiltered(
              colorFilter: recommend
                  ? ColorFilter.mode(Colors.amber, BlendMode.saturation)
                  : ColorFilter.mode(Colors.white, BlendMode.saturation),)

How can i use CololrFilter when the recommend is only true ??

CodePudding user response:

try this:

colorFilter: recommend
              ? ColorFilter.mode(Colors.amber, BlendMode.saturation)
              : ColorFilter.mode(Colors.transparent, BlendMode.saturation),)
  • Related