Only allow voice if enabled

This commit is contained in:
JHubi1 2024-06-18 17:02:18 +02:00
parent 1b9225fdb8
commit 09fda2b004
No known key found for this signature in database
GPG Key ID: 7BF82570CBBBD050
3 changed files with 42 additions and 23 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -118,6 +118,9 @@ class _AppState extends State<App> {
if ((await Permission.bluetoothConnect.isGranted) &&
(await Permission.microphone.isGranted)) {
voiceSupported = await speech.initialize();
} else {
prefs!.setBool("voiceModeEnabled", false);
voiceSupported = false;
}
SharedPreferences.setPrefix("ollama.");
@ -1225,28 +1228,44 @@ class _MainAppState extends State<MainApp> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
width: double.infinity,
child: OutlinedButton.icon(
onPressed: () async {
selectionHaptic();
Navigator.of(context)
.pop();
setMainState = setState;
settingsOpen = true;
logoVisible = false;
Navigator.of(context).push(
MaterialPageRoute(
builder:
(context) =>
const ScreenVoice()));
},
icon: const Icon(Icons
.headphones_rounded),
label: Text(AppLocalizations
.of(context)!
.settingsTitleVoice))),
const SizedBox(height: 8),
(prefs?.getBool(
"voiceModeEnabled") ??
false)
? SizedBox(
width: double.infinity,
child:
OutlinedButton.icon(
onPressed:
() async {
selectionHaptic();
Navigator.of(
context)
.pop();
setMainState =
setState;
settingsOpen =
true;
logoVisible =
false;
Navigator.of(
context)
.push(MaterialPageRoute(
builder:
(context) =>
const ScreenVoice()));
},
icon: const Icon(Icons
.headphones_rounded),
label: Text(
AppLocalizations.of(
context)!
.settingsTitleVoice)))
: const SizedBox.shrink(),
(prefs?.getBool(
"voiceModeEnabled") ??
false)
? const SizedBox(height: 8)
: const SizedBox.shrink(),
SizedBox(
width: double.infinity,
child: OutlinedButton.icon(

View File

@ -86,7 +86,7 @@ class _ScreenSettingsAboutState extends State<ScreenSettingsAbout> {
// const SizedBox(height: 16),
button(
AppLocalizations.of(context)!
.settingsVersion(currentVersion ?? "0.0.1"),
.settingsVersion(currentVersion ?? ""),
Icons.verified_rounded,
null),
(updateStatus == "notAvailable")