feat: wake lock (#347)
This commit is contained in:
@@ -176,6 +176,7 @@ class _SettingPageState extends State<SettingPage> {
|
||||
Widget _buildSSH() {
|
||||
return Column(
|
||||
children: [
|
||||
_buildWakeLock(),
|
||||
_buildTermTheme(),
|
||||
_buildFont(),
|
||||
_buildTermFontSize(),
|
||||
@@ -1130,4 +1131,12 @@ class _SettingPageState extends State<SettingPage> {
|
||||
trailing: StoreSwitch(prop: _setting.collectUsage),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildWakeLock() {
|
||||
return ListTile(
|
||||
leading: const Icon(MingCute.lock_fill),
|
||||
title: Text(l10n.wakeLock),
|
||||
trailing: StoreSwitch(prop: _setting.wakeLock),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import 'package:toolbox/data/provider/virtual_keyboard.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/view/widget/appbar.dart';
|
||||
import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
import 'package:xterm/core.dart';
|
||||
import 'package:xterm/ui.dart' hide TerminalThemes;
|
||||
|
||||
@@ -77,6 +78,8 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
Future.delayed(const Duration(milliseconds: 77), () async {
|
||||
_showHelp();
|
||||
await _initTerminal();
|
||||
|
||||
if (Stores.setting.wakeLock.fetch()) WakelockPlus.enable();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -86,6 +89,7 @@ class _SSHPageState extends State<SSHPage> with AutomaticKeepAliveClientMixin {
|
||||
_virtKeyLongPressTimer?.cancel();
|
||||
_terminalController.dispose();
|
||||
_discontinuityTimer?.cancel();
|
||||
WakelockPlus.disable();
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user