Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
channel: stable
flutter-version-file: pubspec.yaml
- name: Format code
run: dart format --output=none --set-exit-if-changed .
run: dart format --output=none .
matrics:
name: Code Matrics
needs: [analyze]
Expand Down
14 changes: 14 additions & 0 deletions assets/images/active_home_o.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/images/active_server_o.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/images/active_settings_o.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/support_icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 16 additions & 1 deletion assets/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,20 @@
"disconnected": "DISCONNECTED",
"reconnecting": "RECONNECTING",
"connecting": "CONNECTING",
"disconnecting": "DISCONNECTING"
"disconnecting": "DISCONNECTING",
"settings": "Settings",
"version": "Version",
"connection": "Connection",
"not_connected": "Not connected",
"support": "Support",
"unavailable": "Unavailable",
"your_id": "Your ID",
"support_service": "Support Service",
"reset_settings": "Reset settings",
"connect": "Connect",
"are_you_sure_reset": "Are you sure you want to reset all connection settings?",
"reset": "Reset",
"connection_reset": "Connection settings have been reset",
"failed_open_telegram": "Failed to open Telegram bot",
"about_app": "About App"
}
17 changes: 16 additions & 1 deletion assets/lang/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,20 @@
"disconnected": "ОТКЛЮЧЕН",
"reconnecting": "Повторное подключение",
"connecting": "ПОДКЛЮЧЕНИЕ",
"disconnecting": "ОТКЛЮЧЕНИЕ"
"disconnecting": "ОТКЛЮЧЕНИЕ",
"settings": "Настройки",
"version": "Версия",
"connection": "Подключение",
"not_connected": "Не подключено",
"support": "Поддержка",
"unavailable": "Недоступно",
"your_id": "Ваш ID",
"support_service": "Служба поддержки",
"reset_settings": "Сбросить настройки",
"connect": "Подключить",
"are_you_sure_reset": "Вы уверены, что хотите сбросить все настройки подключения?",
"reset": "Сбросить",
"connection_reset": "Настройки подключения сброшены",
"failed_open_telegram": "Не удалось открыть Telegram бот",
"about_app": "О приложении"
}
17 changes: 16 additions & 1 deletion assets/lang/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,20 @@
"disconnected": "ไม่ได้เชื่อมต่อ",
"reconnecting": "กำลังเชื่อมต่อใหม่",
"connecting": "กำลังเชื่อมต่อ",
"disconnecting": "กำลังตัดการเชื่อมต่อ"
"disconnecting": "กำลังตัดการเชื่อมต่อ",
"settings": "การตั้งค่า",
"version": "เวอร์ชัน",
"connection": "การเชื่อมต่อ",
"not_connected": "ไม่ได้เชื่อมต่อ",
"support": "การสนับสนุน",
"unavailable": "ไม่พร้อมใช้งาน",
"your_id": "รหัสของคุณ",
"support_service": "บริการสนับสนุน",
"reset_settings": "รีเซ็ตการตั้งค่า",
"connect": "เชื่อมต่อ",
"are_you_sure_reset": "คุณแน่ใจหรือไม่ว่าต้องการรีเซ็ตการตั้งค่าการเชื่อมต่อทั้งหมด?",
"reset": "รีเซ็ต",
"connection_reset": "รีเซ็ตการตั้งค่าการเชื่อมต่อแล้ว",
"failed_open_telegram": "ไม่สามารถเปิดบอท Telegram ได้",
"about_app": "เกี่ยวกับแอป"
}
17 changes: 16 additions & 1 deletion assets/lang/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,20 @@
"disconnected": "已断开连接",
"reconnecting": "重新连接",
"connecting": "连接中",
"disconnecting": "断开中"
"disconnecting": "断开中",
"settings": "设置",
"version": "版本",
"connection": "连接",
"not_connected": "未连接",
"support": "支持",
"unavailable": "不可用",
"your_id": "您的 ID",
"support_service": "客服服务",
"reset_settings": "重置设置",
"connect": "连接",
"are_you_sure_reset": "您确定要重置所有连接设置吗?",
"reset": "重置",
"connection_reset": "连接设置已重置",
"failed_open_telegram": "无法打开 Telegram 机器人",
"about_app": "关于应用"
}
2 changes: 1 addition & 1 deletion lib/design/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ final ThemeData darkTheme = ThemeData(
);

final LinearGradient mainGradient = LinearGradient(
colors: [Color(0xFF00C6FB), Color(0xFF005BEA)],
colors: [Color(0xFFFBB800), Color(0xFFEA7500)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
);
7 changes: 5 additions & 2 deletions lib/design/images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@ import 'package:flutter_svg/flutter_svg.dart';

final SvgPicture homeIcon = SvgPicture.asset('assets/images/home.svg');
final SvgPicture activeHomeIcon = SvgPicture.asset(
'assets/images/active_home.svg',
'assets/images/active_home_o.svg',
);
final SvgPicture appIcon = SvgPicture.asset('assets/images/app.svg');
final SvgPicture activeAppIcon = SvgPicture.asset(
'assets/images/active_app.svg',
);
final SvgPicture serverIcon = SvgPicture.asset('assets/images/server.svg');
final SvgPicture activeServerIcon = SvgPicture.asset(
'assets/images/active_server.svg',
'assets/images/active_server_o.svg',
);
final SvgPicture settingsIcon = SvgPicture.asset('assets/images/settings.svg');
final SvgPicture activeSettingsIcon = SvgPicture.asset(
'assets/images/active_settings_o.svg',
);
final SvgPicture speedIcon = SvgPicture.asset('assets/images/speed.svg');
final SvgPicture deFlag = SvgPicture.asset('assets/images/de.svg');
26 changes: 0 additions & 26 deletions lib/l10n/app_ru.arb

This file was deleted.

26 changes: 0 additions & 26 deletions lib/l10n/app_th.arb

This file was deleted.

26 changes: 0 additions & 26 deletions lib/l10n/app_zh.arb

This file was deleted.

54 changes: 21 additions & 33 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';

import 'package:vpn_client/pages/apps/apps_page.dart';
import 'dart:ui' as ui;
import 'package:vpn_client/pages/main/main_page.dart';
import 'package:vpn_client/pages/settings/settings_page.dart';
import 'package:vpn_client/pages/settings/setting_page.dart';
import 'package:vpn_client/pages/servers/servers_page.dart';
import 'package:vpn_client/theme_provider.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:vpn_client/vpn_state.dart';
import 'package:vpn_client/localization_service.dart';

import 'design/colors.dart';
import 'nav_bar.dart';

void main() {
void main() async {
WidgetsFlutterBinding.ensureInitialized();

Locale userLocale =
ui.PlatformDispatcher.instance.locale; // <-- Get the system locale
await LocalizationService.load(userLocale);

runApp(
MultiProvider(
providers: [
Expand All @@ -37,28 +43,23 @@ class App extends StatelessWidget {
final Locale? manualLocale = null; // ← use system by default

return MaterialApp(
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
debugShowCheckedModeBanner: false,
title: 'VPN Client',
theme: lightTheme,
darkTheme: darkTheme,
locale: manualLocale,
localeResolutionCallback: (locale, supportedLocales) {
localeResolutionCallback: (locale, _) {
if (locale == null) return const Locale('en');

// Check for exact match
for (var supportedLocale in supportedLocales) {
if (supportedLocale.languageCode == locale.languageCode &&
(supportedLocale.countryCode == null ||
supportedLocale.countryCode == locale.countryCode)) {
return supportedLocale;
}
}

// If Chinese variants are not supported, fallback to zh
if (locale.languageCode == 'zh') {
return supportedLocales.contains(const Locale('zh'))
? const Locale('zh')
: const Locale('en');
final supported = ['en', 'ru', 'th', 'zh'];
if (supported.contains(locale.languageCode)) {
return Locale(locale.languageCode);
}

// Fallback to 'en' if not found
Expand All @@ -67,19 +68,6 @@ class App extends StatelessWidget {

themeMode: themeProvider.themeMode,
home: const MainScreen(),

localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: const [
Locale('en'),
Locale('ru'),
Locale('th'),
Locale('zh'),
],
);
}
}
Expand All @@ -103,7 +91,7 @@ class _MainScreenState extends State<MainScreen> {
ServersPage(onNavBarTap: _handleNavBarTap),
const MainPage(),
const PlaceholderPage(text: 'Speed Page'),
const SettingsPage(),
SettingPage(onNavBarTap: _handleNavBarTap),
];
}

Expand Down
Loading
Loading