buildSwitch method

Widget buildSwitch(
  1. String label,
  2. bool value,
  3. ValueChanged<bool> onChanged
)

Build a labeled switch

Implementation

Widget buildSwitch(
  String label,
  bool value,
  ValueChanged<bool> onChanged,
) {
  return Padding(
    padding: const EdgeInsets.symmetric(vertical: 8),
    child: Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        Text(label, style: const TextStyle(fontSize: 13)),
        Switch(
          value: value,
          onChanged: (v) {
            onChanged(v);
            onUpdate();
          },
          activeColor: Colors.blue,
        ),
      ],
    ),
  );
}