flutter: Show en_US Privacy Policy web page when locale is not zh_*
This commit is contained in:
parent
d4f0a8d224
commit
91c04f75b6
|
@ -24,6 +24,7 @@ import 'package:package_info/package_info.dart';
|
||||||
import 'package:sanmill/generated/l10n.dart';
|
import 'package:sanmill/generated/l10n.dart';
|
||||||
import 'package:sanmill/style/app_theme.dart';
|
import 'package:sanmill/style/app_theme.dart';
|
||||||
import 'package:sanmill/widgets/settings_list_tile.dart';
|
import 'package:sanmill/widgets/settings_list_tile.dart';
|
||||||
|
import 'package:devicelocale/devicelocale.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
import 'license_page.dart';
|
import 'license_page.dart';
|
||||||
|
@ -120,11 +121,11 @@ class _AboutPageState extends State<AboutPage> {
|
||||||
),
|
),
|
||||||
ListItemDivider(),
|
ListItemDivider(),
|
||||||
SettingsListTile(
|
SettingsListTile(
|
||||||
context: context,
|
context: context,
|
||||||
titleString: S.of(context).privacyPolicy,
|
titleString: S.of(context).privacyPolicy,
|
||||||
onTap: () => _launchURL(
|
onTap: () {
|
||||||
'https://github.com/calcitem/Sanmill/wiki/privacy_policy'),
|
_launchPrivacyPolicy();
|
||||||
),
|
}),
|
||||||
ListItemDivider(),
|
ListItemDivider(),
|
||||||
SettingsListTile(
|
SettingsListTile(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -160,6 +161,17 @@ class _AboutPageState extends State<AboutPage> {
|
||||||
await launch(url);
|
await launch(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_launchPrivacyPolicy() async {
|
||||||
|
String? locale = await Devicelocale.currentLocale;
|
||||||
|
|
||||||
|
print("local = $locale");
|
||||||
|
if (locale != null && locale.startsWith("zh_")) {
|
||||||
|
_launchURL('https://gitee.com/calcitem/Sanmill/wikis/privacy_policy_zh');
|
||||||
|
} else {
|
||||||
|
_launchURL('https://github.com/calcitem/Sanmill/wiki/privacy_policy');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_showVersionInfo() {
|
_showVersionInfo() {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -23,6 +23,7 @@ dependencies:
|
||||||
catcher: ^0.6.5
|
catcher: ^0.6.5
|
||||||
stack_trace: ^1.10.0
|
stack_trace: ^1.10.0
|
||||||
device_info_plus_platform_interface: ^1.0.1
|
device_info_plus_platform_interface: ^1.0.1
|
||||||
|
devicelocale: ^0.4.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
Loading…
Reference in New Issue