|
import 'package:auto_gpt_flutter_client/viewmodels/settings_viewmodel.dart'; |
|
import 'package:auto_gpt_flutter_client/views/settings/api_base_url_field.dart'; |
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
|
|
class SettingsView extends StatelessWidget { |
|
final SettingsViewModel viewModel; |
|
|
|
|
|
const SettingsView({Key? key, required this.viewModel}) : super(key: key); |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return Scaffold( |
|
appBar: AppBar( |
|
backgroundColor: Colors.grey, |
|
foregroundColor: Colors.black, |
|
title: const Text('Settings'), |
|
), |
|
body: Column( |
|
children: [ |
|
|
|
Expanded( |
|
child: ListView( |
|
children: [ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SwitchListTile( |
|
title: const Text('Developer Mode'), |
|
value: viewModel.isDeveloperModeEnabled, |
|
onChanged: viewModel.toggleDeveloperMode, |
|
), |
|
const Divider(), |
|
|
|
const ListTile( |
|
title: Center(child: Text('Agent Base URL')), |
|
), |
|
ApiBaseUrlField(), |
|
const Divider(), |
|
|
|
ListTile( |
|
title: const Center(child: Text('Continuous Mode Steps')), |
|
|
|
subtitle: Row( |
|
mainAxisAlignment: |
|
MainAxisAlignment.center, |
|
children: [ |
|
IconButton( |
|
icon: const Icon(Icons.remove), |
|
onPressed: viewModel |
|
.decrementContinuousModeSteps, |
|
), |
|
Text('${viewModel.continuousModeSteps} Steps'), |
|
IconButton( |
|
icon: const Icon(Icons.add), |
|
onPressed: viewModel |
|
.incrementContinuousModeSteps, |
|
), |
|
], |
|
), |
|
), |
|
const Divider(), |
|
], |
|
), |
|
), |
|
|
|
Container( |
|
width: double.infinity, |
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8), |
|
child: ElevatedButton.icon( |
|
icon: const Icon(Icons.logout, color: Colors.black), |
|
label: |
|
const Text('Sign Out', style: TextStyle(color: Colors.black)), |
|
style: ElevatedButton.styleFrom( |
|
backgroundColor: Colors.white, |
|
), |
|
onPressed: viewModel.signOut, |
|
), |
|
), |
|
], |
|
), |
|
); |
|
} |
|
} |
|
|