fix: disabled android service related (#670)

Fixes #662
This commit is contained in:
lollipopkit🏳️‍⚧️
2025-01-07 20:36:12 +08:00
committed by GitHub
parent 7f58237589
commit e7a5f43cc4
3 changed files with 49 additions and 43 deletions

View File

@@ -80,36 +80,7 @@ class _EditorPageState extends State<EditorPage> {
@override
void initState() {
super.initState();
/// Higher priority than [path]
if (Stores.setting.editorHighlight.fetch()) {
_langCode =
widget.args?.langCode ?? Highlights.getCode(widget.args?.path);
}
_controller = CodeController(
language: Highlights.all[_langCode],
);
if (_langCode == null) {
_setupCtrl();
} else {
Future.delayed(const Duration(milliseconds: 377)).then(
(value) async => await _setupCtrl(),
);
}
}
Future<void> _setupCtrl() async {
final path = widget.args?.path;
final text = widget.args?.text;
if (path != null) {
final code = await Computer.shared.startNoParam(
() => File(path).readAsString(),
);
_controller.text = code;
} else if (text != null) {
_controller.text = text;
}
_init();
}
@override
@@ -206,3 +177,37 @@ class _EditorPageState extends State<EditorPage> {
));
}
}
extension on _EditorPageState {
Future<void> _init() async {
/// Higher priority than [path]
if (Stores.setting.editorHighlight.fetch()) {
_langCode =
widget.args?.langCode ?? Highlights.getCode(widget.args?.path);
}
_controller = CodeController(
language: Highlights.all[_langCode],
);
if (_langCode == null) {
_setupCtrl();
} else {
Future.delayed(const Duration(milliseconds: 377)).then(
(value) async => await _setupCtrl(),
);
}
}
Future<void> _setupCtrl() async {
final path = widget.args?.path;
final text = widget.args?.text;
if (path != null) {
final code = await Computer.shared.startNoParam(
() => File(path).readAsString(),
);
_controller.text = code;
} else if (text != null) {
_controller.text = text;
}
}
}