checkbox method
Widget
checkbox(
{ - dynamic component,
- required double parentWidth,
})
Implementation
Widget checkbox({var component, required double parentWidth}) {
CheckboxController controller = CheckboxController();
return Visibility(
visible: (component["security"] == null)
? true
: (component["security"]["viewable"] == true)
? true
: false,
child: SizedBox(
width: (component["cssClass"] != null && component["cssClass"] != "")
? SwitchCase().componentWidthSC(
component["cssClass"],
{
"layout_1by8_col": parentWidth * 0.1,
"layout_1_col": parentWidth * 0.2,
"layout_2_col": parentWidth * 0.4,
"layout_3_col": parentWidth * 0.68,
"layout_4_col": parentWidth,
},
parentWidth * 0.2)
: parentWidth * 0.2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AltComponent().altComponentLabel(
component: component,
label: (component["displayLabel"] != null &&
component["displayLabel"] != "")
? component["displayLabel"]
: (component["security"] != null &&
component["security"]["fieldLabel"] != null &&
component["security"]["fieldLabel"] != "")
? component["security"]["fieldLabel"]
: component["label"]),
Padding(
padding: const EdgeInsets.only(bottom: 4.0),
child: Transform.scale(
scale: 0.7,
child: Obx(() {
return Checkbox(
mouseCursor: SystemMouseCursors.basic,
hoverColor: Colors.transparent,
value: controller.checked.value,
onChanged: (value) => controller.toggleCheckbox(value!),
side: const BorderSide(width: 0.5, color: Colors.black),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(2)));
}),
),
),
AltComponent().altComponentInstruction(component: component)
],
),
),
);
}