You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.4 KiB

import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import '../../../core/utils/logger.dart';
import '../../../routes/app_routes.dart';
import '../views/widgets/row_confirm_widget.dart';
import '../views/widgets/row_input_widget.dart';
import '../views/widgets/row_radio_widget.dart';
class EqSettingsController extends GetxController {
final RxList uiList = [
{
'title': '音效',
'templates': [],
},
{
'title': '按键功能',
'templates': [],
},
{
'title': '耳机功能',
'templates': [
{
'type': 'input',
'name': '修改名称',
'value': 'voitrans',
'onCallback': (String value) {
Logger.d('input', '修改名称:$value');
},
},
{
'type': 'radio',
'name': '工作模式',
'value': '1',
'options': [
{'label': '游戏模式', 'value': '1'},
{'label': '娱乐模式', 'value': '2'},
],
'onCallback': (String value) {
Logger.d('radio', '工作模式:$value');
},
},
{
'type': 'switch',
'name': '闪灯开关',
'value': false,
'onCallback': () {},
},
{
'type': 'switch',
'name': '查找设备',
'value': false,
'description': '在设备上播放声音',
'onCallback': () {},
},
],
},
{
'templates': [
{
'type': 'confirm',
'name': '升级耳机固件',
'onCallback': () => Get.toNamed(Routes.OTA_UPGRADE),
},
{
'type': 'confirm',
'name': '恢复出厂设置',
'tips': '确定要恢复出厂设置吗?',
'onCallback': () {
Logger.d('confirm', '恢复出厂设置');
},
},
{
'type': 'confirm',
'name': '清除配对记录',
'tips': '确定要清除配对记录吗?',
'onCallback': () {
Logger.d('confirm', '清除配对记录');
},
},
],
}
].obs;
Widget getTemplate(Map data) {
return switch (data['type']) {
'input' => RowInputWidget(data),
'radio' => RowRadioWidget(data),
'confirm' => RowConfirmWidget(data),
_ => const SizedBox.shrink(),
};
}
}