mahasCheckboxWidget function
Widget
mahasCheckboxWidget({
- MahasCheckboxModel? controller,
- String? label,
- void additionalOnChanged()?,
- bool readOnly = false,
Implementation
Widget mahasCheckboxWidget({
MahasCheckboxModel? controller,
String? label,
void Function(bool)? additionalOnChanged,
bool readOnly = false,
}) {
label ??= controller?.label;
return Row(
children: [
Transform.scale(
scale: MahasDimensions.getInputIconSize() / Checkbox.width,
child: Obx(
() => Checkbox(
focusNode: controller?.focusNode,
onChanged: readOnly
? null
: (bool? value) {
controller?.checked.value = value ?? false;
additionalOnChanged
?.call(controller?.checked.value ?? false);
},
value: controller?.checked.value,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
side: BorderSide(width: 0.5, color: MahasColors.greyColor),
activeColor: MahasColors.primaryColor,
),
),
),
if (label != null)
InkWell(
child: getCustomText(
label,
color: MahasColors.greyColor,
),
onTap: () {
if (!readOnly) {
controller?.checked.toggle();
}
},
)
],
);
}