关于页确定完成设置
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.lxh.battery_health"
|
||||
compileSdk = flutter.compileSdkVersion
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_11
|
||||
targetCompatibility = JavaVersion.VERSION_11
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = JavaVersion.VERSION_11.toString()
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId = "com.lxh.battery_health"
|
||||
// You can update the following values to match your application needs.
|
||||
// For more information, see: https://flutter.dev/to/review-gradle-config.
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = flutter.targetSdkVersion
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("kotlin-android")
|
||||
id("dev.flutter.flutter-gradle-plugin")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.lxh.battery_health"
|
||||
compileSdk = 34
|
||||
ndkVersion = flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.lxh.battery_health"
|
||||
minSdk = flutter.minSdkVersion
|
||||
targetSdk = 34
|
||||
versionCode = flutter.versionCode
|
||||
versionName = flutter.versionName
|
||||
multiDexEnabled = true
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
// 如果没有正式签名,可以用 debug 签名代替(测试用)
|
||||
// 正式发布时请替换为自己的密钥
|
||||
getByName("debug") {
|
||||
// debug 签名已经存在,无需额外配置
|
||||
}
|
||||
create("release") {
|
||||
// 如果有正式签名,在这里配置
|
||||
// keyAlias = "..."
|
||||
// keyPassword = "..."
|
||||
// storeFile = file("...")
|
||||
// storePassword = "..."
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
debug {
|
||||
// 🟢 关键:debug 版本包名加 .dev 后缀
|
||||
applicationIdSuffix = ".dev"
|
||||
signingConfig = signingConfigs.getByName("debug")
|
||||
isDebuggable = true
|
||||
isMinifyEnabled = false
|
||||
isShrinkResources = false
|
||||
}
|
||||
release {
|
||||
// release 版本不加后缀,保持原包名
|
||||
signingConfig = signingConfigs.getByName("debug") // 若没有正式签名,先用 debug 签名
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// 无需额外添加 Activity KTX,因为已改用 startActivityForResult
|
||||
}
|
||||
@@ -45,6 +45,14 @@
|
||||
<intent>
|
||||
<action android:name="android.intent.action.PROCESS_TEXT"/>
|
||||
<data android:mimeType="text/plain"/>
|
||||
</intent>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="https" />
|
||||
</intent>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<data android:scheme="http" />
|
||||
</intent>
|
||||
</queries>
|
||||
</manifest>
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.net.Uri
|
||||
import android.os.BatteryManager
|
||||
import android.app.Activity
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.DocumentsContract
|
||||
@@ -135,7 +136,7 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
if (requestCode == FOLDER_PICKER_REQUEST && resultCode == ComponentActivity.RESULT_OK) {
|
||||
if (requestCode == FOLDER_PICKER_REQUEST && resultCode == RESULT_OK) {
|
||||
val uri = data?.data
|
||||
if (uri != null) {
|
||||
try {
|
||||
|
||||
+16
-13
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class AboutPage extends StatelessWidget {
|
||||
@@ -29,7 +30,7 @@ class AboutPage extends StatelessWidget {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// 🟢 Logo 图片(替换之前的 Icon)
|
||||
// Logo
|
||||
Container(
|
||||
width: 120,
|
||||
height: 120,
|
||||
@@ -49,7 +50,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// APP 名称
|
||||
const Text(
|
||||
'MEIZU Battery Healthy',
|
||||
style: TextStyle(
|
||||
@@ -59,7 +59,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
// 版本号
|
||||
Text(
|
||||
'版本 1.7.0',
|
||||
style: TextStyle(
|
||||
@@ -70,7 +69,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 分隔线
|
||||
Divider(
|
||||
color: Colors.grey.shade300,
|
||||
thickness: 0.5,
|
||||
@@ -78,7 +76,6 @@ class AboutPage extends StatelessWidget {
|
||||
endIndent: 40,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
// 作者信息
|
||||
const Text(
|
||||
'专机专配 · 仅针对魅族独家开发',
|
||||
style: TextStyle(
|
||||
@@ -97,9 +94,9 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
// Gitea 链接
|
||||
// 源码链接按钮
|
||||
InkWell(
|
||||
onTap: _launchUrl,
|
||||
onTap: () => _launchUrl(context), // 注意这里传入了 context
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -140,7 +137,6 @@ class AboutPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 40),
|
||||
// 底部版本信息
|
||||
Text(
|
||||
'Made with ❤️ in Flyme · 2026',
|
||||
style: TextStyle(
|
||||
@@ -156,18 +152,25 @@ class AboutPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _launchUrl() async {
|
||||
Future<void> _launchUrl(BuildContext context) async {
|
||||
const url = 'https://git.whitetop.xyz/lxh2875931338/MEIZU-Battery-Healthy';
|
||||
final uri = Uri.parse(url);
|
||||
|
||||
try {
|
||||
if (await canLaunchUrl(uri)) {
|
||||
// ✅ 直接尝试打开,不再检查 canLaunchUrl
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
} else {
|
||||
debugPrint('无法打开链接: $url');
|
||||
}
|
||||
} catch (e) {
|
||||
// 如果打开失败,复制链接并提示
|
||||
debugPrint('打开链接失败: $e');
|
||||
await Clipboard.setData(ClipboardData(text: url));
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text('无法自动打开浏览器,链接已复制到剪贴板。'),
|
||||
duration: Duration(seconds: 3),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
# Generated by pub
|
||||
# See https://dart.dev/tools/pub/glossary#lockfile
|
||||
packages:
|
||||
android_intent_plus:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: android_intent_plus
|
||||
sha256: "2329378af63f49b985cb2e110ac784d08374f1e2b1984be77ba9325b1c8cce11"
|
||||
url: "https://pub.flutter-io.cn"
|
||||
source: hosted
|
||||
version: "5.3.1"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+2
-1
@@ -39,7 +39,8 @@ dependencies:
|
||||
flutter_svg: ^2.0.10+1
|
||||
shared_preferences: ^2.2.0
|
||||
flutter_markdown: ^0.7.0
|
||||
url_launcher: ^6.3.2
|
||||
url_launcher: 6.3.2
|
||||
android_intent_plus: ^5.2.0
|
||||
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
|
||||
Reference in New Issue
Block a user