splash screen and status bar color polish
This commit is contained in:
1 parent
2d0628c5bb
commit
abcb41fb06
10 files changed
+51
-16
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:revoltvpn/logic/app_colors.dart';
|
||||
import 'package:revoltvpn/components/sidebar_contents/gdpr_button.dart';
|
||||
import 'package:revoltvpn/components/sidebar_contents/privacy_policy_button.dart';
|
||||
@@ -6,11 +7,35 @@ 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/logic/updater.dart';
|
||||
import 'package:revoltvpn/main.dart';
|
||||
|
||||
class SidebarDrawer extends StatelessWidget {
|
||||
class SidebarDrawer extends StatefulWidget {
|
||||
const SidebarDrawer({super.key});
|
||||
|
||||
@override
|
||||
State<SidebarDrawer> createState() => _SidebarDrawerState();
|
||||
}
|
||||
|
||||
class _SidebarDrawerState extends State<SidebarDrawer> {
|
||||
String _version = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadVersion();
|
||||
}
|
||||
|
||||
Future<void> _loadVersion() async {
|
||||
try {
|
||||
final info = await PackageInfo.fromPlatform();
|
||||
debugPrint('[Sidebar] PackageInfo version: ${info.version} '
|
||||
'(build: ${info.buildNumber})');
|
||||
if (mounted) setState(() => _version = info.version);
|
||||
} catch (e) {
|
||||
debugPrint('[Sidebar] PackageInfo failed: $e');
|
||||
if (mounted) setState(() => _version = '?.?.?');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
@@ -109,7 +134,7 @@ class SidebarDrawer extends StatelessWidget {
|
||||
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Text('ReVoltVPN · v${ReVoltApp.appVersion}', textAlign: TextAlign.center,
|
||||
child: Text('ReVoltVPN · v$_version', textAlign: TextAlign.center,
|
||||
style: const TextStyle(color: AppColors.slate, fontSize: 11, letterSpacing: 1),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -26,14 +26,18 @@ class StatusBar extends StatelessWidget {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
// Connection status
|
||||
// Connection status — wrapped in Flexible to prevent overflow
|
||||
// on narrow screens (the Row must fit both the status text
|
||||
// and the online dot without RenderFlex errors).
|
||||
if (isConnected) ...[
|
||||
Image.asset('assets/finland_flag_256.png', width: 20, height: 20),
|
||||
const SizedBox(width: 8),
|
||||
const Text('Helsinki, Finland', style: TextStyle(
|
||||
color: AppColors.accent, fontWeight: FontWeight.w600,
|
||||
fontSize: 13, letterSpacing: 0.5,
|
||||
)),
|
||||
const Flexible(
|
||||
child: Text('Helsinki, Finland', style: TextStyle(
|
||||
color: AppColors.accent, fontWeight: FontWeight.w600,
|
||||
fontSize: 13, letterSpacing: 0.5,
|
||||
), overflow: TextOverflow.ellipsis),
|
||||
),
|
||||
] else ...[
|
||||
Icon(
|
||||
isConnecting ? Icons.sync : Icons.shield_outlined,
|
||||
@@ -41,11 +45,14 @@ class StatusBar extends StatelessWidget {
|
||||
color: isConnecting ? AppColors.accent : AppColors.slate70,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
vpn.statusMessage.toUpperCase(),
|
||||
style: TextStyle(
|
||||
color: isConnecting ? AppColors.accent : AppColors.slate70,
|
||||
fontWeight: FontWeight.w600, fontSize: 13, letterSpacing: 1,
|
||||
Flexible(
|
||||
child: Text(
|
||||
vpn.statusMessage.toUpperCase(),
|
||||
style: TextStyle(
|
||||
color: isConnecting ? AppColors.accent : AppColors.slate70,
|
||||
fontWeight: FontWeight.w600, fontSize: 13, letterSpacing: 1,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -115,7 +116,8 @@ class Updater {
|
||||
}
|
||||
|
||||
static Future<void> check(BuildContext context) async {
|
||||
final localVersion = ReVoltApp.appVersion;
|
||||
final info = await PackageInfo.fromPlatform();
|
||||
final localVersion = info.version;
|
||||
if (localVersion.isEmpty) {
|
||||
_showSnackBar(context, 'Could not determine app version',
|
||||
isError: true);
|
||||
@@ -176,7 +178,7 @@ class Updater {
|
||||
content: Row(
|
||||
children: [
|
||||
Icon(isError ? Icons.error_outline : Icons.check_circle,
|
||||
color: isError ? AppColors.red400 : AppColors.green400,
|
||||
color: isError ? AppColors.red : AppColors.green,
|
||||
size: 18),
|
||||
const SizedBox(width: 8),
|
||||
Text(message),
|
||||
|
||||
Reference in new issue
Block a user