1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- 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<CrowdLabelsController> {
- 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,
- ),
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
- }
|