mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-18 14:34:23 +01:00
Enhance SettingsViewModel with State Persistence and Sign Out
This commit enriches the `SettingsViewModel` by integrating state persistence functionality and a sign-out method, thus ensuring a more robust and user-friendly settings feature. Key Enhancements: 1. **State Persistence**: - Leveraging the `shared_preferences` package, the app now stores and retrieves user preferences related to app settings, ensuring consistency across app restarts. - Preferences like Dark Mode, Developer Mode, Base URL, and Continuous Mode Steps are persistently stored and loaded when the ViewModel is initialized. 2. **Sign Out Method**: - A `signOut` method has been introduced in the ViewModel, utilizing the `AuthService` to facilitate user sign-out processes. - This addition allows for seamless integration of sign-out functionality within the settings interface, granting users the ability to easily terminate sessions. 3. **SettingsView Enhancement**: - The `SettingsView` has been adapted to incorporate a UI element invoking the `signOut` method, enhancing user interaction within the settings environment. This enhancement not only bolsters the resilience and usability of the app’s settings but also lays down a structured approach for potential future additions to user preferences and settings-related functionalities.
This commit is contained in:
@@ -62,6 +62,13 @@ class SettingsView extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
title: Text('Sign Out'),
|
||||
onTap: () {
|
||||
viewModel.signOut();
|
||||
// Optionally, navigate to a different view or show a message
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user