refactor audio setting
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
parent
203d9e39a0
commit
2f1092afaf
@ -265,22 +265,14 @@ class _GeneralState extends State<_General> {
|
|||||||
if (devices.isEmpty) {
|
if (devices.isEmpty) {
|
||||||
return const Offstage();
|
return const Offstage();
|
||||||
}
|
}
|
||||||
List<String> keys = devices.toList();
|
|
||||||
List<String> values = devices.toList();
|
|
||||||
// TODO
|
|
||||||
if (!devices.contains(currentDevice)) {
|
|
||||||
currentDevice = "";
|
|
||||||
keys.insert(0, currentDevice);
|
|
||||||
values.insert(0, 'default');
|
|
||||||
}
|
|
||||||
return _Card(title: 'Audio Input Device', children: [
|
return _Card(title: 'Audio Input Device', children: [
|
||||||
_ComboBox(
|
...devices.map((device) => _Radio<String>(context,
|
||||||
keys: keys,
|
value: device,
|
||||||
values: values,
|
groupValue: currentDevice,
|
||||||
initialKey: currentDevice,
|
label: device, onChanged: (value) {
|
||||||
onChanged: (key) {
|
setDevice(value);
|
||||||
setDevice(key);
|
setState(() {});
|
||||||
}).marginOnly(left: _kContentHMargin),
|
}))
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -876,6 +868,8 @@ Widget _Radio<T>(BuildContext context,
|
|||||||
Radio<T>(value: value, groupValue: groupValue, onChanged: onChange),
|
Radio<T>(value: value, groupValue: groupValue, onChanged: onChange),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(translate(label),
|
child: Text(translate(label),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: _kContentFontSize,
|
fontSize: _kContentFontSize,
|
||||||
color: _disabledTextColor(context, enabled)))
|
color: _disabledTextColor(context, enabled)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user