url_launcher_util.dart 546 B

123456789101112131415161718192021222324
  1. import 'package:url_launcher/url_launcher.dart';
  2. /// UrlLauncher工具类
  3. class UrlLauncherUtil {
  4. /// 打开微信
  5. static Future<bool> openWeChat() async {
  6. const url = 'weixin://';
  7. return openUrl(url);
  8. }
  9. /// 打开iOS系统键盘设置页
  10. static openIosSystemKeyboardPage() {
  11. const url = 'app-settings:';
  12. return openUrl(url);
  13. }
  14. /// 打开Url
  15. static Future<bool> openUrl(String url) async {
  16. if (!await launchUrl(Uri.parse(url))) {
  17. return Future.value(false);
  18. }
  19. return Future.value(true);
  20. }
  21. }