revanced-manager/lib/ui/widgets/shared/haptics/haptic_checkbox.dart
Benjamin 7911459817
feat: add haptic feedback (#1459)
Co-authored-by: Ushie <ushiekane@gmail.com>
Co-authored-by: Pun Butrach <pun.butrach@gmail.com>
2024-01-14 14:29:24 -08:00

33 lines
739 B
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
class HapticCheckbox extends StatelessWidget {
const HapticCheckbox({
super.key,
required this.value,
required this.onChanged,
this.activeColor,
this.checkColor,
this.side,
});
final bool value;
final Function(bool?)? onChanged;
final Color? activeColor;
final Color? checkColor;
final BorderSide? side;
@override
Widget build(BuildContext context) {
return Checkbox(
value: value,
onChanged: (value) => {
HapticFeedback.selectionClick(),
if (onChanged != null) onChanged!(value),
},
activeColor: activeColor,
checkColor: checkColor,
side: side,
);
}
}