feat: 版本号增加
This commit is contained in:
parent
e82480b937
commit
dbcdf8b8a4
@ -12,6 +12,8 @@ class HIMenuController extends GetxController {
|
|||||||
final KRSubscribeService kr_subscribeService = KRSubscribeService();
|
final KRSubscribeService kr_subscribeService = KRSubscribeService();
|
||||||
// 版本号
|
// 版本号
|
||||||
final RxString kr_version = ''.obs;
|
final RxString kr_version = ''.obs;
|
||||||
|
final RxString kr_buildNumber = ''.obs;
|
||||||
|
final RxBool kr_showBuild = false.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() {
|
||||||
@ -23,5 +25,10 @@ class HIMenuController extends GetxController {
|
|||||||
Future<void> _kr_getVersion() async {
|
Future<void> _kr_getVersion() async {
|
||||||
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
final PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||||
kr_version.value = packageInfo.version;
|
kr_version.value = packageInfo.version;
|
||||||
|
kr_buildNumber.value = packageInfo.buildNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
void toggleVersionDisplay() {
|
||||||
|
kr_showBuild.value = !kr_showBuild.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,18 +82,19 @@ class HIMenuView extends GetView<HIMenuController> implements HasSwipeConfig {
|
|||||||
),
|
),
|
||||||
// 版本号信息
|
// 版本号信息
|
||||||
Obx(() {
|
Obx(() {
|
||||||
// 1. 从 Obx 的回调函数中 return 一个 Widget
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
bottom: 40.0,
|
bottom: 40.0,
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
child: Text(
|
child: GestureDetector(
|
||||||
'当前版本:${controller.kr_version.value}',
|
onDoubleTap: () => controller.toggleVersionDisplay(),
|
||||||
textAlign: TextAlign.center,
|
child: Text(
|
||||||
style: TextStyle(
|
'当前版本:${controller.kr_showBuild.value ? '${controller.kr_version.value}.${controller.kr_buildNumber.value}' : controller.kr_version.value}',
|
||||||
// 2. 建议使用更稳定的颜色,避免主题切换时出现问题
|
textAlign: TextAlign.center,
|
||||||
color: Theme.of(context).primaryColor,
|
style: TextStyle(
|
||||||
fontSize: 10.w,
|
color: Theme.of(context).primaryColor,
|
||||||
|
fontSize: 10.w,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ 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
|
# 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
|
# 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.
|
# of the product and file versions while build-number is used as the build suffix.
|
||||||
version: 0.0.4
|
version: 0.0.4+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=3.5.0 <4.0.0'
|
sdk: '>=3.5.0 <4.0.0'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user