|
|
@@ -14,9 +14,10 @@ class SettingsController extends GetxController {
|
|
|
.toActivityRulesQuery(IdRequest()..id = Int64(id))
|
|
|
.then((p0) {
|
|
|
rules.update((val) {
|
|
|
- for (final e in p0.list) {
|
|
|
+ for (final (i, e) in p0.list.indexed) {
|
|
|
val![e.arrId] = Rule()
|
|
|
..id = e.arrId
|
|
|
+ ..idx = i
|
|
|
..name = e.arName
|
|
|
..value = e.arType == 1
|
|
|
? (RuleValueBool()..value = e.arValue == 'true')
|
|
|
@@ -49,7 +50,7 @@ class DialogSettings extends GetView<SettingsController> {
|
|
|
content: Column(
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: [
|
|
|
- Obx(() => _list()),
|
|
|
+ Obx(() => _list(context)),
|
|
|
Padding(
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 45),
|
|
|
child: AppButton.confirm(
|
|
|
@@ -66,13 +67,16 @@ class DialogSettings extends GetView<SettingsController> {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- Widget _list() {
|
|
|
- return Column(
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
- children:
|
|
|
- controller.rules.value.values.map((data) => _RuleElem(data)).toList(),
|
|
|
- );
|
|
|
+ Widget _list(BuildContext context) {
|
|
|
+ final l = controller.rules.value.values.toList();
|
|
|
+ l.sort((a, b) => a.idx.compareTo(b.idx));
|
|
|
+
|
|
|
+ return SizedBox(
|
|
|
+ height: context.height * 0.6,
|
|
|
+ width: 420,
|
|
|
+ child: ListView(
|
|
|
+ children: l.map((data) => _RuleElem(data)).toList(),
|
|
|
+ ));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -102,7 +106,8 @@ class _RuleElem extends GetView<SettingsController> {
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
children: value.options
|
|
|
.map((e) => _Radio(
|
|
|
- value: e.show,
|
|
|
+ value: e.value,
|
|
|
+ show: e.show,
|
|
|
groupValue: value.value,
|
|
|
onChanged: (v) {
|
|
|
if (v != null) {
|
|
|
@@ -129,8 +134,12 @@ class _RuleElem extends GetView<SettingsController> {
|
|
|
|
|
|
class _Radio extends StatelessWidget {
|
|
|
const _Radio(
|
|
|
- {required this.value, required this.groupValue, required this.onChanged});
|
|
|
+ {required this.value,
|
|
|
+ required this.show,
|
|
|
+ required this.groupValue,
|
|
|
+ required this.onChanged});
|
|
|
final String value;
|
|
|
+ final String show;
|
|
|
final String groupValue;
|
|
|
final void Function(String?) onChanged;
|
|
|
|
|
|
@@ -144,7 +153,7 @@ class _Radio extends StatelessWidget {
|
|
|
value: value,
|
|
|
groupValue: groupValue,
|
|
|
onChanged: onChanged),
|
|
|
- Text(value),
|
|
|
+ Text(show),
|
|
|
],
|
|
|
);
|
|
|
}
|