diff --git a/frontend/lib/views/side_bar/side_bar_view.dart b/frontend/lib/views/side_bar/side_bar_view.dart index 668eb58d..4a0a8f18 100644 --- a/frontend/lib/views/side_bar/side_bar_view.dart +++ b/frontend/lib/views/side_bar/side_bar_view.dart @@ -2,12 +2,23 @@ import 'package:auto_gpt_flutter_client/viewmodels/settings_viewmodel.dart'; import 'package:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; class SideBarView extends StatelessWidget { final ValueNotifier selectedViewNotifier; const SideBarView({super.key, required this.selectedViewNotifier}); + // Function to launch the URL + void _launchURL(String urlString) async { + var url = Uri.parse(urlString); + if (await canLaunchUrl(url)) { + await launchUrl(url); + } else { + throw 'Could not launch $url'; + } + } + @override Widget build(BuildContext context) { // TODO: should we pass this in as a dependency? @@ -20,37 +31,68 @@ class SideBarView extends StatelessWidget { return SizedBox( width: 60, child: Column( - mainAxisAlignment: MainAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - IconButton( - splashRadius: 0.1, - color: - selectedView == 'TaskView' ? Colors.blue : Colors.black, - icon: const Icon(Icons.chat), - onPressed: skillTreeViewModel.isBenchmarkRunning - ? null - : () => selectedViewNotifier.value = 'TaskView', + Column( + children: [ + IconButton( + splashRadius: 0.1, + color: selectedView == 'TaskView' + ? Colors.blue + : Colors.black, + icon: const Icon(Icons.chat), + onPressed: skillTreeViewModel.isBenchmarkRunning + ? null + : () => selectedViewNotifier.value = 'TaskView', + ), + if (Provider.of(context, listen: true) + .isDeveloperModeEnabled) + IconButton( + splashRadius: 0.1, + color: selectedView == 'SkillTreeView' + ? Colors.blue + : Colors.black, + icon: const Icon(Icons.emoji_events), + onPressed: skillTreeViewModel.isBenchmarkRunning + ? null + : () => + selectedViewNotifier.value = 'SkillTreeView', + ), + IconButton( + splashRadius: 0.1, + color: selectedView == 'SettingsView' + ? Colors.blue + : Colors.black, + icon: const Icon(Icons.settings), + onPressed: () => + selectedViewNotifier.value = 'SettingsView', + ), + ], ), - if (Provider.of(context, listen: true) - .isDeveloperModeEnabled) - IconButton( - splashRadius: 0.1, - color: selectedView == 'SkillTreeView' - ? Colors.blue - : Colors.black, - icon: const Icon(Icons.emoji_events), - onPressed: skillTreeViewModel.isBenchmarkRunning - ? null - : () => selectedViewNotifier.value = 'SkillTreeView', - ), - IconButton( - splashRadius: 0.1, - color: selectedView == 'SettingsView' - ? Colors.blue - : Colors.black, - icon: const Icon(Icons.settings), - onPressed: () => - selectedViewNotifier.value = 'SettingsView', + Column( + children: [ + IconButton( + splashRadius: 0.1, + icon: Image.asset('assets/images/autogpt_logo.png'), + onPressed: () => + _launchURL('https://leaderboard.agpt.co'), + tooltip: 'Check out the leaderboard', + ), + IconButton( + splashRadius: 0.1, + icon: Image.asset('assets/images/discord_logo.png'), + onPressed: () => + _launchURL('https://discord.gg/autogpt'), + tooltip: 'Join our Discord', + ), + IconButton( + splashRadius: 0.1, + icon: Image.asset('assets/images/twitter_logo.png'), + onPressed: () => + _launchURL('https://twitter.com/Auto_GPT'), + tooltip: 'Follow us on Twitter', + ), + ], ), ], ),