mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 06:54:22 +01:00
Update SideBarView with socials
This commit is contained in:
@@ -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:auto_gpt_flutter_client/viewmodels/skill_tree_viewmodel.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class SideBarView extends StatelessWidget {
|
class SideBarView extends StatelessWidget {
|
||||||
final ValueNotifier<String> selectedViewNotifier;
|
final ValueNotifier<String> selectedViewNotifier;
|
||||||
|
|
||||||
const SideBarView({super.key, required this.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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// TODO: should we pass this in as a dependency?
|
// TODO: should we pass this in as a dependency?
|
||||||
@@ -20,37 +31,68 @@ class SideBarView extends StatelessWidget {
|
|||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 60,
|
width: 60,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
Column(
|
||||||
splashRadius: 0.1,
|
children: [
|
||||||
color:
|
IconButton(
|
||||||
selectedView == 'TaskView' ? Colors.blue : Colors.black,
|
splashRadius: 0.1,
|
||||||
icon: const Icon(Icons.chat),
|
color: selectedView == 'TaskView'
|
||||||
onPressed: skillTreeViewModel.isBenchmarkRunning
|
? Colors.blue
|
||||||
? null
|
: Colors.black,
|
||||||
: () => selectedViewNotifier.value = 'TaskView',
|
icon: const Icon(Icons.chat),
|
||||||
|
onPressed: skillTreeViewModel.isBenchmarkRunning
|
||||||
|
? null
|
||||||
|
: () => selectedViewNotifier.value = 'TaskView',
|
||||||
|
),
|
||||||
|
if (Provider.of<SettingsViewModel>(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<SettingsViewModel>(context, listen: true)
|
Column(
|
||||||
.isDeveloperModeEnabled)
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
splashRadius: 0.1,
|
splashRadius: 0.1,
|
||||||
color: selectedView == 'SkillTreeView'
|
icon: Image.asset('assets/images/autogpt_logo.png'),
|
||||||
? Colors.blue
|
onPressed: () =>
|
||||||
: Colors.black,
|
_launchURL('https://leaderboard.agpt.co'),
|
||||||
icon: const Icon(Icons.emoji_events),
|
tooltip: 'Check out the leaderboard',
|
||||||
onPressed: skillTreeViewModel.isBenchmarkRunning
|
),
|
||||||
? null
|
IconButton(
|
||||||
: () => selectedViewNotifier.value = 'SkillTreeView',
|
splashRadius: 0.1,
|
||||||
),
|
icon: Image.asset('assets/images/discord_logo.png'),
|
||||||
IconButton(
|
onPressed: () =>
|
||||||
splashRadius: 0.1,
|
_launchURL('https://discord.gg/autogpt'),
|
||||||
color: selectedView == 'SettingsView'
|
tooltip: 'Join our Discord',
|
||||||
? Colors.blue
|
),
|
||||||
: Colors.black,
|
IconButton(
|
||||||
icon: const Icon(Icons.settings),
|
splashRadius: 0.1,
|
||||||
onPressed: () =>
|
icon: Image.asset('assets/images/twitter_logo.png'),
|
||||||
selectedViewNotifier.value = 'SettingsView',
|
onPressed: () =>
|
||||||
|
_launchURL('https://twitter.com/Auto_GPT'),
|
||||||
|
tooltip: 'Follow us on Twitter',
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user