import 'package:fis_jsonrpc/rpc.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:vnoteapp/components/cell.dart'; import 'package:vnoteapp/pages/controllers/crowd_labels.dart'; class CrowdLabelView extends GetView { const CrowdLabelView({super.key}); @override Widget build(BuildContext context) { return Container( padding: const EdgeInsets.only(bottom: 80), child: buildCrowdLables(context)); } Widget buildCrowdLables(BuildContext context) { return Obx(() { final state = controller.state; return SingleChildScrollView( child: Column( children: [ VListFormCellGroup( children: [ ...state.normalOptions .map((LabelDTO e) => buildItem(e, context)) .toList(), ...state.diseaseOptions .map((LabelDTO e) => buildItem(e, context)) .toList(), ...state.specialCareOptions .map((LabelDTO e) => buildItem(e, context)) .toList(), ], ), ], ), ); }); } Widget buildItem(LabelDTO dto, BuildContext context) { return InkWell( onTap: () { controller.onItemCheckChanged(dto.code!); }, child: Container( // margin: const EdgeInsets.symmetric(vertical: 8), child: Row( children: [ Expanded( child: VListFormCell( label: dto.labelName ?? '', contentWidget: Obx( () => Switch( value: controller.state.selectedCodes.contains(dto.code), onChanged: (value) { controller.onItemCheckChanged(dto.code!); }, activeColor: Theme.of(context).primaryColor, inactiveThumbColor: Colors.grey, // inactiveTrackColor:Colors.grey, ), ), ), ), ], ), ), ); } }