samedi 18 mars 2023

How do I change the color of the checkbox to a gradient in Flutter?

I'm trying to implement a beautiful CheckBox with a gradient color in a flutter Tell me, is there a way to somehow specify Linear Gradient instead of active color without messing with the Container color?

my checkbox code

CheckBox code:

ValueListenableBuilder CheckSex(ValueNotifier<String?> sexNotifier) {
  return ValueListenableBuilder(
    valueListenable: sexNotifier,
    builder: (context, pickedSex, child) {
      return Row(
        children: ["Мужской", "Женский", "Другой"].map((String sex) {
          return Row(
            children: [
              Text(sex),
              Checkbox(
                activeColor: Colors.indigo[500],
                value: sex == pickedSex,
                onChanged: (pick) {
                  sexNotifier.value = sex;
                },
              ),
            ],
          );
        }).toList(),
      );
    },
  );
}



Aucun commentaire:

Enregistrer un commentaire