Files
Hightube/frontend/lib/pages/settings_page.dart

83 lines
2.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/settings_provider.dart';
class SettingsPage extends StatefulWidget {
@override
_SettingsPageState createState() => _SettingsPageState();
}
class _SettingsPageState extends State<SettingsPage> {
late TextEditingController _urlController;
@override
void initState() {
super.initState();
_urlController = TextEditingController(text: context.read<SettingsProvider>().baseUrl);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Settings", style: TextStyle(fontWeight: FontWeight.bold))),
body: SingleChildScrollView(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Network Configuration",
style: Theme.of(context).textTheme.titleMedium?.copyWith(
color: Theme.of(context).colorScheme.primary,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 16),
TextField(
controller: _urlController,
decoration: InputDecoration(
labelText: "Backend Server URL",
hintText: "http://127.0.0.1:8080",
prefixIcon: Icon(Icons.lan),
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
helperText: "Restarting stream may be required after change",
),
),
SizedBox(height: 24),
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton.icon(
onPressed: () {
context.read<SettingsProvider>().setBaseUrl(_urlController.text);
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text("Server URL Updated"),
behavior: SnackBarBehavior.floating,
),
);
},
icon: Icon(Icons.save),
label: Text("Save Configuration"),
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
),
),
),
SizedBox(height: 40),
Divider(),
SizedBox(height: 20),
Text(
"About Hightube",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.grey),
),
SizedBox(height: 10),
Text("Version: 1.0.0-MVP"),
Text("Status: Phase 3.5 (UI Refinement)"),
],
),
),
);
}
}