|
@@ -1,3 +1,4 @@
|
|
|
+import 'package:fis_jsonrpc/rpc.dart';
|
|
|
import 'package:fis_ui/index.dart';
|
|
|
import 'package:flutter/material.dart';
|
|
|
import 'package:get/get.dart';
|
|
@@ -7,15 +8,12 @@ import 'package:vitalapp/managers/interfaces/models/crowd_labels.dart';
|
|
|
class VDialogLabelSelect extends StatefulWidget {
|
|
|
final List<String> selectedLabels;
|
|
|
final String title;
|
|
|
- final List<String> allCanSelectedLabels;
|
|
|
+ final List<LabelDTO> allLabels;
|
|
|
|
|
|
VDialogLabelSelect({
|
|
|
this.selectedLabels = const [],
|
|
|
this.title = "人群分类",
|
|
|
- this.allCanSelectedLabels = const [
|
|
|
- CrowdLabels.HYPERTENSION,
|
|
|
- CrowdLabels.TYPE2_DIABETES,
|
|
|
- ],
|
|
|
+ this.allLabels = const [],
|
|
|
});
|
|
|
|
|
|
@override
|
|
@@ -52,23 +50,24 @@ class VDialogLabelSelectState extends State<VDialogLabelSelect> {
|
|
|
Widget _buildContent(BuildContext context) {
|
|
|
return Wrap(
|
|
|
children: [
|
|
|
- ...widget.allCanSelectedLabels.map(
|
|
|
+ ...widget.allLabels.map(
|
|
|
(e) => _buildLabel(e),
|
|
|
),
|
|
|
],
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- void selectRaidoChange(e) {
|
|
|
- if (_currentSelectedLabels.contains(e)) {
|
|
|
- _currentSelectedLabels.remove(e);
|
|
|
+ void selectRaidoChange(LabelDTO e) {
|
|
|
+ var name = e.labelName!;
|
|
|
+ if (_currentSelectedLabels.contains(name)) {
|
|
|
+ _currentSelectedLabels.remove(name);
|
|
|
} else {
|
|
|
- _currentSelectedLabels.add(e);
|
|
|
+ _currentSelectedLabels.add(name);
|
|
|
}
|
|
|
setState(() {});
|
|
|
}
|
|
|
|
|
|
- Widget _buildLabel(String e) {
|
|
|
+ Widget _buildLabel(LabelDTO e) {
|
|
|
return Container(
|
|
|
padding: const EdgeInsets.all(7),
|
|
|
child: InkWell(
|
|
@@ -77,7 +76,7 @@ class VDialogLabelSelectState extends State<VDialogLabelSelect> {
|
|
|
child: Ink(
|
|
|
decoration: BoxDecoration(
|
|
|
border: Border.all(
|
|
|
- color: _currentSelectedLabels.contains(e)
|
|
|
+ color: _currentSelectedLabels.contains(e.labelName)
|
|
|
? Colors.blue
|
|
|
: Colors.black26,
|
|
|
),
|
|
@@ -94,7 +93,7 @@ class VDialogLabelSelectState extends State<VDialogLabelSelect> {
|
|
|
width: 200,
|
|
|
child: FittedBox(
|
|
|
child: Text(
|
|
|
- e,
|
|
|
+ e.labelName ?? '',
|
|
|
style: TextStyle(
|
|
|
fontSize: 20,
|
|
|
color: _currentSelectedLabels.contains(e)
|