fixed vibration switch

This commit is contained in:
Matic Ivešić 2026-02-06 16:42:40 +01:00
parent ba2dc23c6c
commit eed999d2ab
8 changed files with 162 additions and 91 deletions

View File

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'screens/home_screen.dart';
import 'package:QuickSSH/classes/theme_provider.dart';
import 'package:QuickSSH/services/theme_controller.dart';
import 'package:QuickSSH/services/settings_controller.dart';
final themeController = ThemeController();
final settingsController = SettingsController();

View File

@ -13,6 +13,9 @@ class _SettingsState extends State<Settings> {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context).colorScheme;
return ListenableBuilder(
listenable: settingsController,
builder: (context, child) {
return Scaffold(
appBar: AppBar(
backgroundColor: theme.surface,
@ -20,7 +23,10 @@ class _SettingsState extends State<Settings> {
leading: Builder(
builder: (context) {
return IconButton(
icon: Icon(Icons.arrow_back_ios_rounded, color: theme.onSurface),
icon: Icon(
Icons.arrow_back_ios_rounded,
color: theme.onSurface,
),
onPressed: () {
Navigator.pop(context);
},
@ -113,5 +119,7 @@ class _SettingsState extends State<Settings> {
),
),
);
},
);
}
}

View File

@ -16,6 +16,7 @@ class SettingsController extends ChangeNotifier {
}
Future<void> toggleVibration(bool value) async {
print("Toggling vibration to: $value");
_vibrationEnabled = value;
final prefs = await SharedPreferences.getInstance();
await prefs.setBool('vibration_enabled', value);

View File

@ -6,11 +6,13 @@ import FlutterMacOS
import Foundation
import flutter_secure_storage_macos
import local_auth_darwin
import path_provider_foundation
import shared_preferences_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin"))
LocalAuthPlugin.register(with: registry.registrar(forPlugin: "LocalAuthPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
}

View File

@ -158,6 +158,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1
url: "https://pub.dev"
source: hosted
version: "2.0.33"
flutter_secure_storage:
dependency: "direct main"
description:
@ -224,6 +232,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.7.2"
intl:
dependency: transitive
description:
name: intl
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
url: "https://pub.dev"
source: hosted
version: "0.20.2"
js:
dependency: transitive
description:
@ -272,6 +288,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.1"
local_auth:
dependency: "direct main"
description:
name: local_auth
sha256: "434d854cf478f17f12ab29a76a02b3067f86a63a6d6c4eb8fbfdcfe4879c1b7b"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
local_auth_android:
dependency: transitive
description:
name: local_auth_android
sha256: a0bdfcc0607050a26ef5b31d6b4b254581c3d3ce3c1816ab4d4f4a9173e84467
url: "https://pub.dev"
source: hosted
version: "1.0.56"
local_auth_darwin:
dependency: transitive
description:
name: local_auth_darwin
sha256: "699873970067a40ef2f2c09b4c72eb1cfef64224ef041b3df9fdc5c4c1f91f49"
url: "https://pub.dev"
source: hosted
version: "1.6.1"
local_auth_platform_interface:
dependency: transitive
description:
name: local_auth_platform_interface
sha256: f98b8e388588583d3f781f6806e4f4c9f9e189d898d27f0c249b93a1973dd122
url: "https://pub.dev"
source: hosted
version: "1.1.0"
local_auth_windows:
dependency: transitive
description:
name: local_auth_windows
sha256: bc4e66a29b0fdf751aafbec923b5bed7ad6ed3614875d8151afe2578520b2ab5
url: "https://pub.dev"
source: hosted
version: "1.0.11"
matcher:
dependency: transitive
description:

View File

@ -33,6 +33,7 @@ dependencies:
shared_preferences: ^2.5.0
dartssh2: ^2.0.0
flutter_secure_storage: ^9.2.2
local_auth: ^2.3.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

View File

@ -7,8 +7,11 @@
#include "generated_plugin_registrant.h"
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include <local_auth_windows/local_auth_plugin.h>
void RegisterPlugins(flutter::PluginRegistry* registry) {
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin"));
LocalAuthPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("LocalAuthPlugin"));
}

View File

@ -4,6 +4,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_windows
local_auth_windows
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST