commit 90f6d120eb96c969083962ece3c176d51bfeb12f
Author: driftinblock <3480428251@qq.com>
Date: Thu Aug 27 15:41:11 2026 +0800
first commit
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..51f47ff
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,44 @@
+# Miscellaneous
+*.class
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.build/
+.buildlog/
+.history
+.svn/
+.swiftpm/
+migrate_working_dir/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# VSCode
+.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+**/ios/Flutter/.last_build_id
+.dart_tool/
+.flutter-plugins-dependencies
+.pub-cache/
+.pub/
+build/
+/coverage/
+pubspec.lock
+
+# Symbolication related
+app.*.symbols
+
+# Obfuscation related
+app.*.map.json
+
+# Android Studio will place build artifacts here
+/android/app/debug
+/android/app/profile
+/android/app/release
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..c374953
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2026 driftinblock && venti1112
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..4f7d3d7
--- /dev/null
+++ b/README.md
@@ -0,0 +1,78 @@
+ZV Manager
+
+你的手机,就是服务器控制台
+
+ZV Manager 是一款轻量、安全的 Minecraft 服务器远程管理工具。通过 RCON 协议,让你随时随地用手机管理你的服务器,无需打开电脑。
+
+---
+
+功能特性
+
+| 模块 | 功能 | 状态 |
+|------|------|------|
+| 服务器管理 | 添加/编辑/删除服务器 |
+| 服务器管理 | 多服务器切换 |
+| 状态监控 | 实时在线人数 |
+| 状态监控 | TPS 监控
+| 玩家管理 | 查看玩家列表
+| 玩家管理 | 授予/撤销 OP
+| 玩家管理 | 踢出/封禁玩家
+| 玩家管理 | 批量操作玩家
+| 控制台 | RCON 模式 |
+| 控制台 | 快速命令预设
+| 主题 | 浅色/深色/跟随系统
+| 壁纸 | 自定义壁纸
+| 数据 | 加密存储
+
+技术栈
+
+| 项目 | 说明 |
+|------|------|
+| **框架** | Flutter 3.x |
+| **语言** | Dart 3.x |
+| **目标平台** | Android 7.0+ / Web |
+| **通信协议** | RCON (Minecraft 远程控制协议) |
+| **本地存储** | Shared Preferences + Flutter Secure Storage |
+| **状态管理** | Provider |
+| **主题** | Material 3 |
+
+---
+
+项目结构
+
+```
+
+lib/
+├── main.dart # 应用入口
+├── app.dart # MaterialApp 配置
+├── core/
+│ ├── theme/
+│ │ └── app_theme.dart # MD3 主题定义
+│ ├── utils/
+│ │ ├── rcon_client.dart # RCON 客户端
+│ │ └── update_service.dart # 更新检查
+│ └── widgets/
+│ └── background_widget.dart # 壁纸背景组件
+├── data/
+│ └── services/
+│ └── secure_storage_service.dart # 加密存储
+├── features/
+│ ├── server_list/
+│ │ ├── server_list_page.dart # 服务器列表
+│ │ └── server_form_dialog.dart # 添加/编辑弹窗
+│ ├── console/
+│ │ └── console_page.dart # 双模式控制台
+│ ├── player_management/
+│ │ └── player_list_page.dart # 玩家管理
+│ └── settings/
+│ ├── settings_page.dart # 设置页
+│ └── wallpaper_settings.dart # 壁纸设置
+└── providers/
+├── server_provider.dart # 服务器状态
+├── theme_provider.dart # 主题状态
+├── wallpaper_provider.dart # 壁纸状态
+└── rcon_provider.dart # RCON 状态
+
+```
+
+---
diff --git a/analysis_options.yaml b/analysis_options.yaml
new file mode 100644
index 0000000..0abcf92
--- /dev/null
+++ b/analysis_options.yaml
@@ -0,0 +1,38 @@
+# This file configures the analyzer, which statically analyzes Dart code to
+# check for errors, warnings, and lints.
+#
+# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
+# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
+# invoked from the command line by running `flutter analyze`.
+
+analyzer:
+ exclude:
+ - build/**
+ - android/**
+ - ios/**
+ - web/**
+ - windows/**
+ - macos/**
+ - linux/**
+
+# The following line activates a set of recommended lints for Flutter apps,
+# packages, and plugins designed to encourage good coding practices.
+include: package:flutter_lints/flutter.yaml
+
+linter:
+ # The lint rules applied to this project can be customized in the
+ # section below to disable rules from the `package:flutter_lints/flutter.yaml`
+ # included above or to enable additional rules. A list of all available lints
+ # and their documentation is published at https://dart.dev/lints.
+ #
+ # Instead of disabling a lint rule for the entire project in the
+ # section below, it can also be suppressed for a single line of code
+ # or a specific dart file by using the `// ignore: name_of_lint` and
+ # `// ignore_for_file: name_of_lint` syntax on the line or in the file
+ # producing the lint.
+ rules:
+ # avoid_print: false # Uncomment to disable the `avoid_print` rule
+ # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
+
+# Additional information about this file can be found at
+# https://dart.dev/guides/language/analysis-options
diff --git a/android/.gitignore b/android/.gitignore
new file mode 100644
index 0000000..59d6f81
--- /dev/null
+++ b/android/.gitignore
@@ -0,0 +1,9 @@
+/.gradle
+/.kotlin
+/captures/
+/local.properties
+GeneratedPluginRegistrant.java
+.cxx/
+key.properties
+**/*.keystore
+**/*.jks
diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts
new file mode 100644
index 0000000..c881231
--- /dev/null
+++ b/android/app/build.gradle.kts
@@ -0,0 +1,77 @@
+import java.util.Properties
+import java.io.FileInputStream
+
+plugins {
+ id("com.android.application")
+ // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
+ id("dev.flutter.flutter-gradle-plugin")
+}
+
+val keystoreProperties = Properties()
+val keystorePropertiesFile = rootProject.file("key.properties")
+if (keystorePropertiesFile.exists()) {
+ keystoreProperties.load(FileInputStream(keystorePropertiesFile))
+}
+
+android {
+ namespace = "com.mcserver_manager"
+ compileSdk {
+ version = release(37) {
+ minorApiLevel = 1
+ }
+ }
+ buildToolsVersion = "37.0.0"
+ ndkVersion = "30.0.16138531"
+
+ compileOptions {
+ isCoreLibraryDesugaringEnabled = true
+ sourceCompatibility = JavaVersion.VERSION_17
+ targetCompatibility = JavaVersion.VERSION_17
+ }
+
+ defaultConfig {
+ applicationId = "com.mcserver_manager"
+ minSdk = 24
+ targetSdk = 37
+ versionCode = flutter.versionCode
+ versionName = flutter.versionName
+
+ // 仅保留 ARMv8 (arm64-v8a):先清空默认集合再添加,排除 ARMv7 与 x86_64
+ ndk {
+ abiFilters.clear()
+ abiFilters.add("arm64-v8a")
+ }
+ }
+
+ signingConfigs {
+ create("release") {
+ keyAlias = keystoreProperties["keyAlias"] as? String ?: ""
+ keyPassword = keystoreProperties["keyPassword"] as? String ?: ""
+ storeFile = keystoreProperties["storeFile"]?.let { file(it as String) }
+ storePassword = keystoreProperties["storePassword"] as? String ?: ""
+ enableV1Signing = false
+ enableV2Signing = true
+ enableV3Signing = true
+ }
+ }
+
+ buildTypes {
+ release {
+ signingConfig = signingConfigs.getByName("release")
+ }
+ }
+}
+
+kotlin {
+ compilerOptions {
+ jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
+ }
+}
+
+dependencies {
+ coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
+}
+
+flutter {
+ source = "../.."
+}
diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ed0fa66
--- /dev/null
+++ b/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/kotlin/com/minecraft_manager/MainActivity.kt b/android/app/src/main/kotlin/com/minecraft_manager/MainActivity.kt
new file mode 100644
index 0000000..6aecc6b
--- /dev/null
+++ b/android/app/src/main/kotlin/com/minecraft_manager/MainActivity.kt
@@ -0,0 +1,145 @@
+package com.mcserver_manager
+
+import android.content.ActivityNotFoundException
+import android.content.Intent
+import androidx.core.content.FileProvider
+import io.flutter.embedding.android.FlutterActivity
+import io.flutter.embedding.engine.FlutterEngine
+import io.flutter.plugin.common.EventChannel
+import io.flutter.plugin.common.MethodChannel
+import java.io.File
+import java.util.concurrent.atomic.AtomicBoolean
+import java.util.concurrent.atomic.AtomicReference
+
+class MainActivity : FlutterActivity() {
+ private companion object {
+ const val CHANNEL = "mc_server_manager/update"
+ const val PROGRESS_CHANNEL = "mc_server_manager/down_progress"
+ const val ARG_URL = "url"
+ const val ARG_FILENAME = "filename"
+
+ /** 是否正在下载,防止并发下载到同一文件 */
+ val downloading = AtomicBoolean(false)
+
+ /** 下载进度推送事件流(由 Flutter 订阅) */
+ val progressSink = AtomicReference(null)
+ }
+
+ override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
+ super.configureFlutterEngine(flutterEngine)
+ MethodChannel(
+ flutterEngine.dartExecutor.binaryMessenger,
+ CHANNEL,
+ ).setMethodCallHandler { call, result ->
+ when (call.method) {
+ "downloadAndInstall" -> {
+ val url = call.argument(ARG_URL)
+ val filename = call.argument(ARG_FILENAME)
+ if (url.isNullOrBlank()) {
+ result.error("BAD_ARGS", "下载地址为空", null)
+ } else if (!downloading.compareAndSet(false, true)) {
+ // 已有下载正在进行,拒绝并发,避免文件写坏
+ result.error("BUSY", "正在下载,请稍候", null)
+ } else {
+ downloadAndInstall(url, filename ?: "latest.apk", result)
+ }
+ }
+ else -> result.notImplemented()
+ }
+ }
+
+ EventChannel(
+ flutterEngine.dartExecutor.binaryMessenger,
+ PROGRESS_CHANNEL,
+ ).setStreamHandler(object : EventChannel.StreamHandler {
+ override fun onListen(arguments: Any?, events: EventChannel.EventSink?) {
+ progressSink.set(events)
+ }
+
+ override fun onCancel(arguments: Any?) {
+ progressSink.set(null)
+ }
+ })
+ }
+
+ private fun sendProgress(downloaded: Long, total: Long) {
+ val sink = progressSink.get() ?: return
+ val percent = if (total > 0) downloaded.toDouble() / total else 0.0
+ val payload = HashMap()
+ payload["downloaded"] = downloaded
+ payload["total"] = total
+ payload["percent"] = percent
+ android.os.Handler(android.os.Looper.getMainLooper()).post {
+ runCatching { sink.success(payload) }
+ }
+ }
+
+ private fun downloadAndInstall(
+ url: String,
+ filename: String,
+ result: MethodChannel.Result,
+ ) {
+ Thread {
+ try {
+ val dir = File(cacheDir, "apk").apply { mkdirs() }
+ val file = File(dir, filename)
+ // 删除旧的半成品/残留文件,保证安装的是最新完整文件
+ file.delete()
+
+ val connection = java.net.URL(url).openConnection()
+ connection.setRequestProperty("User-Agent", "MCServerManager")
+ connection.connectTimeout = 15_000
+ connection.readTimeout = 30_000
+ val total = connection.contentLengthLong
+
+ val buffer = ByteArray(8 * 1024)
+ var downloaded = 0L
+ var lastSent = 0L
+ connection.inputStream.use { input ->
+ file.outputStream().use { output ->
+ while (true) {
+ val read = input.read(buffer)
+ if (read < 0) break
+ output.write(buffer, 0, read)
+ downloaded += read
+ // 每约 256KB 推送一次进度,避免高频回调卡顿
+ if (downloaded - lastSent >= 256 * 1024 || downloaded >= total) {
+ sendProgress(downloaded, total)
+ lastSent = downloaded
+ }
+ }
+ }
+ }
+ // 确保最终 100% 进度已推送
+ if (lastSent < downloaded) {
+ sendProgress(downloaded, total)
+ }
+
+ if (file.length() == 0L) {
+ file.delete()
+ runOnUiThread { result.error("DOWNLOAD_FAILED", "下载文件为空", null) }
+ return@Thread
+ }
+
+ val uri = FileProvider.getUriForFile(
+ this,
+ "$packageName.fileprovider",
+ file,
+ )
+ val intent = Intent(Intent.ACTION_VIEW).apply {
+ setDataAndType(uri, "application/vnd.android.package-archive")
+ addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+ addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
+ }
+ startActivity(intent)
+ runOnUiThread { result.success(null) }
+ } catch (e: ActivityNotFoundException) {
+ runOnUiThread { result.error("INSTALL_NOT_FOUND", "未找到可用的安装器", e.message) }
+ } catch (e: Exception) {
+ runOnUiThread { result.error("DOWNLOAD_FAILED", "下载失败:${e.message}", null) }
+ } finally {
+ downloading.set(false)
+ }
+ }.start()
+ }
+}
\ No newline at end of file
diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml
new file mode 100644
index 0000000..f74085f
--- /dev/null
+++ b/android/app/src/main/res/drawable-v21/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 0000000..304732f
--- /dev/null
+++ b/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 0000000..524b09a
Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 0000000..343dacd
Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..b3a9813
Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..444887d
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 0000000..9b1f663
Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml
new file mode 100644
index 0000000..06952be
--- /dev/null
+++ b/android/app/src/main/res/values-night/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml
new file mode 100644
index 0000000..cb1ef88
--- /dev/null
+++ b/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
diff --git a/android/app/src/main/res/xml/file_paths.xml b/android/app/src/main/res/xml/file_paths.xml
new file mode 100644
index 0000000..e45a6d3
--- /dev/null
+++ b/android/app/src/main/res/xml/file_paths.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/android/build.gradle.kts b/android/build.gradle.kts
new file mode 100644
index 0000000..362da11
--- /dev/null
+++ b/android/build.gradle.kts
@@ -0,0 +1,65 @@
+allprojects {
+ repositories {
+ google()
+ mavenCentral()
+ }
+}
+
+val newBuildDir: Directory =
+ rootProject.layout.buildDirectory
+ .dir("../../build")
+ .get()
+rootProject.layout.buildDirectory.value(newBuildDir)
+
+subprojects {
+ val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
+ project.layout.buildDirectory.value(newSubprojectBuildDir)
+}
+
+gradle.beforeProject {
+ val flutterExt = extensions.findByName("flutter")
+ if (flutterExt != null) {
+ try {
+ var klass: Class<*>? = flutterExt.javaClass
+ var field: java.lang.reflect.Field? = null
+ while (klass != null && field == null) {
+ try { field = klass.getDeclaredField("ndkVersion") }
+ catch (e: NoSuchFieldException) { klass = klass.superclass }
+ }
+ if (field != null) {
+ field.isAccessible = true
+ field.set(flutterExt, "30.0.16138531")
+ }
+ } catch (e: Exception) {
+ logger.warn("无法反射修改 flutter.ndkVersion: ${e.message}")
+ }
+ }
+
+ plugins.withId("com.android.application") {
+ extensions.findByType()?.apply {
+ buildToolsVersion = "37.0.0"
+ externalNativeBuild { cmake { version = "4.1.2" } }
+ }
+ }
+ plugins.withId("com.android.library") {
+ extensions.findByType()?.apply {
+ buildToolsVersion = "37.0.0"
+ externalNativeBuild { cmake { version = "4.1.2" } }
+ }
+ }
+ afterEvaluate {
+ val libExt = extensions.findByType()
+ if (libExt != null) {
+ libExt.compileSdk = 37
+ libExt.compileSdkMinor = 1
+ }
+ }
+}
+
+subprojects {
+ project.evaluationDependsOn(":app")
+}
+
+tasks.register("clean") {
+ delete(rootProject.layout.buildDirectory)
+}
diff --git a/android/gradle.properties b/android/gradle.properties
new file mode 100644
index 0000000..8929bfe
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,8 @@
+org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
+android.useAndroidX=true
+# This newDsl flag was added by the Flutter template
+android.newDsl=false
+# This builtInKotlin flag was added by the Flutter template
+android.builtInKotlin=false
+# 插件源码在 C: 盘( pub 缓存)而项目在 D: 盘,跨盘符路径使 Kotlin 增量编译缓存崩溃,此处禁用
+kotlin.incremental=false
diff --git a/android/gradle/wrapper/gradle-wrapper.jar b/android/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..13372ae
Binary files /dev/null and b/android/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..ffcd530
--- /dev/null
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-all.zip
diff --git a/android/gradlew b/android/gradlew
new file mode 100644
index 0000000..9d82f78
--- /dev/null
+++ b/android/gradlew
@@ -0,0 +1,160 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/android/gradlew.bat b/android/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/android/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz variants
+
+if not "%OS%" == "Windows_NT" goto win9xME_args
+if "%@eval[2+2]" == "4" goto 4NT_args
+
+:win9xME_args
+@rem Slurp the command line arguments.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+if "x%~1" == "x" goto execute
+
+set CMD_LINE_ARGS=%*
+goto execute
+
+:4NT_args
+@rem Get arguments from the 4NT Shell from JP Software
+set CMD_LINE_ARGS=%$
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts
new file mode 100644
index 0000000..22e0aab
--- /dev/null
+++ b/android/settings.gradle.kts
@@ -0,0 +1,26 @@
+pluginManagement {
+ val flutterSdkPath =
+ run {
+ val properties = java.util.Properties()
+ file("local.properties").inputStream().use { properties.load(it) }
+ val flutterSdkPath = properties.getProperty("flutter.sdk")
+ require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
+ flutterSdkPath
+ }
+
+ includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
+
+ repositories {
+ google()
+ mavenCentral()
+ gradlePluginPortal()
+ }
+}
+
+plugins {
+ id("dev.flutter.flutter-plugin-loader") version "1.0.0"
+ id("com.android.application") version "9.3.1" apply false
+ id("org.jetbrains.kotlin.android") version "2.4.10" apply false
+}
+
+include(":app")
diff --git a/lib/app.dart b/lib/app.dart
new file mode 100644
index 0000000..9efd141
--- /dev/null
+++ b/lib/app.dart
@@ -0,0 +1,92 @@
+import 'dart:async';
+import 'package:flutter/material.dart';
+import 'package:flutter_localizations/flutter_localizations.dart';
+import 'package:package_info_plus/package_info_plus.dart';
+import 'package:provider/provider.dart';
+import 'core/theme/app_theme.dart';
+import 'core/utils/update_service.dart';
+import 'core/widgets/background_widget.dart';
+import 'features/server_list/server_list_page.dart';
+import 'providers/theme_provider.dart';
+import 'providers/server_provider.dart';
+
+/// 全局导航 Key
+final navigatorKey = GlobalKey();
+
+class ZVManagerApp extends StatefulWidget {
+ const ZVManagerApp({super.key});
+
+ @override
+ State createState() => ZVManagerAppState();
+}
+
+class ZVManagerAppState extends State {
+ final GlobalKey _bgKey = GlobalKey();
+
+ @override
+ void initState() {
+ super.initState();
+ _checkUpdateSilently();
+ }
+
+ Future _checkUpdateSilently() async {
+ await Future.delayed(const Duration(seconds: 1));
+ if (!mounted) return;
+ try {
+ final packageInfo = await PackageInfo.fromPlatform();
+ final updateInfo = await UpdateService.fetchInfo(userAgent: packageInfo.version);
+ if (!mounted || updateInfo == null) return;
+ final navContext = navigatorKey.currentContext;
+ if (navContext == null || !navContext.mounted) return;
+ UpdateService.showUpdateDialog(
+ navContext,
+ updateInfo,
+ packageInfo.version,
+ silentOnNoUpdate: true,
+ );
+ } catch (_) {}
+ }
+
+ void refreshBackground() {
+ _bgKey.currentState?.refreshBackground();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return MultiProvider(
+ providers: [
+ ChangeNotifierProvider(create: (_) => ThemeProvider()),
+ ChangeNotifierProvider(create: (_) => ServerProvider()),
+ ],
+ child: Consumer(
+ builder: (context, themeProvider, child) {
+ return MaterialApp(
+ title: 'ZV Manager',
+ debugShowCheckedModeBanner: false,
+ navigatorKey: navigatorKey,
+ theme: AppTheme.lightTheme,
+ darkTheme: AppTheme.darkTheme,
+ themeMode: themeProvider.flutterThemeMode,
+ locale: const Locale('zh', 'CN'),
+ localizationsDelegates: const [
+ GlobalMaterialLocalizations.delegate,
+ GlobalWidgetsLocalizations.delegate,
+ GlobalCupertinoLocalizations.delegate,
+ ],
+ supportedLocales: const [
+ Locale('zh', 'CN'),
+ Locale('en', 'US'),
+ ],
+ home: const ServerListPage(),
+ builder: (context, child) {
+ return BackgroundWidget(
+ key: _bgKey,
+ child: child!,
+ );
+ },
+ );
+ },
+ ),
+ );
+ }
+}
\ No newline at end of file
diff --git a/lib/core/theme/app_theme.dart b/lib/core/theme/app_theme.dart
new file mode 100644
index 0000000..a878019
--- /dev/null
+++ b/lib/core/theme/app_theme.dart
@@ -0,0 +1,41 @@
+import 'package:flutter/material.dart';
+
+enum AppThemeMode { light, dark, system }
+
+class AppTheme {
+ static const _primaryColor = Color(0xFF4CAF50);
+
+ static ThemeData get lightTheme => ThemeData(
+ useMaterial3: true,
+ brightness: Brightness.light,
+ colorSchemeSeed: _primaryColor,
+ appBarTheme: const AppBarTheme(centerTitle: true),
+ inputDecorationTheme: InputDecorationTheme(
+ border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
+ filled: true,
+ ),
+ );
+
+ static ThemeData get darkTheme => ThemeData(
+ useMaterial3: true,
+ brightness: Brightness.dark,
+ colorSchemeSeed: _primaryColor,
+ appBarTheme: const AppBarTheme(centerTitle: true),
+ scaffoldBackgroundColor: const Color(0xFF121212),
+ inputDecorationTheme: InputDecorationTheme(
+ border: OutlineInputBorder(borderRadius: BorderRadius.circular(8)),
+ filled: true,
+ ),
+ );
+
+ static ThemeMode toFlutterThemeMode(AppThemeMode mode) {
+ switch (mode) {
+ case AppThemeMode.light:
+ return ThemeMode.light;
+ case AppThemeMode.dark:
+ return ThemeMode.dark;
+ case AppThemeMode.system:
+ return ThemeMode.system;
+ }
+ }
+}
diff --git a/lib/core/utils/background_service.dart b/lib/core/utils/background_service.dart
new file mode 100644
index 0000000..6511914
--- /dev/null
+++ b/lib/core/utils/background_service.dart
@@ -0,0 +1,40 @@
+import 'package:shared_preferences/shared_preferences.dart';
+
+class BackgroundService {
+ static const String _keyType = 'background_type'; // 'image' 或 'video'
+ static const String _keyPath = 'background_path';
+ static const String _keyVideoSound = 'background_video_sound';
+
+ // 保存背景(图片或视频)
+ static Future setBackground(String type, String path) async {
+ final prefs = await SharedPreferences.getInstance();
+ await prefs.setString(_keyType, type);
+ await prefs.setString(_keyPath, path);
+ }
+
+ // 获取背景
+ static Future