Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

Integrate SettingsView into MainLayout

hunteraraujo4c0349a6a8f7
diff --git a/frontend/lib/views/main_layout.dart b/frontend/lib/views/main_layout.dart
index a28b5760ee..23c07df966 100644
--- a/frontend/lib/views/main_layout.dart
+++ b/frontend/lib/views/main_layout.dart
@@ -1,6 +1,7 @@
import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
import 'package:auto_gpt_flutter_client/viewmodels/task_viewmodel.dart';
import 'package:auto_gpt_flutter_client/viewmodels/chat_viewmodel.dart';
+import 'package:auto_gpt_flutter_client/views/settings/settings_view.dart';
import 'package:auto_gpt_flutter_client/views/side_bar/side_bar_view.dart';
import 'package:auto_gpt_flutter_client/views/skill_tree/skill_tree_view.dart';
import 'package:auto_gpt_flutter_client/views/task/task_view.dart';
@@ -29,6 +30,9 @@ class MainLayout extends StatelessWidget {
// Initialize the width for the TaskView
double taskViewWidth = 280.0;
+ // Initialize the width for the SettingsView
+ double settingsViewWidth = 280.0;
+
// Calculate remaining width after subtracting the width of the SideBarView
double remainingWidth = width - sideBarWidth;
@@ -49,6 +53,7 @@ class MainLayout extends StatelessWidget {
return Consumer<SkillTreeViewModel>(
builder: (context, skillTreeViewModel, _) {
if (value == 'TaskView') {
+ // TODO: Handle this state reset better
skillTreeViewModel.resetState();
chatViewWidth = remainingWidth - taskViewWidth;
return Row(
@@ -61,6 +66,22 @@ class MainLayout extends StatelessWidget {
child: ChatView(viewModel: chatViewModel))
],
);
+ } else if (value == 'SettingsView') {
+ // TODO: Handle this state reset better
+ skillTreeViewModel.resetState();
+ chatViewWidth = remainingWidth - settingsViewWidth;
+ return Row(
+ children: [
+ SizedBox(
+ width: settingsViewWidth,
+ // Render the SettingsView with the same width as TaskView
+ child: const SettingsView()),
+ SizedBox(
+ width: chatViewWidth,
+ // Render the ChatView next to the SettingsView
+ child: ChatView(viewModel: chatViewModel)),
+ ],
+ );
} else {
if (skillTreeViewModel.selectedNode != null) {
// If TaskQueueView should be displayed
@@ -97,6 +118,7 @@ class MainLayout extends StatelessWidget {
);
} else {
// For smaller screens, return a tabbed layout
+ // TODO: Include settings view for smaller screen sizes
return CupertinoTabScaffold(
tabBar: CupertinoTabBar(
items: const <BottomNavigationBarItem>[