import 'dart:async'; import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:url_launcher/url_launcher.dart'; import 'misc.dart'; import 'platform.dart'; import '../extension/stringx.dart'; import '../extension/uint8list.dart'; Future openUrl(String url) async { return await launchUrl(url.uri, mode: LaunchMode.externalApplication); } void setTransparentNavigationBar(BuildContext context) { if (isAndroid) { SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); SystemChrome.setSystemUIOverlayStyle( const SystemUiOverlayStyle( systemNavigationBarColor: Colors.transparent, systemNavigationBarContrastEnforced: true), ); } } Future loadFontFile(String localPath) async { if (localPath.isEmpty) return; final name = getFileName(localPath); if (name == null) return; final file = File(localPath); if (!await file.exists()) return; var fontLoader = FontLoader(name); fontLoader.addFont(file.readAsBytes().byteData); await fontLoader.load(); } void switchStatusBar({required bool hide}) { if (hide) { SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky, overlays: []); } else { SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge, overlays: [SystemUiOverlay.top, SystemUiOverlay.bottom]); } }