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 createState() => _SettingsState(); } class _SettingsState extends State { @override Widget build(BuildContext context) { final theme = Theme.of(context).colorScheme; return ListenableBuilder( listenable: settingsController, builder: (context, child) { 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( 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(() {}); }, ), ), ], ), SizedBox(height: 20), Row( children: [ Expanded( child: Text( "Biometric Unlock", 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.biometricEnabled, onChanged: (bool value) { settingsController.toggleBiometric(value); if (value) HapticFeedback.mediumImpact(); setState(() {}); }, ), ), ], ), SizedBox(height: 20), Row( children: [ Expanded( child: Text( "Enable Ads", 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.adsEnabled, onChanged: (bool value) { settingsController.toggleAds(value); if (value) HapticFeedback.mediumImpact(); setState(() {}); }, ), ), ], ), ], ), ), ); }, ); } }