mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:plain_notification_token/plain_notification_token.dart';
|
||||
|
||||
|
||||
Future<String?> getToken() async {
|
||||
if (isIOS) {
|
||||
final plainNotificationToken = PlainNotificationToken();
|
||||
@@ -14,10 +13,3 @@ Future<String?> getToken() async {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String? getFileName(String? path) {
|
||||
if (path == null || path.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
return path.split('/').last;
|
||||
}
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:fl_lib/fl_lib.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:toolbox/core/utils/misc.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
Future<bool> openUrl(String url) async {
|
||||
return await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
|
||||
}
|
||||
|
||||
void setTransparentNavigationBar(BuildContext context) {
|
||||
if (isAndroid) {
|
||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
const SystemUiOverlayStyle(
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarContrastEnforced: true),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> 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;
|
||||
final 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],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user