lockItem function

Widget lockItem({
  1. required String title,
  2. required String subtitle,
  3. required bool on,
  4. Widget? trailing,
  5. required dynamic onToggle(
    1. bool value
    ),
  6. dynamic onTap()?,
})

Implementation

Widget lockItem(
    {required String title,
    required String subtitle,
    required bool on,
    Widget? trailing,
    required Function(bool value) onToggle,
    Function()? onTap}) {
  return ListItem(
      title: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(title,
              style: const TextStyle(
                  color: Colors.black,
                  fontSize: 14,
                  fontWeight: FontWeight.w400)),
          const SizedBox(
            height: 4,
          ),
          Text(
            subtitle,
            style: const TextStyle(fontSize: 13, color: textColor),
          ),
        ],
      ),
      trailing: trailing ??
          FlutterSwitch(
            width: 40.0,
            height: 20.0,
            valueFontSize: 12.0,
            toggleSize: 12.0,
            activeColor: Colors.white,
            activeToggleColor: Colors.blue,
            inactiveToggleColor: Colors.grey,
            inactiveColor: Colors.white,
            switchBorder:
                Border.all(color: on ? Colors.blue : Colors.grey, width: 1),
            value: on,
            onToggle: (value) => onToggle(value),
          ),
      dividerPadding: EdgeInsets.zero,
      onTap: onTap);
}