118 lines
3.8 KiB
Dart
118 lines
3.8 KiB
Dart
import 'package:QuickSSH/main.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
class Settings extends StatefulWidget {
|
|
const Settings({super.key});
|
|
|
|
@override
|
|
State<Settings> createState() => _SettingsState();
|
|
}
|
|
|
|
class _SettingsState extends State<Settings> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context).colorScheme;
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: theme.surface,
|
|
title: Text("Settings", style: TextStyle(color: theme.onSurface)),
|
|
leading: Builder(
|
|
builder: (context) {
|
|
return IconButton(
|
|
icon: Icon(Icons.arrow_back_ios_rounded, color: theme.onSurface),
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"Appearance",
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 20,
|
|
color: theme.onSurface,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Container(
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 12,
|
|
vertical: 4,
|
|
),
|
|
decoration: BoxDecoration(
|
|
color: theme.primaryContainer,
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: DropdownButton<ThemeMode>(
|
|
value: themeController.themeMode,
|
|
underline: Container(),
|
|
items: const [
|
|
DropdownMenuItem(
|
|
value: ThemeMode.system,
|
|
child: Text("System Default"),
|
|
),
|
|
DropdownMenuItem(
|
|
value: ThemeMode.dark,
|
|
child: Text("Dark"),
|
|
),
|
|
DropdownMenuItem(
|
|
value: ThemeMode.light,
|
|
child: Text("Light"),
|
|
),
|
|
],
|
|
onChanged: (ThemeMode? newMode) {
|
|
themeController.updateTheme(newMode);
|
|
setState(() {});
|
|
},
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 20),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: Text(
|
|
"Vibrations",
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 20,
|
|
color: theme.onSurface,
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Switch(
|
|
activeTrackColor: theme.primary,
|
|
activeThumbColor: theme.onPrimary,
|
|
inactiveThumbColor: theme.onSurface,
|
|
inactiveTrackColor: theme.surface,
|
|
value: settingsController.vibrationEnabled,
|
|
onChanged: (bool value) {
|
|
settingsController.toggleVibration(value);
|
|
if (value) HapticFeedback.mediumImpact();
|
|
setState(() {});
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|