mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
opt.: handle situation that font file not existing
This commit is contained in:
@@ -119,8 +119,10 @@ Future<void> loadFontFile(String localPath) async {
|
|||||||
if (localPath.isEmpty) return;
|
if (localPath.isEmpty) return;
|
||||||
final name = getFileName(localPath);
|
final name = getFileName(localPath);
|
||||||
if (name == null) return;
|
if (name == null) return;
|
||||||
|
final file = File(localPath);
|
||||||
|
if (!await file.exists()) return;
|
||||||
var fontLoader = FontLoader(name);
|
var fontLoader = FontLoader(name);
|
||||||
fontLoader.addFont(File(localPath).readAsBytes().byteData);
|
fontLoader.addFont(file.readAsBytes().byteData);
|
||||||
await fontLoader.load();
|
await fontLoader.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
|
||||||
import 'package:toolbox/locator.dart';
|
|
||||||
import 'package:xterm/core.dart';
|
import 'package:xterm/core.dart';
|
||||||
|
|
||||||
|
import '../../locator.dart';
|
||||||
|
import '../store/setting.dart';
|
||||||
|
|
||||||
class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
|
class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
|
||||||
VirtualKeyboard();
|
VirtualKeyboard();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user