fix on close alert in loading

This commit is contained in:
open-trade 2020-11-26 22:48:15 +08:00
parent 43452f48d9
commit 2a9ff10eae
3 changed files with 6 additions and 4 deletions

View File

@ -14,7 +14,7 @@ class MyTheme {
}
void showLoading(String text, BuildContext context) {
if (_hasDialog) {
if (_hasDialog && context != null) {
Navigator.pop(context);
}
dismissLoading();

View File

@ -100,10 +100,12 @@ class FfiModel with ChangeNotifier {
} else if (name == "audio_format") {
try {
var s = int.parse(evt['sample_rate']);
var c = int.parse(evt['channels']);
// var c = int.parse(evt['channels']);
// Flutter Sound does not support Floating Point PCM data, nor records with more that one audio channel.
// On Flutter Sound, Raw PCM is only PCM INT-Linerar 16 monophony
await stopAudio();
await _audioPlayer.startPlayerFromStream(
codec: Codec.opusWebM, numChannels: c, sampleRate: s);
codec: Codec.pcm16, numChannels: 1, sampleRate: s);
} catch (e) {
print('audio_format: $e');
}

View File

@ -530,7 +530,7 @@ void enterPasswordDialog(String id, BuildContext context) {
var text = controller.text.trim();
if (text == '') return;
FFI.login(text, remember);
showLoading('Logging in...', context);
showLoading('Logging in...', null);
Navigator.pop(context);
},
child: Text('OK'),