Rewrote pretty much all of it. New logo/icons. Overall did alot tbh.
This commit is contained in:
parent
5858a4a231
commit
d128768478
142 changed files with 968 additions and 3875 deletions
79
lib/settings.dart
Normal file
79
lib/settings.dart
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'core/api.dart';
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
const SettingsPage({super.key});
|
||||
|
||||
@override
|
||||
State<SettingsPage> createState() => _SettingsPageState();
|
||||
}
|
||||
|
||||
class _SettingsPageState extends State<SettingsPage> {
|
||||
final TextEditingController _urlController = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_saveData();
|
||||
_urlController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadData();
|
||||
}
|
||||
|
||||
Future<void> _saveData() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setString('url', _urlController.text);
|
||||
}
|
||||
|
||||
Future<void> _loadData() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
setState(() {
|
||||
_urlController.text = prefs.getString('url') ?? '';
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Settings'),
|
||||
),
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
children: <Widget>[
|
||||
Text('LaserProxy URL', style: Theme.of(context).textTheme.titleLarge),
|
||||
Text(
|
||||
'Set the URL of the LaserProxy instance. Leave it blank to use the default.',
|
||||
style: Theme.of(context).textTheme.bodyMedium
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextField(
|
||||
controller: _urlController,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'URL',
|
||||
hintText: 'https://laserscouter.halfheart.net/',
|
||||
border: OutlineInputBorder(),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color.fromARGB(255, 19, 81, 179)),
|
||||
),
|
||||
),
|
||||
onChanged: (value) {
|
||||
if (value.isEmpty) {
|
||||
proxyURL = "https://laserscouter.halfheart.net/";
|
||||
}
|
||||
else {
|
||||
proxyURL = value;
|
||||
}
|
||||
}
|
||||
),
|
||||
const Divider(height: 32),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue