mirror of
https://github.com/MoxiFoxi411/QuickSSH.git
synced 2026-11-08 19:34:55 +00:00
fixed vibration switch
This commit is contained in:
1 parent
ba2dc23c6c
commit
eed999d2ab
8 files changed
+162
-91
No files matched your search
+98
-90
@@ -13,105 +13,113 @@ 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);
|
||||
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(
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Appearance",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: theme.onSurface,
|
||||
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(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
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"),
|
||||
SizedBox(height: 20),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
"Vibrations",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
color: theme.onSurface,
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: ThemeMode.dark,
|
||||
child: Text("Dark"),
|
||||
),
|
||||
DropdownMenuItem(
|
||||
value: ThemeMode.light,
|
||||
child: Text("Light"),
|
||||
),
|
||||
],
|
||||
onChanged: (ThemeMode? newMode) {
|
||||
themeController.updateTheme(newMode);
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
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(
|
||||
"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(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user