diff --git a/star_lock/lib/mine/about/about_page.dart b/star_lock/lib/mine/about/about_page.dart index 9590c423..61a40a38 100644 --- a/star_lock/lib/mine/about/about_page.dart +++ b/star_lock/lib/mine/about/about_page.dart @@ -3,13 +3,13 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/appRouters.dart'; import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import '../../app_settings/app_colors.dart'; import '../../flavors.dart'; import '../../tools/commonItem.dart'; import '../../tools/titleAppBar.dart'; import '../../translations/trans_lib.dart'; -import '../../network/api.dart'; class AboutPage extends StatefulWidget { const AboutPage({Key? key}) : super(key: key); @@ -19,6 +19,28 @@ class AboutPage extends StatefulWidget { } class _AboutPageState extends State { + late PackageInfo packageInfo; + String appName = ""; + String packageName = ""; + String version = "-----"; + String buildNumber = "---"; + + @override + void initState() { + super.initState(); + initPackageInfo(); + } + + Future 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 Scaffold( @@ -31,15 +53,13 @@ class _AboutPageState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ SizedBox(height: 150.h), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset("images/icon_main_1024.png", width: 160.w, height: 160.w), - ] - ), + Row(mainAxisAlignment: MainAxisAlignment.center, children: [ + Image.asset("images/icon_main_1024.png", + width: 160.w, height: 160.w), + ]), SizedBox(height: 20.h), Text( - "${F.title} 1.0.0.11(preRelease-20240301)", + "${F.title} ${version}+${buildNumber}", style: TextStyle(fontSize: 24.sp, color: AppColors.blackColor), ), SizedBox(height: 20.h), diff --git a/star_lock/pubspec.yaml b/star_lock/pubspec.yaml index 89eae071..39b6b82a 100644 --- a/star_lock/pubspec.yaml +++ b/star_lock/pubspec.yaml @@ -17,7 +17,8 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+11 + +version: 1.0.10+20240201 environment: sdk: '>=2.12.0 <3.0.0' @@ -54,7 +55,7 @@ dependencies: # 屏幕适配 flutter_screenutil: ^5.6.0 # 获取当前项目信息 - package_info_plus: ^3.0.1 + package_info_plus: ^5.0.1 # 选择日期时间 flutter_cupertino_datetime_picker: ^3.0.0 # 选择原生通讯录