314 lines
10 KiB
Dart
Executable File
314 lines
10 KiB
Dart
Executable File
import 'dart:io';
|
|
|
|
import 'package:device_info_plus/device_info_plus.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:package_info_plus/package_info_plus.dart';
|
|
import 'package:star_lock/appRouters.dart';
|
|
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
|
import 'package:star_lock/mine/about/about_console.dart';
|
|
import 'package:star_lock/tools/NativeInteractionTool.dart';
|
|
import 'package:star_lock/tools/push/xs_jPhush.dart';
|
|
|
|
import '../../app_settings/app_colors.dart';
|
|
import '../../flavors.dart';
|
|
import '../../tools/commonItem.dart';
|
|
import '../../tools/storage.dart';
|
|
import '../../tools/titleAppBar.dart';
|
|
import '../../tools/wechat/wechatManageTool.dart';
|
|
|
|
class AboutPage extends StatefulWidget {
|
|
const AboutPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<AboutPage> createState() => _AboutPageState();
|
|
}
|
|
|
|
class _AboutPageState extends State<AboutPage> {
|
|
late PackageInfo packageInfo;
|
|
String appName = '';
|
|
String packageName = '';
|
|
String version = '-----';
|
|
String buildNumber = '---';
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
// AppLog.log('Get.locale!: ${Get.locale.toString()}');
|
|
|
|
initPackageInfo();
|
|
}
|
|
|
|
Future<void> initPackageInfo() async {
|
|
packageInfo = await PackageInfo.fromPlatform();
|
|
setState(() {
|
|
appName = packageInfo.appName;
|
|
packageName = packageInfo.packageName;
|
|
version = packageInfo.version;
|
|
buildNumber = packageInfo.buildNumber;
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GetBuilder<AboutConsole>(
|
|
init: AboutConsole(),
|
|
builder: (AboutConsole logic) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.mainBackgroundColor,
|
|
appBar: F.sw(
|
|
skyCall: () => TitleAppBar(
|
|
barTitle: '关于'.tr,
|
|
haveBack: true,
|
|
backgroundColor: AppColors.mainColor,
|
|
),
|
|
xhjCall: () => TitleAppBar(
|
|
barTitle: '关于'.tr,
|
|
haveBack: true,
|
|
backgroundColor: Colors.white,
|
|
iconColor: AppColors.blackColor,
|
|
titleColor: AppColors.blackColor,
|
|
),
|
|
),
|
|
body: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
F.sw(skyCall: logoView, xhjCall: () => const SizedBox()),
|
|
listView(),
|
|
F.sw(skyCall: () => const SizedBox(), xhjCall: logoView),
|
|
],
|
|
),
|
|
);
|
|
});
|
|
}
|
|
|
|
//列表
|
|
Widget listView() {
|
|
Widget view = Column(
|
|
children: [
|
|
CommonItem(
|
|
leftTitel: '版本说明'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () async {
|
|
WechatManageTool.getAppInfo(() async {
|
|
final String? appVersionHistoryBaseUrl =
|
|
await Storage.getString(appVersionHistoryUrl);
|
|
if (appVersionHistoryBaseUrl == null) {
|
|
return;
|
|
}
|
|
String brandName = '';
|
|
if (Platform.isAndroid) {
|
|
final AndroidDeviceInfo androidDeviceInfo =
|
|
await DeviceInfoPlugin().androidInfo;
|
|
brandName = androidDeviceInfo.manufacturer;
|
|
} else {
|
|
final IosDeviceInfo iosDeviceInfo =
|
|
await DeviceInfoPlugin().iosInfo;
|
|
brandName = iosDeviceInfo.systemName ?? 'ios';
|
|
}
|
|
final PackageInfo packageInfo =
|
|
await PackageInfo.fromPlatform();
|
|
Navigator.pushNamed(context, Routers.webviewShowPage,
|
|
arguments: {
|
|
'url': appVersionHistoryBaseUrl +
|
|
'?version=${packageInfo.version}&brandName=${brandName}',
|
|
'title': '版本说明'.tr
|
|
});
|
|
});
|
|
}),
|
|
Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
indent: 20.w,
|
|
endIndent: 20.w,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '介绍'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.webviewShowPage, arguments: {
|
|
'url': XSConstantMacro.introduceURL +
|
|
'?lang=${Get.locale!.toString()}',
|
|
'title': '介绍'.tr
|
|
});
|
|
}),
|
|
Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
indent: 20.w,
|
|
endIndent: 20.w,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '用户协议'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Get.toNamed(Routers.webviewShowPage, arguments: {
|
|
'url': XSConstantMacro.userAgreementURL +
|
|
'?lang=${Get.locale!.toString()}',
|
|
'title': '用户协议'.tr
|
|
});
|
|
}),
|
|
Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
indent: 20.w,
|
|
endIndent: 20.w,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '隐私政策'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.webviewShowPage, arguments: {
|
|
'url': XSConstantMacro.privacyPolicyURL +
|
|
'?lang=${Get.locale!.toString()}',
|
|
'title': '隐私政策'.tr
|
|
});
|
|
}),
|
|
Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
indent: 20.w,
|
|
endIndent: 20.w,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '个人信息收集清单'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.webviewShowPage, arguments: {
|
|
'url': XSConstantMacro.collectionListURL +
|
|
'?lang=${Get.locale!.toString()}',
|
|
'title': '个人信息收集清单'.tr
|
|
});
|
|
}),
|
|
Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
indent: 20.w,
|
|
endIndent: 20.w,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '应用权限说明'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.webviewShowPage, arguments: {
|
|
'url': XSConstantMacro.appPermissionDescURL +
|
|
'?lang=${Get.locale!.toString()}',
|
|
'title': '应用权限说明'.tr
|
|
});
|
|
}),
|
|
Divider(
|
|
height: 1,
|
|
color: AppColors.greyLineColor,
|
|
indent: 20.w,
|
|
endIndent: 20.w,
|
|
),
|
|
CommonItem(
|
|
leftTitel: '第三方信息共享清单'.tr,
|
|
rightTitle: '',
|
|
isHaveLine: false,
|
|
isHaveDirection: true,
|
|
action: () {
|
|
Navigator.pushNamed(context, Routers.webviewShowPage, arguments: {
|
|
'url': XSConstantMacro.thirdPartyInfShareListURL +
|
|
'?lang=${Get.locale!.toString()}',
|
|
'title': '第三方信息共享清单'.tr
|
|
});
|
|
}),
|
|
],
|
|
);
|
|
view = F.sw(
|
|
skyCall: () => view,
|
|
xhjCall: () => Container(
|
|
margin: EdgeInsets.only(top: 20.h, left: 20.w, right: 20.w),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.all(Radius.circular(20.r))),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(20.r),
|
|
child: view,
|
|
),
|
|
));
|
|
return view;
|
|
}
|
|
|
|
//图标
|
|
Widget logoView() {
|
|
return GetBuilder<AboutConsole>(builder: (AboutConsole logic) {
|
|
return Padding(
|
|
padding: EdgeInsets.only(top: 70.h, bottom: 60.h),
|
|
child: Column(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.topRight,
|
|
child: GestureDetector(
|
|
onTap: logic.handleTap,
|
|
child: Container(
|
|
color: Colors.transparent,
|
|
width: 80.w,
|
|
height: 80.h,
|
|
),
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onLongPress: () async {
|
|
final PackageInfo packageInfo =
|
|
await PackageInfo.fromPlatform();
|
|
final vendorChannelTokens = StringBuffer();
|
|
for (final String channel
|
|
in XSJPushProvider.channelTypeMapping.values) {
|
|
final String? oldVendorToken =
|
|
await Storage.getString('old_$channel');
|
|
if (GetUtils.isNullOrBlank(oldVendorToken) ?? true) {
|
|
continue;
|
|
}
|
|
vendorChannelTokens.write('$channel:$oldVendorToken');
|
|
}
|
|
Clipboard.setData(
|
|
ClipboardData(text: vendorChannelTokens.toString()));
|
|
EasyLoading.showToast(
|
|
'${packageInfo.packageName}的channelTokens:(${vendorChannelTokens.toString()})复制成功'
|
|
.tr);
|
|
},
|
|
onTap: logic.handleTap,
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.circular(20.r),
|
|
child: Image.asset(
|
|
F.sw(
|
|
skyCall: () => 'images/icon_main_sky_1024.png',
|
|
xhjCall: () => 'images/icon_main_xhj_1024.png'),
|
|
width: 160.w,
|
|
height: 160.w),
|
|
),
|
|
),
|
|
SizedBox(height: 20.h),
|
|
Text(
|
|
'${F.title} $version+$buildNumber',
|
|
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
|
),
|
|
SizedBox(height: 20.h),
|
|
Text(
|
|
F.apiPrefix,
|
|
style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|