feat: settings screen, haptic toggle, rain/lightning toggles, review docs

This commit is contained in:
esefxdz committed 2026-08-06 23:08:26 +03:00
1 parent 56ea53e73b
commit 04ec8ac5d1
11 files changed
+318 -3

No files matched your search

+6 -3
View File
@@ -5,6 +5,7 @@ import 'package:revoltvpn/logic/app_colors.dart';
import 'package:revoltvpn/logic/vpn_connection.dart';
import 'package:revoltvpn/logic/session_timer.dart';
import 'package:revoltvpn/logic/ad_manager.dart';
import 'package:revoltvpn/screens/settings/in_settings/haptic.dart';
class ConnectButton extends StatefulWidget {
const ConnectButton({super.key});
@@ -56,8 +57,6 @@ class _ConnectButtonState extends State<ConnectButton>
if (now.difference(_lastTap).inMilliseconds < 1000) return;
_lastTap = now;
HapticFeedback.lightImpact();
final vpn = context.read<VpnConnection>();
final timer = context.read<SessionTimer>();
final ad = context.read<AdManager>();
@@ -67,6 +66,7 @@ class _ConnectButtonState extends State<ConnectButton>
_busy = false;
timer.stop();
await vpn.disconnect();
if (hapticEnabled) HapticFeedback.lightImpact();
return;
}
@@ -84,7 +84,10 @@ class _ConnectButtonState extends State<ConnectButton>
return;
}
final ok = await vpn.connect();
if (ok) timer.start();
if (ok) {
timer.start();
if (hapticEnabled) HapticFeedback.lightImpact();
}
} finally {
if (mounted) setState(() => _busy = false);
}
+2
View File
@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:revoltvpn/logic/app_colors.dart';
import 'package:revoltvpn/screens/settings/in_settings/lightning.dart';
/// 2D lightning bolt — a jagged yellow line from top to bottom with glow.
@@ -77,6 +78,7 @@ class _LightningEffectState extends State<LightningEffect>
@override
Widget build(BuildContext context) {
if (!lightningEnabled) return const SizedBox.shrink();
return AnimatedBuilder(
animation: _ctrl,
builder: (_, child) {
+2
View File
@@ -1,6 +1,7 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:revoltvpn/screens/settings/in_settings/rain.dart';
/// Subtle animated rain effect — sits behind all UI as a full-screen overlay.
///
@@ -78,6 +79,7 @@ class _RainEffectState extends State<RainEffect>
@override
Widget build(BuildContext context) {
if (!rainEnabled) return const SizedBox.shrink();
return CustomPaint(
painter: _RainPainter(
drops: _drops,
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:revoltvpn/logic/app_colors.dart';
import 'package:revoltvpn/screens/settings/settings_screen.dart';
// ── lib/components/sidebar_contents/settings.dart ────────────────────────────
// Thin sidebar row — taps navigate to the full SettingsScreen.
// The actual settings UI lives in lib/screens/settings/ (separate folder,
// one file per feature).
class SettingsButton extends StatelessWidget {
const SettingsButton({super.key});
// Opens the settings page sliding in from the right — matches the
// sidebar end-drawer animation so it feels like one continuous motion.
static void open(BuildContext context) {
Navigator.of(context).push(
PageRouteBuilder(
transitionDuration: const Duration(milliseconds: 300),
reverseTransitionDuration: const Duration(milliseconds: 250),
pageBuilder: (_, __, ___) => const SettingsScreen(),
transitionsBuilder: (_, animation, __, child) {
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(1.0, 0.0),
end: Offset.zero,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.easeOut,
)),
child: child,
);
},
),
);
}
@override
Widget build(BuildContext context) {
return IconButton(
icon: const Icon(Icons.settings, color: AppColors.textWhite, size: 28),
onPressed: () => open(context),
tooltip: 'Settings',
splashRadius: 24,
);
}
}
+10
View File
@@ -6,6 +6,7 @@ import 'package:revoltvpn/components/sidebar_contents/privacy_policy_button.dart
import 'package:revoltvpn/components/sidebar_contents/info_button.dart';
import 'package:revoltvpn/components/sidebar_contents/discord_link_button.dart';
import 'package:revoltvpn/components/sidebar_contents/website_button.dart';
import 'package:revoltvpn/components/sidebar_contents/settings.dart';
import 'package:revoltvpn/logic/updater.dart';
class SidebarDrawer extends StatefulWidget {
@@ -121,6 +122,15 @@ class _SidebarDrawerState extends State<SidebarDrawer> {
},
),
_Row(
icon: Icons.settings,
label: 'Settings',
onTap: () {
Navigator.of(context).pop();
SettingsButton.open(context);
},
),
_Row(
icon: Icons.system_update_alt,
label: 'Check for updates',