Compare commits

..

3 Commits

Author SHA1 Message Date
Felix Bruns 6060abb73e remove platform specific actions from android app
10 months ago
Felix Bruns 7d93039ed7 require internet access for android
10 months ago
Felix Bruns 1db1657de3 Delay execution of settings loading
10 months ago

@ -1,4 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application <application
android:label="proxmox-dash" android:label="proxmox-dash"
android:name="${applicationName}" android:name="${applicationName}"

@ -7,7 +7,7 @@ import 'src/settings/settings_service.dart';
void main() async { void main() async {
final settingsController = SettingsController(SettingsService()); final settingsController = SettingsController(SettingsService());
await settingsController.loadSettings(); Future<void>.delayed(Duration.zero, () => settingsController.loadSettings());
Log().info("Application started"); Log().info("Application started");
runApp(MyApp(settingsController: settingsController)); runApp(MyApp(settingsController: settingsController));

@ -8,6 +8,7 @@ import 'package:pi_dashboard/src/screen_helper.dart';
import 'package:pi_dashboard/src/settings/settings_controller.dart'; import 'package:pi_dashboard/src/settings/settings_controller.dart';
import '../settings/settings_view.dart'; import '../settings/settings_view.dart';
import 'vm_card.dart'; import 'vm_card.dart';
import 'dart:io' show Platform;
class ProxmoxListerView extends StatefulWidget { class ProxmoxListerView extends StatefulWidget {
const ProxmoxListerView({ const ProxmoxListerView({
@ -76,34 +77,34 @@ class _ProxmoxListerState extends State<ProxmoxListerView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// infinite touch container to turn screen back on // infinite touch container to turn screen back on
return IdleTurnOff( var widget = Stack(
timeout: const Duration(seconds: 60),
onExpire: () async {
await turnOffScreen();
Log().info("No input for 60 seconds. Screen turned off");
},
child: Stack(
children: [ children: [
Scaffold( Scaffold(
appBar: appbar(context), appBar: appbar(context),
body: bodyBuilder(context), body: bodyBuilder(context),
), ),
screenActivator(),
], ],
),
); );
if (Platform.isLinux) {
widget.children.add(screenActivator());
return IdleTurnOff(
timeout: const Duration(seconds: 60),
onExpire: () async {
await turnOffScreen();
Log().info("No input for 60 seconds. Screen turned off");
},
child: widget,
);
} else {
return widget;
}
} }
PreferredSizeWidget? appbar(BuildContext context) { PreferredSizeWidget? appbar(BuildContext context) {
return AppBar( var app = AppBar(
title: const Text("Proxmox VMs"), title: const Text("Proxmox VMs"),
actions: [ actions: [
IconButton(
icon: const Icon(Icons.nightlight),
onPressed: () {
toggleScreen();
},
),
IconButton( IconButton(
icon: const Icon(Icons.sync), icon: const Icon(Icons.sync),
onPressed: () { onPressed: () {
@ -127,6 +128,20 @@ class _ProxmoxListerState extends State<ProxmoxListerView> {
), ),
], ],
); );
if (Platform.isLinux) {
app.actions?.insert(
0,
IconButton(
icon: const Icon(Icons.nightlight),
onPressed: () {
toggleScreen();
},
),
);
}
return app;
} }
Widget bodyBuilder(BuildContext context) { Widget bodyBuilder(BuildContext context) {

Loading…
Cancel
Save