import 'package:get/get.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:trans_lark/router/get_router.dart'; class SettingsController extends GetxController { var versionName = ''.obs; var options = ['Privacy Policy', 'User Agreement']; @override void onReady() { super.onReady(); _getAppVersion(); } /// 获取版本号 void _getAppVersion() async { final packageInfo = await PackageInfo.fromPlatform(); versionName.value = 'version number ${packageInfo.version}'; } void clickItem(int index, {String? title}) { if (index == 0) { Get.toNamed(GetRouter.privacy, arguments: { 'title': options[index], 'url': 'https://translark.bitbucket.io/privacy.html', }); } else if (index == 1) { Get.toNamed(GetRouter.privacy, arguments: { 'title': options[index], 'url': 'https://translark.bitbucket.io/terms.html', }); } } }