Untitled

mail@pastecode.io avatar
unknown
dart
2 years ago
1.9 kB
1
Indexable
Never
FlutterSwitch(
                  toggleBorder: Border.all(width: 2, color: Colors.black),
                  switchBorder: Border.all(width: 2, color: Colors.black),
                  activeText: "Müsait",
                  inactiveText: "Meşgul",
                  activeTextColor: Colors.black,
                  inactiveTextColor: Colors.black,
                  activeColor: Colors.green.shade600,
                  inactiveColor: Colors.red,
                  width: Constant.width * 0.15,
                  height: Constant.height * 0.09,
                  valueFontSize: Constant.width * 0.025,
                  toggleSize: Constant.height * 0.05,
                  toggleColor: Colors.amber,
                  value: isDriverAvailable,
                  borderRadius: 30.0,
                  padding: 12,
                  showOnOff: true,
                  onToggle: (val) async {
                    if (val) {
                      await WebServices.setAvailabilityStatus(0).then((value) {
                        if (value == null) {
                          setState(() {});
                        } else if (value == true) {
                          setState(() {
                            isDriverAvailable = true;
                          });
                        }
                      }); // musait =0 /   musait degil=1
                    } else {
                      await WebServices.setAvailabilityStatus(1).then((value) {
                        if (value == null) {
                          setState(() {});
                        } else if (value == true) {
                          setState(() {
                            isDriverAvailable = false;
                          });
                        }
                      }); // musait =0 /   musait degil=1
                    }
                  },
                )