Merge branch 'design'
This commit is contained in:
@ -47,6 +47,11 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
'PiliPala',
|
'PiliPala',
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
),
|
),
|
||||||
|
const SizedBox(height: 6),
|
||||||
|
Text(
|
||||||
|
'使用Flutter开发的哔哩哔哩第三方客户端',
|
||||||
|
style: TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Obx(
|
Obx(
|
||||||
() => ListTile(
|
() => ListTile(
|
||||||
@ -82,16 +87,6 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
height: 30,
|
height: 30,
|
||||||
color: Theme.of(context).colorScheme.onInverseSurface,
|
color: Theme.of(context).colorScheme.onInverseSurface,
|
||||||
),
|
),
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
title: const Text('作者'),
|
|
||||||
trailing: Text('guozhigq', style: subTitleStyle),
|
|
||||||
),
|
|
||||||
ListTile(
|
|
||||||
onTap: () {},
|
|
||||||
title: const Text('酷安'),
|
|
||||||
trailing: Text('影若风', style: subTitleStyle),
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () => _aboutController.githubUrl(),
|
onTap: () => _aboutController.githubUrl(),
|
||||||
title: const Text('Github'),
|
title: const Text('Github'),
|
||||||
@ -123,6 +118,11 @@ class _AboutPageState extends State<AboutPage> {
|
|||||||
title: const Text('TG频道'),
|
title: const Text('TG频道'),
|
||||||
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
onTap: () => _aboutController.aPay(),
|
||||||
|
title: const Text('赞助'),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios, size: 16, color: outline),
|
||||||
|
),
|
||||||
Divider(
|
Divider(
|
||||||
thickness: 8,
|
thickness: 8,
|
||||||
height: 30,
|
height: 30,
|
||||||
@ -141,11 +141,12 @@ class AboutController extends GetxController {
|
|||||||
late LatestDataModel remoteAppInfo;
|
late LatestDataModel remoteAppInfo;
|
||||||
RxBool isUpdate = true.obs;
|
RxBool isUpdate = true.obs;
|
||||||
RxBool isLoading = true.obs;
|
RxBool isLoading = true.obs;
|
||||||
|
late LatestDataModel data;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
init();
|
// init();
|
||||||
// 获取当前版本
|
// 获取当前版本
|
||||||
getCurrentApp();
|
getCurrentApp();
|
||||||
// 获取最新的版本
|
// 获取最新的版本
|
||||||
@ -153,16 +154,16 @@ class AboutController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 获取设备信息
|
// 获取设备信息
|
||||||
Future init() async {
|
// Future init() async {
|
||||||
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
// DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
if (Platform.isAndroid) {
|
// if (Platform.isAndroid) {
|
||||||
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
// AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||||
print(androidInfo.supportedAbis);
|
// print(androidInfo.supportedAbis);
|
||||||
} else if (Platform.isIOS) {
|
// } else if (Platform.isIOS) {
|
||||||
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
// IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
|
||||||
print(iosInfo);
|
// print(iosInfo);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 获取当前版本
|
// 获取当前版本
|
||||||
Future getCurrentApp() async {
|
Future getCurrentApp() async {
|
||||||
@ -173,7 +174,7 @@ class AboutController extends GetxController {
|
|||||||
// 获取远程版本
|
// 获取远程版本
|
||||||
Future getRemoteApp() async {
|
Future getRemoteApp() async {
|
||||||
var result = await Request().get(Api.latestApp);
|
var result = await Request().get(Api.latestApp);
|
||||||
LatestDataModel data = LatestDataModel.fromJson(result.data);
|
data = LatestDataModel.fromJson(result.data);
|
||||||
remoteAppInfo = data;
|
remoteAppInfo = data;
|
||||||
remoteVersion.value = data.tagName!;
|
remoteVersion.value = data.tagName!;
|
||||||
isUpdate.value =
|
isUpdate.value =
|
||||||
@ -183,15 +184,7 @@ class AboutController extends GetxController {
|
|||||||
|
|
||||||
// 跳转下载/本地更新
|
// 跳转下载/本地更新
|
||||||
Future onUpdate() async {
|
Future onUpdate() async {
|
||||||
// final dir = await getApplicationSupportDirectory();
|
Utils.matchVersion(data);
|
||||||
// final path = '${dir.path}/pilipala.apk';
|
|
||||||
// var result = await Request()
|
|
||||||
// .downloadFile(remoteAppInfo.assets!.first.downloadUrl, path);
|
|
||||||
// print(result);
|
|
||||||
launchUrl(
|
|
||||||
Uri.parse('https://github.com/guozhigq/pilipala/releases'),
|
|
||||||
mode: LaunchMode.externalApplication,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 跳转github
|
// 跳转github
|
||||||
@ -242,4 +235,16 @@ class AboutController extends GetxController {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
aPay() {
|
||||||
|
try {
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse(
|
||||||
|
'alipayqr://platformapi/startapp?saId=10000007&qrcode=https://qr.alipay.com/fkx14623ddwl1ping3ddd73'),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
print(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
||||||
import 'package:get/get_utils/get_utils.dart';
|
import 'package:get/get_utils/get_utils.dart';
|
||||||
@ -210,6 +211,7 @@ class Utils {
|
|||||||
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
bool isUpdate = Utils.needUpdate(currentInfo.version, data.tagName!);
|
||||||
if (isUpdate) {
|
if (isUpdate) {
|
||||||
SmartDialog.show(
|
SmartDialog.show(
|
||||||
|
animationType: SmartAnimationType.centerFade_otherSlide,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text('🎉 发现新版本 '),
|
title: const Text('🎉 发现新版本 '),
|
||||||
@ -228,22 +230,27 @@ class Utils {
|
|||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => SmartDialog.dismiss(),
|
onPressed: () => SmartDialog.dismiss(),
|
||||||
child: Text(
|
child: Text(
|
||||||
'稍后',
|
'稍后',
|
||||||
style:
|
style:
|
||||||
TextStyle(color: Theme.of(context).colorScheme.outline),
|
TextStyle(color: Theme.of(context).colorScheme.outline),
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
await SmartDialog.dismiss();
|
await SmartDialog.dismiss();
|
||||||
launchUrl(
|
launchUrl(
|
||||||
Uri.parse(
|
Uri.parse('https://www.123pan.com/s/9sVqVv-flu0A.html'),
|
||||||
'https://github.com/guozhigq/pilipala/releases'),
|
mode: LaunchMode.externalApplication,
|
||||||
mode: LaunchMode.externalApplication,
|
);
|
||||||
);
|
},
|
||||||
},
|
child: const Text('网盘下载'),
|
||||||
child: const Text('去下载')),
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => matchVersion(data),
|
||||||
|
child: const Text('Github下载'),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -251,4 +258,27 @@ class Utils {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 下载适用于当前系统的安装包
|
||||||
|
static Future matchVersion(data) async {
|
||||||
|
await SmartDialog.dismiss();
|
||||||
|
// 获取设备信息
|
||||||
|
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
|
||||||
|
// [arm64-v8a]
|
||||||
|
String abi = androidInfo.supportedAbis.first;
|
||||||
|
late String downloadUrl;
|
||||||
|
for (var i in data.assets) {
|
||||||
|
if (i.downloadUrl.contains(abi)) {
|
||||||
|
downloadUrl = i.downloadUrl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 应用外下载
|
||||||
|
launchUrl(
|
||||||
|
Uri.parse(downloadUrl),
|
||||||
|
mode: LaunchMode.externalApplication,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user